Claude Code
Claude Code is Anthropic's official CLI for Claude. It natively supports custom base URLs and headers, making it one of the most flexible tools for Corveil integration.
Prerequisites
- A running Corveil instance (see deployment options)
- A Corveil virtual API key (
sk-citadel-...) - Claude Code installed
Mode
Direct and Passthrough modes supported. Claude Code supports both ANTHROPIC_API_KEY override (Direct) and ANTHROPIC_CUSTOM_HEADERS (Passthrough).
Option A: Direct Mode
Your ANTHROPIC_API_KEY is a Corveil virtual key. Corveil authenticates the request and forwards it upstream using its own provider credentials.
export ANTHROPIC_BASE_URL="https://your-corveil-host"
export ANTHROPIC_API_KEY="sk-citadel-your-key-here"Or configure via settings.json (project .claude/settings.json or global ~/.claude/settings.json):
{
"env": {
"ANTHROPIC_BASE_URL": "https://your-corveil-host",
"ANTHROPIC_API_KEY": "sk-citadel-your-key-here"
}
}Option B: Passthrough Mode
Your own Anthropic API key or OAuth token is sent directly to Anthropic. A separate x-citadel-api-key header authenticates with Corveil for tracking and guardrails.
export ANTHROPIC_BASE_URL="https://your-corveil-host"
export ANTHROPIC_CUSTOM_HEADERS="x-citadel-api-key: sk-citadel-your-key-here"Launch and Verify
claudeAsk a simple question. If it responds, requests are flowing through Corveil. Confirm in the dashboard or logs:
corveil logs --tail 5Troubleshooting
- 401 Unauthorized (Direct mode): Verify your
ANTHROPIC_API_KEYmatches a valid Corveil virtual API key - 401 Unauthorized (Passthrough mode): Verify your
x-citadel-api-keyheader value is a valid Corveil virtual API key, and that your Anthropic credentials are valid - Connection refused: Ensure your Corveil instance is running and the
ANTHROPIC_BASE_URLis reachable - Custom headers not sent: Verify
ANTHROPIC_CUSTOM_HEADERSuses the formatheader-name: value(colon-space separated)