DoGPT

Use DoGPT with Codex CLI

Codex accepts an OpenAI-compatible base URL, an API key, and a provider-qualified model id in its YAML configuration.

Create an API key

To use Codex CLI with DoGPT, set its base URL to https://api.dogpt.ir/v1 and its API key to the prepaid key from your DoGPT account, then select a routed model id such as cx/gpt-5.6-luna. Those values go in ~/.codex/config.yaml, and Codex CLI keeps working exactly as it did otherwise — the change is which endpoint it sends prompts to, not how the tool behaves. This client speaks the OpenAI-compatible format, so the endpoint keeps its /v1 suffix and the official SDKs work unchanged. Verify with codex "what is 2+2?": a reply proves the endpoint, key, request format and model all agree. Billing is prepaid, with no subscription and no seat fee, and your balance is pushed upstream as the spending ceiling on the key. Requests travel from Codex CLI straight to the API host rather than through the dashboard, and usage is reconciled into your balance on a schedule.

What does pointing Codex CLI at DoGPT change?

Codex CLI normally sends prompts to the endpoint configured for its selected provider. This recipe changes that endpoint to https://api.dogpt.ir/v1 and supplies a prepaid DoGPT key. The tool still owns its local files, prompts, project access, and user interface.

Requests go from the tool directly to the branded API host. They do not pass through the dashboard Worker. Your wallet balance becomes upstream spending headroom, and the dashboard reconciles reported usage into the balance on regular ticks.

How do I configure Codex CLI?

  1. Sign in, add credit, and create an API key. Copy the full secret when it is revealed because the dashboard stores only its prefix.
  2. Install the tool with npm install -g @openai/codex.
  3. Put the configuration below in ~/.codex/config.yaml, replacing the sample key with the secret you copied.
model: cx/gpt-5.6-luna
apiKey: sk-your-dogpt-key
apiBaseUrl: https://api.dogpt.ir/v1

Keep the route prefix in the model id. A bare vendor model copied from another provider will not resolve through this catalog.

How do I test that it works?

Run codex "what is 2+2?". Start with a short prompt so a configuration mistake is easy to separate from a long-running model task. A successful response proves the endpoint, key, request format, and chosen model can work together.

If the request returns 401, copy the entire reveal-once key again, including its sk- prefix. A 404 that says the endpoint is not enabled means the tool called a path outside the public allowlist. A model-not-found response means the configured id is absent from the current model directory or lost its provider prefix.

What does it cost, and what happens when credit runs out?

The API key is prepaid. There is no subscription or seat charge from DoGPT, and the public directory shows input and output prices per million tokens. Your balance can pay for a mixture of models, so changing the configured id does not require another key.

Usage appears in the dashboard after reconciliation. The balance refresh control can settle the latest reported spend immediately. When the upstream ceiling stops new work, add credit or wait for a daily cap to reset. A request already running may finish slightly past the ceiling, but the customer balance never becomes a debt.

Model availability and rates come from the upstream catalog refreshed twice an hour. Treat a copied model id as configuration, not as a permanent product promise. Check the live model directory before automating a long unattended run.

Where should the API key be stored?

Store the secret in the tool's private settings or an environment file that is excluded from version control. Do not paste it into source code, a shared issue, a screenshot, or a URL. Rotate the key from the dashboard if it is exposed; rotation invalidates the old secret while preserving the same wallet and usage history.

The public endpoint uses a Bearer header. Avoid OmniRoute examples that place a token inside an /api/v1/ path: the branded host serves only its documented /v1 surface, and a URL token is easier to leak through logs.

This configuration was probed against the live DoGPT endpoint on 2026-08-13. Tools change their own config formats, so check the tool's documentation if a setting is rejected.