Skip to main content
Run Claude Code on Together coding models such as GLM 5.3, Kimi K3, and DeepSeek V4 by routing it through LiteLLM, an open-source gateway you run on your own machine. The LiteLLM proxy serves the Anthropic Messages API used by Claude Code and sends each call to the Together API.
TogetherLink also runs Claude Code on Together models, with no proxy to manage.

Requirements

Step 1: Install LiteLLM

Install the proxy with pip or uv:

Step 2: Export your Together API key

LiteLLM reads the key from TOGETHERAI_API_KEY, not TOGETHER_API_KEY like the Together SDKs. Set it in your terminal before starting:

Step 3: Configure the proxy

Define your models in a config.yaml. Prefix each Together model ID with together_ai/, and give each model a short alias to pass to Claude Code. Any model from the serverless catalog works:
config.yaml

Step 4: Start the proxy

Start the server:
The --host 127.0.0.1 flag keeps the proxy reachable only from your own machine.
The proxy takes over this terminal, so open a new one and verify it serves your models:
You should see your aliases in the response:

Step 5: Connect Claude Code

In the same terminal, point Claude Code at the proxy and pass an alias from your config:
The proxy doesn’t check ANTHROPIC_AUTH_TOKEN, so any value works. Setting it lets Claude Code run without an Anthropic login. If you’re logged in to Claude Code, you can omit it. Claude Code starts as usual, with every request going through the proxy to the Together API.
Claude Code is now running on GLM 5.3, served by Together AI through your own gateway.

Secure the proxy (optional)

A master key makes the proxy require a key on every request. Set one before exposing the proxy beyond your machine, since anyone who can reach an unauthenticated proxy can spend on your Together account. The master key is a secret you make up, not a key issued by Together or LiteLLM:
config.yaml
Export a random value in the terminal that runs the proxy, then restart it:
Clients now authenticate with the master key. Pass it as ANTHROPIC_AUTH_TOKEN for Claude Code, and as a Bearer token for direct calls to the proxy. To give other people their own keys and budgets instead of sharing the master key, create virtual keys, which also require a Postgres database.

Troubleshooting

Requests fail with No connected db: The proxy has a master key configured and the token you passed doesn’t match it. This usually means LITELLM_MASTER_KEY is unset or has a different value in the terminal where you ran claude or curl. Export the value the proxy started with and try again. The proxy logs Invalid model name passed in model=claude-sonnet-5: Something in your session, such as a subagent pinned to Anthropic’s sonnet alias, requested a model that isn’t in your model_list. Claude Code keeps working, but those requests fail. To route the aliases to a Together model, export ANTHROPIC_DEFAULT_SONNET_MODEL=glm-5.3 (and the matching OPUS and HAIKU variables) before starting Claude Code.

Next steps

TogetherLink

Run Claude Code on Together models without hosting a proxy.

Serverless models

Browse every model you can serve through the proxy.

OpenAI compatibility

See how the Together API maps to OpenAI’s format.

Third-party integrations

Use Together through other partner SDKs and gateways.