Skip to content

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

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.

bash
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):

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.

bash
export ANTHROPIC_BASE_URL="https://your-corveil-host"
export ANTHROPIC_CUSTOM_HEADERS="x-citadel-api-key: sk-citadel-your-key-here"

Launch and Verify

bash
claude

Ask a simple question. If it responds, requests are flowing through Corveil. Confirm in the dashboard or logs:

bash
corveil logs --tail 5

Troubleshooting

  • 401 Unauthorized (Direct mode): Verify your ANTHROPIC_API_KEY matches a valid Corveil virtual API key
  • 401 Unauthorized (Passthrough mode): Verify your x-citadel-api-key header 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_URL is reachable
  • Custom headers not sent: Verify ANTHROPIC_CUSTOM_HEADERS uses the format header-name: value (colon-space separated)