D1VD1V
D1V Docs / CLI / 15 sections

D1V PAI client hub

Create project-scoped credentials in Dashboard, verify the endpoint once, then follow the focused guide for your client.

Open D1V PAI API reference
01

From Dashboard to a working client

01

DASHBOARD

Create project environment

Select D1V PAI

02

PROJECT CREDENTIALS

BASE_URL + API_KEY

Scoped and revocable per project

03

CLIENT

Codex / Claude Code

Verify before connecting

02

Choose the correct protocol path

Target clientRecommended path
CodexNative Responses
Claude Code / Claude DesktopThrough CC-Switch local routing
OpenCode / AionUI / HermesCustom OpenAI-compatible provider
03

Focused setup guides

04

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/messages compatibility 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.

05

Create a project-scoped key in Dashboard

  1. 1
    Sign in and open Dashboard.
  2. 2
    Wait until the workspace status is ready.
  3. 3
    Click Create Project Environment in the Dashboard toolbar.
  4. 4
    Enter a name for the environment and keep D1V PAI selected. Other integrations are optional.
  5. 5
    Click Create project environment.
  6. 6
    When the environment is ready, copy these two values:
    • D1V_PAI_BASE_URL: the OpenAI-compatible API URL, normally https://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.

06

Verify the endpoint and discover models

Keep the values in environment variables while testing:

bash
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.

07

Install and initialize the local tools

Install Node.js first, then install and initialize the CLIs you intend to use:

bash
node --version
npm --version
npm install -g @openai/codex@latest
npm install -g @anthropic-ai/claude-code@latest
codex --help
claude --help

Running the help commands once creates the local configuration directories that CC-Switch manages. If you only need Codex, Claude Code is optional.

08

Public API surface

Open the interactive D1V PAI API reference for schemas, authentication, request examples, and in-browser testing.

MethodPathFormatPurpose
GET/v1/modelsOpenAIList model IDs enabled for the project key
POST/v1/chat/completionsOpenAIChat completions, streaming, and tool calls
POST/v1/responsesOpenAIResponses API used by Codex and agent clients
POST/v1/messagesAnthropicClaude Code / Messages-compatible generation
POST/v1/embeddingsOpenAIEmbeddings when an embedding model is enabled
POST/v1/images/generationsOpenAIImages when an image model is enabled
POST/v1/audio/speechOpenAISpeech 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.

09

Install CC-Switch

Download the current desktop release from CC-Switch Releases. On macOS you can also use:

bash
brew tap farion1231/ccswitch
brew install --cask cc-switch

Open CC-Switch after installation and choose a Custom provider. Presets for other vendors contain different endpoints and must not be reused for D1V PAI.

10

Configure Codex in CC-Switch

  1. 1
    Open the Codex tab and click + to add an application-specific provider.
  2. 2
    Keep the Custom preset and name it D1V PAI.
  3. 3
    Set API Key to the value of D1V_PAI_API_KEY.
  4. 4
    Set API request URL / Base URL to the exact value of D1V_PAI_BASE_URL (https://pai.d1v.ai/v1).
  5. 5
    Set Upstream/API format to native Responses.
  6. 6
    Fetch models from the endpoint or enter a model ID returned by /models as the default model.
  7. 7
    Save the provider, click Enable, open a new terminal, and run codex.

    If you prefer to inspect the generated configuration, it is equivalent to:

toml
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 = true

And ~/.codex/auth.json contains:

json
{
  "OPENAI_API_KEY": "<D1V_PAI_API_KEY>"
}
11

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:

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 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.

12

Use CC-Switch CLI or TUI

CC-Switch CLI is useful on servers, over SSH, and in automation:

bash
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 codex

In 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:

bash
cc-switch --app claude proxy enable
cc-switch proxy show

For the same optional conversion on Windows, run the route in the foreground because daemon-managed proxy sessions require Unix domain sockets:

powershell
cc-switch proxy serve --takeover claude

Useful checks:

bash
cc-switch --app codex provider current
cc-switch --app codex provider list
cc-switch --app codex env check
cc-switch --app claude env check
13

Other 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.

14

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 /v1 Base URL. Claude Code uses the service root without /v1 in ANTHROPIC_BASE_URL.
  • Model not found: refresh GET /models with 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 check or cc-switch --app claude env check and remove conflicting OPENAI_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.

15

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.