Quick fix
# One-liner: confirm the model name, then (Ollama example) set api_base_url to the full address and restart the gateway
ollama list && ccr config set providers.ollama.api_base_url http://localhost:11434/v1/chat/completions && ccr restart
Copy and run; align the model name with ollama list output (example uses Ollama's default 11434 port).
What you will run into
You point the gateway at a local model (e.g. Ollama) per the tutorial, fill in api_base_url, and every request fails: model not found, connection refused, or the gateway throws a routing error.
The tutorial makes "fill in the address" look trivial, but one wrong detail in how the address is written and nothing works.
Why this happens
The gateway (claude-code-router) does not request the model at the bare base address; it requests a full URL: base + /v1/chat/completions.
Filling only the base like http://localhost:11434 means the gateway can't build the full endpoint, so the server either 404s or refuses the connection;
missing the /v1 segment is the same - OpenAI-compatible endpoints usually live under /v1 (upstream Issue #239 scenario).
| Fill-in | Result |
|---|---|
http://localhost:11434/v1/chat/completions (full) | OK (Ollama example) |
http://localhost:11434 (base only) | Gateway can't build the full endpoint |
http://localhost:11434/chat/completions (missing /v1) | Wrong path, 404/error |
- The model name must match
ollama listoutput character for character (including tags like:8b; case counts). - The config change only takes effect after restarting the gateway - change without restart = looks unchanged.
The gateway talks to the model service via the standard OpenAI-compatible protocol: client -> gateway -> model service, and the last leg is a "POST to some URL on the model service".
That URL isn't arbitrary — the protocol fixes it: OpenAI-compatible endpoints live at {base}/v1/chat/completions, where base is the service address (including the port) and /v1/chat/completions is the protocol path.
The api_base_url in the gateway config is "base + path" fused into one field: filling only the base tells the gateway "the endpoint doesn't exist" (it can't build the protocol-required full path);
missing /v1 tells it "the endpoint lives at a nonexistent location".
That's the mechanism behind "one detail wrong and nothing works". The model name is a second exact match: the server indexes models by name, and a mismatch means model not found (tags and case count).
One more easily missed layer: config is loaded at startup, so without a restart the gateway's memory still holds the old config — "looks unchanged" is actually "not reloaded".
Step by step
1. Confirm the model actually exists — Required
ollama list
The output must contain the model name you want, e.g. qwen3:8b. If not, ollama pull <model-name> first.
2. Fill in the full URL — Required
Change api_base_url in the config to (Ollama example):
http://localhost:11434/v1/chat/completions
Key point: include the port and the full /v1/chat/completions path - not just the base.
3. Align the model name character for character — Required
The model name in the config must match ollama list output exactly (including the tag). If unsure, copy the first column of ollama list.
4. Restart the gateway and test — Required
ccr restart
After restarting, send a test request and confirm the error is gone.
How to confirm it works
Calling the full address directly with curl returns a normal response (measured usable form):
curl http://localhost:11434/v1/chat/completions -d '{"model":"<your-model-name>","messages":[{"role":"user","content":"hi"}]}' -H 'Content-Type: application/json'
-> HTTP 200 + JSON response (with choices)
Send the same request through the gateway: no more model not found / connection refused.
Other environments
| Environment | Notes |
|---|---|
| Ollama default port | 11434, local loopback works directly, no extra network config |
| Remote / in-container model service | Fill the actual IP/port into the base; in containers remember 127.0.0.1 often means the container itself |
| LM Studio / llama.cpp etc. | Same full /v1/chat/completions path; ports differ, follow the service startup log |
| Windows / macOS | Same config and restart commands, same path style |
| Not measured | Docker form and remote gateway not measured in this marketplace, honestly noted |
Symptom
Requests fail after configuring a local model (Ollama etc.): model not found / connection refused / routing errors.
Cause
api_base_url must be the full URL (including the /v1/chat/completions path); writing only the base (e.g. http://localhost:11434) or missing /v1 fails (upstream Issue #239 scenario).
Solution
- Write the full URL:
http://localhost:11434/v1/chat/completions(Ollama example). - The model name must match
ollama listoutput. - Save, restart the gateway, then test again.
Verification Evidence
- Upstream Issue #239 + the project's local-model configuration docs.
Applicable tools (1)
This problem is linked from the tool pages below — reachable from either side.
claude-code-routerSource & evidence
← Gateway & Routing domain | Problem Catalog Experience | Facing another issue? Go to the Helpdesk