Claude Code + TOKNADO
How to use Claude Code with TOKNADO (via a LiteLLM gateway)
Claude Code talks to its backend using the Anthropic Messages API. Anthropic's gateway documentation says an LLM gateway must expose an Anthropic-format endpoint for Claude Code to use it. TOKNADO is an OpenAI-compatible endpoint, so the two don't connect directly.
The standard bridge is a small translation proxy. LiteLLM exposes an Anthropic-format endpoint and forwards the calls to any OpenAI-compatible backend. Put it between Claude Code and TOKNADO and you get Claude Code's interface on top of TOKNADO's pool.
Start free trial Jump to setup
What you need
- Claude Code installed and working.
- Python 3.10+ and
pip(oruv) for LiteLLM. - Your TOKNADO endpoint, API key and a model ID from your dashboard.
Setup: Claude Code with TOKNADO
Install LiteLLM's proxy
This runs locally and translates Anthropic-format requests into OpenAI-format requests for TOKNADO.
pip install 'litellm[proxy]'Create a LiteLLM config
Give the model an alias that Claude Code will request, and map it to your TOKNADO model through the
openai/route.model_list: - model_name: toknado-main litellm_params: model: openai/toknado/auto api_base: https://toknado.up.railway.app/v1 api_key: os.environ/TOKNADO_API_KEY general_settings: master_key: sk-local-change-meStart the proxy
Keep it running in its own terminal.
export TOKNADO_API_KEY=YOUR_TOKNADO_API_KEY litellm --config litellm-config.yaml --host 127.0.0.1 --port 4000Point Claude Code at the proxy
Set the base URL to the LiteLLM address and use the master key as the token, then request your alias.
export ANTHROPIC_BASE_URL=http://localhost:4000 export ANTHROPIC_AUTH_TOKEN=sk-local-change-me claude --model toknado-main
Notes for real-world use
- Claude Code can query a gateway's
/v1/modelsendpoint at startup and add the results to its model picker, but per Anthropic's gateway docs only IDs beginning withclaudeoranthropicare listed. Naming your alias with aclaude-prefix makes it appear in the picker; otherwise pass it with--model. - Claude Code issues many requests per session. Check the hourly limit on your TOKNADO plan against how heavily you code.
- If TOKNADO adds a native Anthropic Messages endpoint in future, you can drop the LiteLLM layer and set
ANTHROPIC_BASE_URLdirectly. Check the TOKNADO setup guide for current options.
Troubleshooting Claude Code + TOKNADO
| Symptom | What to check |
|---|---|
| Claude Code ignores the proxy | ANTHROPIC_BASE_URL must be set in the same shell that launches claude. |
| 401 from the proxy | ANTHROPIC_AUTH_TOKEN must equal LiteLLM's master_key. |
| Proxy errors reaching TOKNADO | Confirm api_base and TOKNADO_API_KEY in the LiteLLM terminal, and test the endpoint with curl directly. |
| Model not found | The alias passed to --model must match model_name in the LiteLLM config. |
| Tool calls fail or loop | Not every model handles Claude Code's tool use well. Try another model from your TOKNADO pool. |
FAQ
Can Claude Code connect straight to an OpenAI-compatible endpoint?
No. Claude Code needs an Anthropic Messages-compatible endpoint. A proxy such as LiteLLM translates between the two formats.
Is this an official Anthropic or TOKNADO feature?
It uses Claude Code's documented gateway support (ANTHROPIC_BASE_URL) with the open-source LiteLLM proxy. TOKNADO is not affiliated with Anthropic.
Will I get Claude models?
That depends on the models your TOKNADO pool serves. The proxy only translates the request format.
Where do I run LiteLLM?
On your own machine for personal use, or on a small server for a team. Keep the master key private.