Claude Code with idapt
Found this helpful? Share it:
Found this helpful? Share it:
Set up Claude Code against idapt's compatible APIs with the steps below. This article and the AI Gateway quickstarts lander render the same shared steps, so they never drift.
Claude Code with idapt
Three environment variables route Claude Code through idapt, with per-key spend caps on top.
curl -fsSL https://claude.ai/install.sh | 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.
# 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.
The quickstart keeps claude code as your surface. When you are ready to leave it, one command imports its chat history into idapt: run Import chats from coding agents (idapt chat import --from claude-code), then continue in idapt directly.
Claude Code skills and idapt skills are the same system at heart: a
SKILL.md whose frontmatter names the skill and whose body is what
agents reach for. Importing chats with idapt chat import --from
claude-code also picks them up: it scans the global store
(~/.claude/skills) and the current repo (.claude/skills), lists
what it found, and recreates each one as an idapt skill. Skills that
already exist are kept as they are.
Claude-Code-specific frontmatter like allowed-tools is dropped on
purpose: in idapt, what an agent may do is controlled by the agent's
own permissions, not by the skill file, so a skill can never widen
an agent's access. If a skill ships companion files or reference
folders, upload them to Drive so agents can read them on demand;
multi-file skills are planned.
See Skills for how skills reach every agent in a workspace with nothing to attach.
Related articles
API keys and scopes
Create a key, choose its scopes, pin it to an API version, rotate it, and cap what it can spend.
Rate limits and errors
Every error shape the API returns, what each rate limit is, and how to handle a wall in code.
Cap what an API key spends
Give every Gateway API key a lifetime, monthly, or daily USD cap, and what a capped-out key returns.
Anthropic-compatible API
Use idapt's 200+ models from Claude Code or any app that speaks the Anthropic Messages API.
Skill packs
Bundles of reusable instructions you invoke with a slash, attach to agents, or install from a repo.
Codex CLI with idapt
Configure OpenAI Codex CLI to route through idapt: a model_provider block in config.toml with the base URL, the chat wire API, and your key.
OpenCode with idapt
Configure OpenCode to route through idapt's OpenAI-compatible API: a provider block in opencode.json with the base URL and your key.
Import chats from coding agents
Bring your Claude Code, Codex, or OpenCode session history into idapt with one CLI command: dates and tool calls included.
Was this helpful?