D1V PAI client hub
Create project-scoped credentials in Dashboard, verify the endpoint once, then follow the focused guide for your client.
From Dashboard to a working client
DASHBOARD
Create project environment
Select D1V PAI
PROJECT CREDENTIALS
BASE_URL + API_KEY
Scoped and revocable per project
CLIENT
Codex / Claude Code
Verify before connecting
Choose the correct protocol path
Focused setup guides
Recommended paths
D1V PAI accepts both OpenAI-compatible and Anthropic Messages-compatible requests. The recommended setup depends on the client protocol:
- Codex + CC-Switch: supported directly with the Responses API. This is the simplest path.
- Claude Code: can call the native
/v1/messagescompatibility endpoint directly. CC-Switch remains useful for provider switching and model-role mapping. - CC-Switch CLI/TUI: supported for terminal, SSH, and automation workflows.
- OpenAI-compatible clients: AionUI, OpenCode, Grok Build, WorkBuddy, OpenClaw, and Hermes can use the same Base URL and key when configured for an OpenAI-compatible provider.
OpenAI clients use https://pai.d1v.ai/v1. Claude Code uses the service root https://pai.d1v.ai and appends /v1/messages itself.
Create a project-scoped key in Dashboard
- 1Sign in and open Dashboard.
- 2Wait until the workspace status is ready.
- 3Click Create Project Environment in the Dashboard toolbar.
- 4Enter a name for the environment and keep D1V PAI selected. Other integrations are optional.
- 5Click Create project environment.
- 6When the environment is ready, copy these two values:
D1V_PAI_BASE_URL: the OpenAI-compatible API URL, normallyhttps://pai.d1v.ai/v1.D1V_PAI_API_KEY: a secret API key scoped to this project environment.
The values are displayed in full after creation and remain manageable in the project. Use the project key for model calls; do not use or request a platform administration key.
Verify the endpoint and discover models
Keep the values in environment variables while testing:
export D1V_PAI_BASE_URL='https://pai.d1v.ai/v1'
export D1V_PAI_API_KEY='<paste-project-key>'
curl "$D1V_PAI_BASE_URL/models" \
-H "Authorization: Bearer $D1V_PAI_API_KEY"A successful response contains model IDs under data. Choose a model from this response instead of copying a model name from an old screenshot or third-party tutorial.
Install and initialize the local tools
Install Node.js first, then install and initialize the CLIs you intend to use:
node --version
npm --version
npm install -g @openai/codex@latest
npm install -g @anthropic-ai/claude-code@latest
codex --help
claude --helpRunning the help commands once creates the local configuration directories that CC-Switch manages. If you only need Codex, Claude Code is optional.
Public API surface
Open the interactive D1V PAI API reference for schemas, authentication, request examples, and in-browser testing.
| Method | Path | Format | Purpose |
|---|---|---|---|
| GET | /v1/models | OpenAI | List model IDs enabled for the project key |
| POST | /v1/chat/completions | OpenAI | Chat completions, streaming, and tool calls |
| POST | /v1/responses | OpenAI | Responses API used by Codex and agent clients |
| POST | /v1/messages | Anthropic | Claude Code / Messages-compatible generation |
| POST | /v1/embeddings | OpenAI | Embeddings when an embedding model is enabled |
| POST | /v1/images/generations | OpenAI | Images when an image model is enabled |
| POST | /v1/audio/speech | OpenAI | Speech when a TTS model is enabled |
A gateway route existing does not guarantee that every project key has a compatible model. Treat GET /v1/models as the source of truth, and expect a model capability error when a modality is unavailable.
Install CC-Switch
Download the current desktop release from CC-Switch Releases. On macOS you can also use:
brew tap farion1231/ccswitch
brew install --cask cc-switchOpen CC-Switch after installation and choose a Custom provider. Presets for other vendors contain different endpoints and must not be reused for D1V PAI.
Configure Codex in CC-Switch
- 1Open the Codex tab and click + to add an application-specific provider.
- 2Keep the Custom preset and name it
D1V PAI. - 3Set API Key to the value of
D1V_PAI_API_KEY. - 4Set API request URL / Base URL to the exact value of
D1V_PAI_BASE_URL(https://pai.d1v.ai/v1). - 5Set Upstream/API format to native Responses.
- 6Fetch models from the endpoint or enter a model ID returned by
/modelsas the default model. - 7Save the provider, click Enable, open a new terminal, and run
codex.If you prefer to inspect the generated configuration, it is equivalent to:
model_provider = "d1v_pai"
model = "<model-id-from-v1-models>"
disable_response_storage = true
[model_providers.d1v_pai]
name = "D1V PAI"
base_url = "https://pai.d1v.ai/v1"
wire_api = "responses"
requires_openai_auth = trueAnd ~/.codex/auth.json contains:
{
"OPENAI_API_KEY": "<D1V_PAI_API_KEY>"
}Configure Claude Code directly
D1V PAI natively supports Anthropic Messages, so Claude Code does not need local protocol conversion. Use the service root without /v1; Claude Code appends /v1/messages:
export ANTHROPIC_BASE_URL="https://pai.d1v.ai"
export ANTHROPIC_AUTH_TOKEN="$D1V_PAI_API_KEY"
export ANTHROPIC_MODEL="<model-id-from-v1-models>"
claudeANTHROPIC_AUTH_TOKEN sends Authorization: Bearer. Compatible clients that use x-api-key may set ANTHROPIC_API_KEY instead; do not set both. CC-Switch remains useful for storing multiple providers, switching projects, or mapping models, but it is not required to call D1V PAI.
Use CC-Switch CLI or TUI
CC-Switch CLI is useful on servers, over SSH, and in automation:
curl -fsSL https://github.com/SaladDay/cc-switch-cli/releases/latest/download/install.sh | bash
cc-switch env tools
cc-switch env check
cc-switch --app codexIn the TUI, add a custom Codex provider using the same Base URL, API Key, Responses format, and model ID described above. Claude Code can use ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN directly; enable CC-Switch local routing only when you intentionally choose Responses protocol conversion.
Optional Responses conversion only: on macOS or Linux, enable the daemon-managed Claude route with:
cc-switch --app claude proxy enable
cc-switch proxy showFor the same optional conversion on Windows, run the route in the foreground because daemon-managed proxy sessions require Unix domain sockets:
cc-switch proxy serve --takeover claudeUseful checks:
cc-switch --app codex provider current
cc-switch --app codex provider list
cc-switch --app codex env check
cc-switch --app claude env checkOther clients worth supporting
For clients with a custom OpenAI-compatible provider, use the same four values:
- Provider/API format: OpenAI compatible
- Base URL:
D1V_PAI_BASE_URL - API Key:
D1V_PAI_API_KEY - Model: an ID returned by
GET /models
This applies directly to AionUI, OpenCode, Grok Build, and WorkBuddy. OpenClaw and Hermes are also good candidates when configured through their CC-Switch tabs with an OpenAI-compatible provider.
We do not make Claude Desktop part of the primary setup because it requires additional local routing and model-role mapping. We also keep Claude cache optimization proxy out of this guide: it is an optional performance layer, not required to obtain or validate D1V PAI access.
Troubleshooting and key safety
- 401/403: confirm you copied
D1V_PAI_API_KEY, not a D1V account API key or platform administration key. - 404 or wrong endpoint: Codex and OpenAI-compatible clients use the
/v1Base URL. Claude Code uses the service root without/v1inANTHROPIC_BASE_URL. - Model not found: refresh
GET /modelswith the same project key and use an exact returned ID. - Provider switch did not take effect: initialize the target CLI once, enable the provider again, and start a new terminal process.
- Environment overrides configuration: run
cc-switch --app codex env checkorcc-switch --app claude env checkand remove conflictingOPENAI_API_KEY,ANTHROPIC_API_KEY, or Base URL variables.
Never commit the project key to Git, paste it into screenshots, or place it in client-side browser code. Create a separate project environment when you need separate usage tracking or revocation boundaries.
References and version notes
CC-Switch changes quickly. Field names may move between releases; preserve the protocol choices and values described here even if the form layout changes.