P

Loading...

Ollama๐Ÿฆ™ + Claude Code = ๐Ÿ”ฅ
Tech

Ollama๐Ÿฆ™ + Claude Code = ๐Ÿ”ฅ

April 11, 2026by PETER
615
by PETER

Intro

  • The topic for today is very simple, but it's a guide for people like me who want to use not only OpenClaw but also the full harness of Claude Code for just $20, instead of paying the $100+ monthly subscription fee for Claude Code.๐Ÿ‘พ

    • Performance aside, I'm using the $20 Ollama Pro model with the satisfaction of a $100 Claude Code Max. The token limit is more than sufficient; if anything, it's more generous. I even run OpenClaw๐Ÿฆž on the same plan.

    • You can also try Ollama Cloud with a free account! If you're interested, I recommend testing it right away. :)

  • From my personal experience, the Ollama Cloud models aren't quite at the level of Opus yet, but I feel they're performing around the level of Haiku. It also seems there are no issues using them with cool harnesses like Superposers - Ouroboros, which I introduced in a previous post.

  • If you're new to Claude Code, it might be a good idea to start with Ollama for a light experience and then move on to a paid Claude Code plan if you feel its limitations. :)


0. Install Ollama & Claude Code โœ”๏ธ

  • You must, of course, have Ollama and Claude Code installed. If you haven't installed them yet, download and install Ollama on your PC, and do the same for Claude Code.

1. Set Up Environment Variables โš™๏ธ

  • If you want to permanently use Claude Code with Ollama models, set up your environment variables as shown below. If you don't plan to set this up permanently, SKIP this part! ๐Ÿงœ

macOS / Linux ๐Ÿ’ป

  • In ~/.zshrc or ~/.bashrc, add the following:
     # Add the following to ~/.bashrc or ~/.zshrc
     export ANTHROPIC_AUTH_TOKEN="ollama"
     export ANTHROPIC_API_KEY=""
     export ANTHROPIC_BASE_URL="http://localhost:11434"
    
     # Save and apply
     source ~/.zshrc # (or source ~/.bashrc)
    

Windows ๐ŸชŸ

  • If you're a Windows user, there are two methods.

    1. Open Powershell and enter the following.

    # Edit your profile
    notepad $PROFILE
    
    # Add the following
    $env:ANTHROPIC_AUTH_TOKEN = "ollama"
    $env:ANTHROPIC_API_KEY = ""
    $env:ANTHROPIC_BASE_URL = "http://localhost:11434"
    
    # After saving
    . $PROFILE
    
  • If the profile file doesn't exist:

    New-Item -Path $PROFILE -ItemType File -Force
    

2. Add the three variables above as system environment variables

  1. Win + X โ†’ "System" โ†’ "Advanced system settings"

    image

  2. โ†’ "Environment Variables..."

    image

  3. Click "New..."

    image

  4. Add the 3 variables from above

    image

  5. Reboot


2. Run Claude Code!๐Ÿ‘พ

  • If you permanently set up Claude to use Ollama in step 1, you can start with the following command!

    claude --model gemini-3-flash-preview:cloud

    • The great thing about a permanent setup is that the claude command will now work with Ollama models, allowing you to use options like --dangerously-skip-permissions! ๐Ÿ˜Ž

    • By setting up an alias in your .zshrc as shown below, you can also solve the hassle of using Claude Code with options like --dangerously-skip-permissions with a simple command.๐Ÿ˜‰

      alias cc='claude --model gemini-3-flash-preview:cloud --dangerously-skip-permissions'
      
  • If you just want to try using Claude with Ollama, you can quickly check it out with the command below.๐Ÿ˜

    ollama launch claude

  • As of April 2024, the gemini-3-flash-preview:cloud model seems to be the smartest one available on Ollama..! Use gemini-3-flash... use it twice..๐Ÿค—


3. Actually, Codex and OpenCode are also possible!

  • You can set up Codex and OpenCode in the same way. It's almost identical. Check the official documentation.
    Not because I'm too lazy to write it out lol

Wrapping Up ๐Ÿณ

  • It's that easy, right? ๐Ÿ‘จ๐Ÿปโ€๐ŸŽจ ๐Ÿ–ผ๏ธ
โœจHAPPY BUILDING!๐Ÿ‘ทโ€โ™‚๏ธ

References

6
Buy me a coffee

2 comments

ํƒ€์˜ค
ํƒ€์˜ค4/12/2026

์ข‹์€ ํˆด ํ•˜๋‚˜ ์–ป์–ด๊ฐ‘๋‹ˆ๋‹ค! ๋ฐ”๋กœ ํ…Œ์ŠคํŠธ ํ•ด๋ด…๋‹ˆ๋‹ค!

2
PETER
PETER4/13/2026

gemini-3-flash-preview:cloud ๋ชจ๋ธ์ด ์ œ์ผ ๊ดœ์ฐฎ์€๊ฑฐ ๊ฐ™๋”๋ผ๊ณ ์š”! ใ…Žใ…Žใ…Ž ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค! ๋Œ“๊ธ€ ๊ฐ์‚ฌํ•ด์š”~~

1

Please login to leave a comment.