Connection troubleshooting
Diagnose URL, key, model, balance, rate-limit, and network issues in Claude Code, Codex, and API clients.
Where to start
- Record the tool version, operating system, time, and error type. Never share your key.
- Compare your URL and full model ID with getting started. Change one setting at a time and send a minimal request.
- In Claude Code and Codex, use
/statusto inspect the active provider, model, and connection information. Saving a file does not mean a running process has loaded it. - Use the table below instead of repeated reinstalls, top-ups, or unlimited retries.
Which URL belongs where?
| Client or endpoint | Base URL / path | Common mistake |
|---|---|---|
| Claude Code / Anthropic SDK | https://api.canalapi.com | Including /v1 in Claude Code's base URL |
| Codex / OpenAI SDK | https://api.canalapi.com/v1 | Omitting /v1 or appending /responses |
| Direct Chat Completions request | https://api.canalapi.com/v1/chat/completions | Using a full endpoint as an SDK base URL |
| Native Gemini REST | https://api.canalapi.com/v1beta/models/{model}:generateContent | Using /v1 or sending a key in ?key= |
For Gemini, use an Authorization: Bearer ... or x-goog-api-key header. Anthropic requests can use x-api-key, containing only the key without a Bearer prefix. See authentication.
Diagnose by symptom
| Symptom | Check first | Action |
|---|---|---|
| Command not found | Installation and refreshed PATH | Open a new terminal and check the version; Claude Code also provides claude doctor |
| Original provider still active / login requested | Process environment, user config location, settings precedence | Follow the Claude Code or Codex guide; do not delete your entire configuration directory |
401 / invalid_api_key | Complete key, expiry, enabled status, IP restrictions | Verify the key and current public egress IP in the dashboard; an account password is not an API key |
402 / insufficient_balance | Available account credit | Inspect the error body and dashboard; resolve the account issue rather than automatically retrying |
403 / api_key_quota_exhausted | This key's cumulative spending cap | Adjust its authorized cap or use an authorized replacement key; topping up the account does not raise the key's cap |
| 403 / permission error | Allowed models and request scope | Check restrictions and the error body |
| 400 / 404 / unavailable model | Exact model ID, URL path, supported protocol | Replace placeholders; do not guess aliases. See models |
| 429 | Request rate, concurrency, upstream limits | Honor Retry-After when present, reduce concurrency, and use bounded backoff |
| Timeout / DNS / TLS error | Network, proxy, firewall, client timeout | Diagnose connectivity without disabling certificate verification |
| Chat works but Codex or tools fail | Responses, streaming, and tool support | Try a minimal Responses request with the same model before testing tools; chat success does not prove all capabilities |
| A stream stops after partial output | Network interruption, timeout, upstream errors | Save the request ID and error event; do not blindly replay the operation and risk duplicate charges or tool effects |
Use the status code to narrow the issue, then inspect type, code, and message. Upstream quota failures can also occur; not every 402 means your own account balance is low.
An environment variable seems to have no effect
A terminal assignment affects that session and programs started from it. Other terminals, desktop apps, IDE extensions, WSL, and containers may have separate environments. Restart the actual application after changing persistent settings.
Check presence without printing secrets:
Windows PowerShell
[bool]$env:CANALAPI_API_KEY
[bool]$env:ANTHROPIC_AUTH_TOKENmacOS / Linux / WSL
test -n "$CANALAPI_API_KEY" && echo 'CANALAPI_API_KEY: set' || echo 'CANALAPI_API_KEY: unset'
test -n "$ANTHROPIC_AUTH_TOKEN" && echo 'ANTHROPIC_AUTH_TOKEN: set' || echo 'ANTHROPIC_AUTH_TOKEN: unset'Only the variable used by your chosen tool matters. True or set means nonempty, not valid. If Claude Code's user settings.json defines the same variable, check that source too. Do not share full settings files or terminal history.
Why does the model list work when inference fails?
GET /v1/models is a public catalog. It does not perform protected inference or check your key and credit. Send a minimal request with a real key and supported model, then inspect usage logs. After text works, test the streaming, image, or tool capabilities you actually need.
What to include in a support request
Include the tool and version, operating system, timestamp and time zone, endpoint, model ID, HTTP status, error type, and the X-Request-Id response header or dashboard request ID. Provide minimal reproduction steps and note whether any partial response arrived.
Remove API keys, Authorization headers, personal data, and private project content. Do not upload complete .env, auth.json, or credential-bearing configuration files. See error handling for application diagnostics.