Skip to main content
Claude Code speaks the Anthropic Messages API. We run that API at POST /v1/messages, so a base URL and a key are the whole integration. Claude Code gives you nowhere to set start_within, so the deadline goes on the key. Create one first (see agent keys). A duration races Claude’s cheaper tier on managed keys, without streaming, inside a window of three to ten minutes. An interactive session streams, so pick a tier here. A key duration still works either way, because it falls back to a tier rather than failing. See Claude durations need a longer window. Your organization has to be able to run Anthropic before you start. On your own keys that means an Anthropic provider key on the Provider keys tab, because we don’t resell inference. On Managed Keys it means Anthropic turned on and funded.

Set this up with an agent

Open the block below and copy it into any coding agent. The prompt never asks for your API key: the agent configures everything else, then prints the one export line for you to run yourself.

Configure Claude Code

  1. Create or open ~/.claude/settings.json. A per-project file at .claude/settings.json works the same way.
  2. Add an env block naming the router, your key, and both models.
  3. Start Claude Code.
Export the same variables in your shell instead, to keep the secret out of a file.
Four rules make this work. Omit the /v1 suffix. Claude Code appends /v1/messages to the base URL itself. Use ANTHROPIC_AUTH_TOKEN, never ANTHROPIC_API_KEY. The first sends Authorization: Bearer, which we require. The second sends x-api-key, which we refuse. Set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS to 1. Claude Code otherwise sends experimental beta fields such as context_management. We don’t forward the anthropic-beta headers those fields need, so every request fails. Set both model variables. Claude Code runs a large main-loop model and a small background model against one key. Both must be claude-* slugs.

Confirm the key applied

Every response comes with x-flexinference-defaults-applied. Claude Code doesn’t show response headers, so read the request in the dashboard under Logs instead.

Troubleshooting

400 context_management: Extra inputs are not permitted. Claude Code sent an experimental beta field, and we don’t forward the anthropic-beta header it needs. Set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 and start a new session. The same flag clears any other Extra inputs are not permitted refusal naming a beta field. 401 missing_api_key. You set ANTHROPIC_API_KEY, so the client sent x-api-key, which we don’t read. Set ANTHROPIC_AUTH_TOKEN instead and unset ANTHROPIC_API_KEY. 400 unsupported_parameter naming output_config. A model variable points at a non-Claude slug, and Claude Code sends Anthropic-native fields we refuse to mistranslate. Set both model variables to claude-* slugs. 404 unknown_url naming /v1/messages/count_tokens. We don’t route that path. A claude -p run never calls it, though an interactive session may. Every request spends a full retry budget. Claude Code retries on its own, and a key retry policy stacks with it. Leave retry unset on a key this client uses. See errors for every refusal we return, and agent keys for the ones that are not specific to Claude Code.