Codex Setup
Connect Codex CLI, the Codex app, or OpenAI SDK-style tools to DINGJIAI.
Configure as OpenAI-compatible
Codex CLI, the Codex app, and OpenAI SDK-style tools can usually be configured the OpenAI-compatible way: fill in the Base URL, API Key, and model name. Whichever OpenAI protocol entry the tool actually calls, use a public model id available on that entry.
Recommended settings
Base URL:https://dingjiai.com/v1API Key: your DINGJIAI user API KeyModel: Chat Completions clients use a model name returned byGET /v1/models; Responses clients use a public model id available on the Responses protocol.
OpenAI SDK example
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 name copied from GET /v1/models",
messages: [{ role: "user", content: "Write a short TODO example" }],
});
console.log(response.choices[0]?.message?.content);Troubleshooting order
- First make sure the tool has actually loaded the latest configuration; restart it if necessary.
- Then confirm the model name belongs to the protocol entry you are calling: Chat Completions uses
GET /v1/models; Responses uses the public model ids the platform or an administrator has explicitly opened up to the Responses protocol — there is currently no public Responses-only model list. - Finally, read the returned error code. If it is an insufficient-balance error, changing the configuration will not help; top up your balance first.
Last updated on