Connect a coding agent#

Point your coding agent at the gateway with the setup the dashboard writes, so each of its requests is traced and costed.

  1. On Home, under Connect your coding agent, choose your agent, such as Claude Code.
  2. Under Gateway key, choose Create API key, then Copy key line, and add the line to your shell profile. Or export a key you have as TOKEDEX_API_KEY.
  3. Under Model, choose a model, such as anthropic/claude-haiku-5.5.
  4. Choose Copy setup prompt and paste the prompt into a coding agent on this computer. It sets up yours.
  5. In a new session of your agent, ask it to run printf gateway-ok. It reports gateway-ok.

The Connect Claude Code panel, with a model chosen and the setup prompt to copy

You need: the agent, and an API key that can call the model or a role that can create one. Each request the agent sends can incur provider charges.

Supported agents#

Claude Code, Codex, Copilot, Cursor, OpenCode, Pi, Grok Build, Kimi Code, Mistral Vibe, DeepSeek Harness, Mirror and Cline. Model lists the compatible models your key can call with the selected agent. If the panel says there is no supported setup, choose another agent, such as Pi or OpenCode. For Claude Code, choose a model Anthropic serves. An OpenAI model can stop Claude Code when it compacts its context.

A key made on Home is your Quick start key: it calls every model you may use and never expires. Keep it for your own computer. For an agent anywhere else, such as a shared machine, create a key from the Coding agent template under API keys: it expires after 30 days and has a $50 monthly budget, so a key left behind stops on its own and its spend is capped.

For another API key, open the key in API keys and choose its Connect tab, where the last five agents are under More tools. Export your saved copy of that key as TOKEDEX_API_KEY.

Setup prompt#

The setup prompt has the agent read the key from TOKEDEX_API_KEY without printing it; the key is never in the prompt. Where there is a desktop app, it asks whether to set up the CLI, the app or both. It merges its settings into the agent's configuration, keeping your others, then checks the key:

Shell
export TOKEDEX_URL='http://127.0.0.1:4000'
curl -sS -o /dev/null -w '%{http_code}\n' "$TOKEDEX_URL/v1/models" \
  -H "Authorization: Bearer $TOKEDEX_API_KEY"
code
200

A 200 proves only the key, so finish with the printf gateway-ok check. To set the agent up by hand, expand Manual instructions, with tabs for the CLI and the Desktop app. A command or configuration holds the key only right after you create it. Otherwise it reads TOKEDEX_API_KEY or says <your Tokedex key>, which you replace.

See the agent's requests#

In Observability, the newest request names your key and model. Every agent but Cursor, Mirror and the Cline CLI tags its requests agent:<id>; under Sessions, a Claude Code, Codex or OpenCode session shows agent:claude-code, agent:codex or agent:opencode under Tags.

Give each computer you run an agent on its own key. Observability and the spend report then show each one's requests and spend apart, and revoking one key stops one computer only.

Troubleshoot Claude Code#

  • 401. ANTHROPIC_AUTH_TOKEN must hold your API key and ANTHROPIC_API_KEY must be empty, in your shell and any saved environment. In the CLI, /status shows the gateway as the base URL.
  • 422 "the reasoning control $.reasoning.budgetTokens is not supported by this model". Use the hyphenated model ID, such as anthropic/claude-opus-4-7 rather than anthropic/claude-opus-4.7. Claude Code recognizes Claude Opus 4.6, 4.7 and 4.8 and Sonnet 4.6 only by their hyphenated names. With the dotted ID it sends a manual thinking budget, which these models refuse.
  • The desktop app rejects the model. Choose a Claude model under Model. Auto mode also needs a classifier model that the profile lists and the key can call.
  • You want your Claude account back. Sign out of third-party inference, choose Sign in with Claude.ai and relaunch.

Claude Code compaction on OpenAI models#

When its context fills during a tool loop, Claude Code asks the model for a text-only summary while a tool call is still pending. An OpenAI model can answer with another tool call instead, and Claude Code stops with "summarization produced empty response". This can happen on any model ID that an OpenAI model serves, including openai/gpt-6-luna and routers that can choose an OpenAI model. To avoid it, choose a model that Anthropic serves, such as anthropic/claude-haiku-5.5.

Troubleshoot Codex#

  • An earlier configuration. In config.toml and any active profile, replace the whole [model_providers.tokedex] table and its child tables, and remove model_catalog_json and model_instructions_file overrides. Restart Codex.
  • No key. Start the CLI where TOKEDEX_API_KEY is set. For the desktop app, fully quit it; on macOS run launchctl setenv TOKEDEX_API_KEY "$TOKEDEX_API_KEY" and open -a Codex, again after each macOS sign-out; on Windows, add the variable in Edit environment variables for your account.
  • The app's picker lacks the model. Codex uses the one in config.toml.

Switch providers in a session#

For Codex, apply the generated setup for the new model before you resume. On a best-effort route, the gateway replays compatible namespaced tool calls and their results using prefixed names. The current tool list determines which tools the new model can call.

When you switch Kimi Code from OpenAI Responses to Anthropic Messages, start a new session on the new model. Carry forward a text summary of your work and any results the new session needs. A resumed session can send the old provider's signed thinking as Anthropic thinking, which Anthropic rejects with Invalid signature.

Troubleshoot other agents#

  • In the Cursor editor, open Settings → Models → API Keys. Turn on Use OpenAI API Key, enable Override OpenAI Base URL, then add the exact model ID from the dashboard. This setup requires a public HTTPS gateway address and a signed-in editor. Use one of the other agents for a loopback-only gateway. Cursor editor setup · HTTPS and reverse proxies
  • To resume Cline, open a terminal and run cline --id <session-id> for an interactive session. Use a fresh session for headless --json commands, which cannot currently resume by ID. Cline CLI reference
  • Copilot needs a model with a thinking effort on Chat Completions. In VS Code, keep the apiKey VS Code wrote, and restart VS Code if the model is missing.
  • OpenCode needs OpenCode 2 (@opencode/cli), Mistral Vibe 3.1.2 or later, and DeepSeek Harness Node.js 24.9 or newer.
  • A snippet says <model>. The key can call no model on that API. Put a model ID from Find a model in its place.

Next: API keys, Find and inspect a request or Errors, limits and request IDs.