D1VD1V

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

  1. Select Claude Code, click +, and choose Custom.
  2. Name the provider D1V PAI and paste D1V_PAI_API_KEY.
  3. Set the request URL to https://pai.d1v.ai, the service root without trailing /v1.
  4. Under advanced options choose OpenAI Responses API (routing required).
  5. Keep ANTHROPIC_AUTH_TOKEN (Authorization) so the upstream request uses Bearer authentication.
  6. Map Sonnet, Opus, Haiku, and the default fallback role to exact D1V PAI model IDs.
    OpenAI Responses provider fields and model mapping
    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

  1. Open Settings → Routing → Local routing.
  2. Enable the routing service and enable takeover for Claude Code.
  3. Enable the D1V PAI provider.
  4. 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.

    CC-Switch local routing settings
    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.