One-Click Setup
Use npx to connect your installed Codex or Claude Code to DINGJIAI in one command.
Install the client first, then run the setup command
dingjiai is a gateway configurator, not a client installer. It only configures a Codex or Claude Code that is already installed on this machine. It does not install Node.js, Codex, or Claude Code, and it never asks for administrator privileges.
Recommended command
With Node.js 18 or later installed, open a terminal and run:
npx -y dingjiaiEnter your DINGJIAI user API Key when prompted. You can also pass the key directly:
npx -y dingjiai -k sk-your-user-api-keyOn shared machines prefer the interactive prompt; -k may end up in shell history and is briefly visible as a local subprocess argument.
Configure only one tool:
npx -y dingjiai -k sk-your-user-api-key --only codex
npx -y dingjiai -k sk-your-user-api-key --only claudePreview first, without writing any configuration:
npx -y dingjiai -k sk-your-user-api-key --only claude,codex --dry-runWhat it solves
Codex and Claude Code differ in local configuration locations, protocol entries, and model fields. When wiring them up by hand, it is easy to get the Base URL, API Key, model name, or protocol path wrong.
dingjiai does something deliberately narrow:
detect the Codex / Claude Code installed on this machine
-> read your DINGJIAI user API Key once
-> request the DINGJIAI model list to verify the key and available models
-> pick a default model by built-in priority
-> call zcf to write the matching client configurationWithout --only, it only configures the clients it detects as installed. With --only claude,codex, it processes exactly the clients you named; if one of them turns out not to be installed at write time, that client fails with a message.
What it writes
dingjiai currently writes configuration through a pinned zcf@3.6.8. The targets it hands to zcf are:
| Client | Base URL | Local config it may modify |
|---|---|---|
| Claude Code | https://dingjiai.com/anthropic | ~/.claude/settings.json |
| Codex | https://dingjiai.com/v1 | ~/.codex/config.toml, ~/.codex/auth.json |
What gets written mainly includes:
- Your DINGJIAI user API Key.
- The DINGJIAI Base URL.
- The default model.
- Claude Code's
primary,haiku,sonnet, andopusmodel slots.
dingjiai asks zcf to skip MCP, workflows, output styles, and status-line tooling. zcf is still an external tool, so the actual write behavior follows the current zcf version; if you care deeply about your existing local configuration, run --dry-run first, inspect the plan, and then decide.
What it will not do
- It does not install Codex or Claude Code.
- It does not install system dependencies such as Node.js, Git, or Python.
- It does not modify system-level environment variables.
- It does not ask for administrator privileges.
- It does not delete your client configuration.
- It does not print your full API Key in the summary.
Note: the API Key is passed as an argument to the local zcf subprocess and written into the matching client configuration files; the client needs it for subsequent DINGJIAI calls.
How the model is chosen
On a real write without --skip-verify, the command first requests the model lists:
GET https://dingjiai.com/v1/models
Authorization: Bearer sk-your-user-api-key
GET https://dingjiai.com/anthropic/v1/models
x-api-key: sk-your-user-api-key
anthropic-version: 2023-06-01It then picks the default model only from the models those endpoints return. The built-in priority comes from model-priority.json inside the npm package; if none of the prioritized models are available, it uses the first available model from the API response.
You can also pick models manually:
npx -y dingjiai -k sk-your-user-api-key --codex-model gpt-5.5
npx -y dingjiai -k sk-your-user-api-key --claude-model claude-sonnet-4-6The model names above are examples; the console and the model list responses are authoritative. A manually specified model must be available in the matching model list, otherwise the command refuses to write.
Confirmation before writing
In a normal interactive terminal, the command shows a configuration preview and asks before writing:
Write the configuration above? (y/N)Only y makes it call zcf to write the configuration. --dry-run only prints the planned command; it neither requests the model list nor writes any file.
Common troubleshooting
- No client detected: install Codex or Claude Code first, then rerun.
- API Key verification failed: make sure you copied a DINGJIAI user API Key, not an upstream provider key.
- No available models: sign in to the console and check your account's available models, balance, and permissions.
- The tool still uses the old address after configuration: restart Codex or Claude Code so it reloads its configuration.
- Want to see the underlying zcf output: add
--verbose.
npx -y dingjiai -k sk-your-user-api-key --verboseThis page describes the behavior of the currently published dingjiai npm package. For the actually supported flags, run:
npx -y dingjiai --helpLast updated on