[BUG] ollama: model prefix not stripped from API request body
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?
When using --model ollama:<model>, Claude Code sends the full prefixed name (e.g. ollama:qwen3-coder) in the model field of the API request body instead of stripping the ollama: provider prefix. Ollama doesn't recognize the prefixed name and returns a 404:
{"type":"error","error":{"type":"not_found_error","message":"model 'ollama:qwen3-coder' not found"}}
Verified by curling the Ollama /v1/messages endpoint directly:
# Fails (404) — this is what Claude Code sends:
curl "http://<host>:11434/v1/messages?beta=true" -d '{"model":"ollama:qwen3-coder",...}'
# Works (200) — correct model name:
curl "http://<host>:11434/v1/messages?beta=true" -d '{"model":"qwen3-coder",...}'
What Should Happen?
Claude Code should strip the ollama: provider prefix before including the model name in the API request body, same as how the base URL is resolved from the prefix.
Error Messages/Logs
Claude Code shows:
There's an issue with the selected model (ollama:qwen3-coder). It may not exist or you may not have access to it. Run /model to pick a different model.
Ollama server logs:
[GIN] 2026/03/12 - 15:22:21 | 404 | 67.365286ms | 176.148.64.230 | POST "/v1/messages?beta=true"
Steps to Reproduce
- Have Ollama running on a remote (or local) machine with a model pulled (e.g.
qwen3-coder) - Run:
``bash``
ANTHROPIC_AUTH_TOKEN=ollama ANTHROPIC_API_KEY="" ANTHROPIC_BASE_URL=http://<host>:11434 claude --model ollama:qwen3-coder
- Send any message
- Get the "issue with the selected model" error
Workaround
Create an Ollama model alias matching the prefixed name:
ollama cp qwen3-coder "ollama:qwen3-coder"
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.74 (Claude Code)
Platform
Anthropic API
Operating System
Linux (Arch)
Terminal/Shell
Kitty
Additional Information
Ollama version: 0.17.7
Remote model: qwen3-coder (30B)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗