D1VD1V
D1V Docs / CLI / 4 sections

Use D1V PAI with Claude Code

D1V PAI natively supports Anthropic Messages. Claude Code can connect directly, with CC-Switch available as an optional provider manager.

01

Connect directly

Claude Code natively calls /v1/messages, and D1V PAI supports that protocol directly. Point Claude Code at the service root https://pai.d1v.ai; no local proxy is required.

First call GET https://pai.d1v.ai/v1/models with the project key and select an exact returned model ID. A project key is different from a d1v.ai account API key.

02

Set environment variables

bash
export ANTHROPIC_BASE_URL="https://pai.d1v.ai"
export ANTHROPIC_AUTH_TOKEN="$D1V_PAI_API_KEY"
export ANTHROPIC_MODEL="<model-id-from-v1-models>"
claude

ANTHROPIC_AUTH_TOKEN sends the project key through Authorization: Bearer. Compatible clients that use x-api-key may set ANTHROPIC_API_KEY instead. Avoid setting both authentication variables so it remains clear which key is active.

03

Optional: manage the provider with CC-Switch

Use CC-Switch when you want to store several project keys or switch model mappings. Prefer a native Anthropic or Claude provider with https://pai.d1v.ai; it does not need local routing.

Local routing is required only if you deliberately select CC-Switch's OpenAI Responses API provider. That is an alternative setup, not a D1V PAI prerequisite.

04

Verification and recovery

bash
curl -fsS https://pai.d1v.ai/v1/models \
  -H "Authorization: Bearer $D1V_PAI_API_KEY"
claude
  • If Claude still calls the public Anthropic endpoint, confirm ANTHROPIC_BASE_URL exists in the same terminal that starts Claude, then restart it completely.
  • If the request returns 404, use the service root and do not append /v1/messages manually.
  • If the request reports model not found, refresh /v1/models and update ANTHROPIC_MODEL.