Claude Code with idapt
Three environment variables route Claude Code through idapt, with per-key spend caps on top.
- 1
Install
bashcurl -fsSL https://claude.ai/install.sh | bash - 2
Point it at idapt
bashexport ANTHROPIC_BASE_URL="https://idapt.app/api/anthropic" export ANTHROPIC_AUTH_TOKEN="$IDAPT_API_KEY" export ANTHROPIC_API_KEY="" claudeAdd these to your shell profile so every session picks them up. The base URL has no /v1: Claude Code appends /v1/messages itself.
- 3
Going further
bash# Optional: pin models per task class, then confirm with /model export ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-sonnet-5" export CLAUDE_CODE_SUBAGENT_MODEL="anthropic/claude-sonnet-5" export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1Discovery populates the /model picker from the gateway. Pin the other classes (OPUS, HAIKU, FABLE) the same way.
GOOD TO KNOW
API keys and scopesOpenAI-compatible API referenceOpenRouter-compatible API referenceRate limits and errorsSpend caps and budgets