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 an agent key. An interactive session streams, and Claude’s cheaper tier doesn’t, so pick a tier rather than Flex race. The race rules are on Flex Racing with Claude models. Your organization needs Anthropic servable first: an Anthropic provider key on your own keys, or Anthropic turned on and funded on Managed Keys.

Set this up with an agent

Copy the block below into any coding agent. It never asks for your API key: you run the one export line 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.

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. Anything not specific to Claude Code is on agent keys.