DEV Community

Cover image for One‑Line Magic: Using Claude Code Through Ollama
0xkoji
0xkoji

Posted on

One‑Line Magic: Using Claude Code Through Ollama

requirements

  • Ollama v0.15+
  • You have pulled a model via ollama pull

https://ollama.com/blog/launch

Run ollama launch

launch commands allow us to use a few AI coding agents.
Claude Code, Clawdbot(Openclaw), Codex, Droid, and OpenCode.

ollama launch
Select integration: 
  > claude - Claude Code (gpt-oss:20b)
    clawdbot - Clawdbot
    codex - Codex
    droid - Droid
    opencode - OpenCode
Enter fullscreen mode Exit fullscreen mode

Then you will need to select a model you want use for Claude Code. (In this article, I used gpt-oss:20b model)

ollama launch

Launching Claude Code with gpt-oss:20b...

╭─── Claude Code v2.1.29 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                    │ Tips for getting started                                                                           │
│                 Welcome back baxin!                │ Run /init to create a CLAUDE.md file with instructions for Claude                                  │
│                                                    │ ─────────────────────────────────────────────────────────────────                                  │
│                                                    │ Recent activity                                                                                    │
│                       ▐▛███▜▌                      │ No recent activity                                                                                 │
│                      ▝▜█████▛▘                     │                                                                                                    │
│                        ▘▘ ▝▝                       │                                                                                                    │
│     gpt-oss:20b · API Usage Billing · baxin’s      │                                                                                                    │
│     Individual Org                                 │                                                                                                    │
│               ~\Desktop\dev\zenn-dev               │                                                                                                    │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯


 ‼Auth conflict: Both a token (ANTHROPIC_AUTH_TOKEN) and an API key (/login managed key) are set. This may lead to unexpected behavior.                    
    • Trying to use ANTHROPIC_AUTH_TOKEN? claude /logout                                                                                                   
    • Trying to use /login managed key? Unset the ANTHROPIC_AUTH_TOKEN environment variable.                                                               
  /model to try Opus 4.5                                                                                                                                   

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
> Try "how does <filepath> work?"                                                                                                                          
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ? for shortcuts                                                                                                                                          

Enter fullscreen mode Exit fullscreen mode

OpenCode

Top comments (0)