Skip to content

Claude Code

Claude Code is Anthropic’s agentic coding tool that runs in your terminal. It uses the Anthropic Messages API and can be pointed at Candela via the ANTHROPIC_BASE_URL environment variable.

Claude Code supports three routing modes through Candela, depending on your authentication setup:

Section titled “Option A: Via Vertex AI (Recommended for GCP users)”

Route through Candela using your existing Google ADC credentials — no Anthropic API key needed:

Terminal window
export ANTHROPIC_BASE_URL="http://localhost:8181/proxy/anthropic-vertex"

Route through Candela using your own Anthropic API key:

Terminal window
export ANTHROPIC_BASE_URL="http://localhost:8181/proxy/anthropic-direct"
export ANTHROPIC_API_KEY="sk-ant-..."

This mode passes your API key through to api.anthropic.com — Candela captures the trace but doesn’t handle authentication.

Route through Candela using your AWS credentials with SigV4 authentication:

Terminal window
export ANTHROPIC_BASE_URL="http://localhost:8181/proxy/anthropic-bedrock"
  1. Authenticate:

    Terminal window
    # GCP (for Vertex AI routes)
    candela auth login
    # AWS (for Bedrock route)
    candela auth login --provider aws
  2. Start candela:

    Terminal window
    candela start
  3. Set the environment variable (add to your shell profile for persistence):

    Terminal window
    # In ~/.zshrc or ~/.bashrc — pick ONE based on your provider:
    export ANTHROPIC_BASE_URL="http://localhost:8181/proxy/anthropic-vertex" # GCP
    export ANTHROPIC_BASE_URL="http://localhost:8181/proxy/anthropic-bedrock" # AWS
    export ANTHROPIC_BASE_URL="http://localhost:8181/proxy/anthropic-direct" # Direct API key
  4. Run Claude Code as usual:

    Terminal window
    claude

    Every LLM request from Claude Code now flows through Candela with full observability.

  5. View traces at http://localhost:8181/_local/ — see token counts, cost, latency, and full request/response content for every Claude Code interaction.

MetricSource
Token usage (input/output/cache)Parsed from Anthropic response
Cost (USD)Calculated by Candela’s cost engine
Latency & TTFBMeasured at the proxy
Request/response contentCaptured for debugging
Model nameExtracted from the request
RouteAuthUse Case
/proxy/anthropic-vertexGoogle ADCGCP users with Vertex AI access — no API key needed
/proxy/anthropic-bedrockAWS SigV4AWS users with Bedrock model access
/proxy/anthropic-directAnthropic API keyDirect Anthropic account holders
/proxy/anthropicGoogle ADCLegacy route — translates to OpenAI format internally

In Kubernetes environments with eBPF enforcement enabled, Claude Code traffic is automatically intercepted and routed through the Candela sidecar — no ANTHROPIC_BASE_URL configuration needed.

The sidecar uses SNI-based routing to identify connections to api.anthropic.com or *.aiplatform.googleapis.com and transparently proxies them through Candela’s observability and policy pipeline.

This ensures every Claude Code request is traced and budget-enforced, even if a developer forgets to set the environment variable.

In production container environments, point Claude Code at the sidecar instead:

Terminal window
export ANTHROPIC_BASE_URL="http://localhost:8080/proxy/anthropic-vertex"

The sidecar provides the same proxy routes with async span export via Pub/Sub or OTLP.

SymptomCauseFix
401 UnauthorizedMissing or expired credentialsRun candela auth login (GCP) or candela auth login --provider aws (AWS)
403 ForbiddenClaude models not enabledEnable Claude in Vertex AI Model Garden (GCP) or Bedrock Model Access (AWS)
Claude Code ignores ANTHROPIC_BASE_URLEnv var not exported to shell sessionAdd export to your shell profile and restart terminal
Cost shows $0.00Model not in pricing tableCheck server logs; add model to pricing.models in config
Traces not appearingcandela not runningRun candela status to verify, then candela start
InvalidSignatureException (Bedrock)Clock skew or wrong regionVerify aws.region in config matches Bedrock availability