DINGJIAI
DINGJIAI
Quick start in 5 minutesWhat is DINGJIAI?

Popular Agents

Codex SetupClaude Code SetupOne-Click Setup

API Reference

Billing

Model pricing

Codex Setup

Connect Codex CLI, the Codex app, or the OpenAI SDK to DINGJIAI.

Codex uses the OpenAI Responses API entry

Codex model calls use the OpenAI Responses wire. Choose a public model id explicitly enabled for the Responses API entry; GET /v1/models lists Chat Completions models and does not prove Responses availability.

Codex CLI / app

Codex user configuration lives at ~/.codex/config.toml. On Windows this is %USERPROFILE%\.codex\config.toml.

~/.codex/config.toml
model = "a Responses public model id copied from the platform"
openai_base_url = "https://dingjiai.com/v1"

openai_base_url changes the built-in OpenAI provider endpoint, so no same-named custom provider is needed. Model IDs change over time; do not copy a fixed value from another person's configuration.

Log in with your DINGJIAI user API Key:

$secureKey = Read-Host "Enter your DINGJIAI user API Key" -AsSecureString
try {
  [System.Net.NetworkCredential]::new("", $secureKey).Password | codex login --with-api-key
} finally {
  $secureKey.Dispose()
}
printf 'Enter your DINGJIAI user API Key: ' >&2
IFS= read -r -s DINGJIAI_USER_API_KEY
printf '\n' >&2
printf '%s' "$DINGJIAI_USER_API_KEY" | codex login --with-api-key
unset DINGJIAI_USER_API_KEY

codex login --with-api-key reads the key from stdin. The interactive reads above keep the plaintext key out of top-level PowerShell or Bash shell history; do not substitute a real key into a command-line assignment or paste it into a script. This option was checked against the local codex login --help output and the Codex Authentication documentation.

Codex caches credentials in the user profile or the operating-system credential store, depending on cli_auth_credentials_store. Never commit ~/.codex/auth.json or place a user key in a project repository.

Use a user API Key

Use the per-user API key for user → DINGJIAI requests; never use an upstream provider key used by the gateway for DINGJIAI → upstream requests. Each user should have a separate key.

Search is automatic when needed

While using the Responses entry, Codex may trigger Search when needed. 8788 transparently forwards that capability through the same user key, Responses model, and existing upstream selection chain; you do not need to configure another protocol, model, or Search key. The Search transport request does not create a separate product, usage record, or ledger entry; the subsequent Responses request is settled by the normal Responses usage rules.

OpenAI SDK

Node.js
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.DINGJIAI_API_KEY,
  baseURL: "https://dingjiai.com/v1",
});

const response = await client.chat.completions.create({
  model: "a Chat Completions model-product public model id copied from GET /v1/models",
  messages: [{ role: "user", content: "Write a short TODO example" }],
});

console.log(response.choices[0]?.message?.content);

This SDK example uses Chat Completions, so its model source differs from Codex's Responses model.

Troubleshooting

  • Fully quit and reopen Codex after changing configuration.
  • Confirm the Base URL is https://dingjiai.com/v1 and is not overridden elsewhere.
  • Confirm the model is enabled for the Responses API entry.
  • If Codex uses Search, confirm that an eligible Responses upstream can process the request. 8788 reuses Responses upstream candidates by default; the client normally starts it automatically, so do not hand-build a Search response or function_call_output.
  • Keep the X-Request-Id from failures. If the account balance is insufficient, top up instead of changing configuration.

Last updated on

IntegrationClaude Code Setup

On this page

Codex CLI / appOpenAI SDKTroubleshooting