[BUG] API Error: 404 404 page not found

Status Fixed / completed
Reported on v2.1.17
Maintainer reply None cached
Activity 6 comments · opened Jan 23, 2026 · closed Jan 26, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I'm trying to use Claude Code with Ollama, but getting a 404 error.

# Ollama is running and model is pulled
ollama pull qwen2.5-coder
ollama list  # shows qwen2.5-coder:latest

# Environment variables set
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_BASE_URL=http://localhost:11434/v1

# Running Claude Code
claude --model qwen2.5-coder

Error:

❯ [my prompt]
  ⎿  API Error: 404 404 page not found`

### What Should Happen?

Working with these ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL

### Error Messages/Logs

Steps to Reproduce

ollama pull qwen2.5-coder
ollama list # Expected: qwen2.5-coder appears in the list
npm install -g @anthropic-ai/claude-code
claude /logout
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_BASE_URL=http://localhost:11434/v1
claude --model qwen2.5-coder
Enter any prompt (e.g., "Create a Hello World in Python")

**Expected behavior:**
Claude Code should connect to the local Ollama instance and generate code using the qwen2.5-coder model.

**Actual behavior:**

API Error: 404 404 page not found

Claude Model

Other

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.17 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

6 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/19226
  2. https://github.com/anthropics/claude-code/issues/6086
  3. https://github.com/anthropics/claude-code/issues/15274

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

bradrlaw · 7 months ago

@fabgrd remove the "/v1" from the end of the BASE_URL

However, the integration / api is still broken. You see it on the ollama log side. Here are the ollama logs I see where a 404 is returned on the messages endpoint but not others. Not sure yet is this an issue with ollama or claude at this point.

[GIN] 2026/01/24 - 01:38:07 | 200 | 2.637402ms | 127.0.0.1 | GET "/api/tags"
[GIN] 2026/01/24 - 01:38:25 | 404 | 1.776928ms | ::1 | POST "/v1/messages?beta=true"
[GIN] 2026/01/24 - 01:38:25 | 404 | 1.517692ms | ::1 | POST "/v1/messages?beta=true"

fabgrd · 7 months ago

Thanks a lot for the tip! Tried with another LLM and got: API Error: 400 "deepseek-coder-v2:16b does not support tools".

Is tool support something that needs to be implemented on Ollama's side, or is this an API compatibility issue? Do you think using a proxy like LiteLLM actually solve this problem ?

asjadsyed · 7 months ago

Upgrading Ollama to v0.14.2 fixed this for me. I'll just document some steps to help others.

I have Ollama running via Snap, so I:
1) checked for the right channel (snap info ollama) - currently it's edge
2) switched it to the latest of v0.14.2 with sudo snap switch ollama --edge, and finally
3) actually installed the new version with sudo snap refresh ollama.

On a separate machine where Ollama was installed with curl -fsSL https://ollama.com/install.sh | sh, rerunning the command brought Ollama up to v0.15.0, which also fixed the error.

If you get an error like this:

API Error: 404 {"type":"error","error":{"type":"not_found_error","message":"model 'qwen2.5-coder:latest' not

found"},"request_id":"req_72101449e6e1f9f5eeb1e98b"

Check that you're passing the model exactly as it appears at http://localhost:11434/v1/models.

I'm starting Claude Code like so:
ANTHROPIC_AUTH_TOKEN=ollama ANTHROPIC_BASE_URL=http://localhost:11434 claude --model qwen2.5-coder

Vishal-Isharani · 7 months ago

Upgrading Ollama to v0.15.1 fixed this for me 🙂

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.