Use D1V PAI with Claude Code
Claude Code sends Anthropic Messages requests, so CC-Switch must convert them to OpenAI Responses requests before they reach D1V PAI.
Why local routing is required
Do not point Claude Code directly at D1V_PAI_BASE_URL. A direct Claude client calls /v1/messages; D1V PAI is provisioned as an OpenAI-compatible gateway.
The correct path is: Claude Code → CC-Switch local route → OpenAI Responses → D1V PAI. Keep CC-Switch running while Claude Code uses this provider.
Create the routed provider
- Select Claude Code, click +, and choose Custom.
- Name the provider
D1V PAIand pasteD1V_PAI_API_KEY. - Set the request URL to
https://pai.d1v.ai, the service root without trailing/v1. - Under advanced options choose OpenAI Responses API (routing required).
- Keep
ANTHROPIC_AUTH_TOKEN (Authorization)so the upstream request uses Bearer authentication. - Map Sonnet, Opus, Haiku, and the default fallback role to exact D1V PAI model IDs.

Current CC-Switch Responses-provider fields. Model names in the screenshot are examples; use IDs returned by your project /models endpoint. Source: official CC-Switch routing guide.
Enable and test the route
- Open Settings → Routing → Local routing.
- Enable the routing service and enable takeover for Claude Code.
- Enable the D1V PAI provider.
- Close all Claude Code processes, open a new terminal, and run
claude.The local listener normally uses
127.0.0.1:15721. Claude Code live configuration points to this local address; the real project key remains in the CC-Switch provider store.
Enable the route service before enabling application takeover. Source: official CC-Switch user manual.
Verification and recovery
cc-switch --app claude env check
cc-switch proxy show
claude- If Claude still calls the public Anthropic endpoint, restart Claude after enabling takeover.
- If the route returns 404, recheck the Responses format and service-root URL.
- If only one role fails, correct that model-role mapping instead of replacing the API key.