CanalAPI

Connection troubleshooting

Diagnose URL, key, model, balance, rate-limit, and network issues in Claude Code, Codex, and API clients.

Where to start

  1. Record the tool version, operating system, time, and error type. Never share your key.
  2. Compare your URL and full model ID with getting started. Change one setting at a time and send a minimal request.
  3. In Claude Code and Codex, use /status to inspect the active provider, model, and connection information. Saving a file does not mean a running process has loaded it.
  4. Use the table below instead of repeated reinstalls, top-ups, or unlimited retries.

Which URL belongs where?

Client or endpointBase URL / pathCommon mistake
Claude Code / Anthropic SDKhttps://api.canalapi.comIncluding /v1 in Claude Code's base URL
Codex / OpenAI SDKhttps://api.canalapi.com/v1Omitting /v1 or appending /responses
Direct Chat Completions requesthttps://api.canalapi.com/v1/chat/completionsUsing a full endpoint as an SDK base URL
Native Gemini RESThttps://api.canalapi.com/v1beta/models/{model}:generateContentUsing /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

SymptomCheck firstAction
Command not foundInstallation and refreshed PATHOpen a new terminal and check the version; Claude Code also provides claude doctor
Original provider still active / login requestedProcess environment, user config location, settings precedenceFollow the Claude Code or Codex guide; do not delete your entire configuration directory
401 / invalid_api_keyComplete key, expiry, enabled status, IP restrictionsVerify the key and current public egress IP in the dashboard; an account password is not an API key
402 / insufficient_balanceAvailable account creditInspect the error body and dashboard; resolve the account issue rather than automatically retrying
403 / api_key_quota_exhaustedThis key's cumulative spending capAdjust its authorized cap or use an authorized replacement key; topping up the account does not raise the key's cap
403 / permission errorAllowed models and request scopeCheck restrictions and the error body
400 / 404 / unavailable modelExact model ID, URL path, supported protocolReplace placeholders; do not guess aliases. See models
429Request rate, concurrency, upstream limitsHonor Retry-After when present, reduce concurrency, and use bounded backoff
Timeout / DNS / TLS errorNetwork, proxy, firewall, client timeoutDiagnose connectivity without disabling certificate verification
Chat works but Codex or tools failResponses, streaming, and tool supportTry a minimal Responses request with the same model before testing tools; chat success does not prove all capabilities
A stream stops after partial outputNetwork interruption, timeout, upstream errorsSave 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_TOKEN

macOS / 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.

On this page