Claude Code
Route Claude Code through Gate to add prompt-injection scanning, audit, caching, and cost tracking. Your workflow does not change.
Claude Code reads its settings from ~/.claude/settings.json. Add one of the blocks below, then restart Claude Code. Create your Gate key (sk-gw-…) under API keys in the dashboard.
Pay through Gate
Use your Gate key as the only credential. Gate routes each request and bills your prepaid balance.
{ "env": { "ANTHROPIC_BASE_URL": "https://gateway.constellationgate.ai", "ANTHROPIC_API_KEY": "sk-gw-…your Gate key…", "ANTHROPIC_MODEL": "anthropic/claude-opus-4-8", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-4-5", "ANTHROPIC_CUSTOM_HEADERS": "X-Gate-Api-Key: sk-gw-…your Gate key…" }}Both the key and the models are placeholders. Use your own Gate key (sk-gw-…) and any models from the Gate catalog, written provider/model. Browse IDs on the dashboard’s Models page or via GET /v1/models. ANTHROPIC_DEFAULT_HAIKU_MODEL sets Claude Code’s fast background tier, so point it at a smaller, cheaper model.
Use your own keys
Keep your existing Anthropic login or API key. Gate forwards your request to Anthropic and adds its security and audit layer underneath.
{ "env": { "ANTHROPIC_BASE_URL": "https://gateway.constellationgate.ai", "ANTHROPIC_CUSTOM_HEADERS": "X-Gate-Api-Key: sk-gw-…your Gate key…\nX-Gate-Upstream-Url: https://api.anthropic.com" }}Replace sk-gw-…your Gate key… with your own Gate key. Your Anthropic credential stays whatever Claude Code already uses; Gate forwards it unchanged.
Confirm requests are flowing
Open the dashboard and use Claude Code the way you normally would. New requests appear on the Messages page within a few seconds, each with its model, cost, and security result.
Related
- Authentication: keys, and how each request decides who pays.
- Gate Connect: connect Claude Code without editing config.