Codex CLI custom API setup guide

Use Codex’s official custom model provider configuration to connect to 穷哥么. The provider uses the Responses API, while the secret remains in an environment variable.

Quick configuration

Install command
npm install -g @openai/codex
Configuration file
~/.codex/config.toml
model_provider
qionggeme
base_url
https://qionggeme.com/v1
env_key
QIONGGEME_API_KEY
This is the environment-variable name, not the plaintext API key.
wire_api
responses
The current official custom-provider configuration uses Responses.

This guide uses Codex’s officially supported model_providers configuration. The API key is not written into TOML. Store it in the QIONGGEME_API_KEY environment variable and let env_key reference the variable name.

First create a key in the qionggeme token console. The example model is gpt-5.3-codex-spark. The console’s model list is authoritative for current availability; the model pricing page shows the models currently highlighted by this site.

Setup steps

  1. Install Codex CLI

    Install the official npm package globally:

    npm install -g @openai/codex

    After installation, run codex to start the CLI.

  2. Add the provider to ~/.codex/config.toml

    Create or edit ~/.codex/config.toml and add:

    model_provider = "qionggeme"
    model = "gpt-5.3-codex-spark"
    
    [model_providers.qionggeme]
    name = "qionggeme"
    base_url = "https://qionggeme.com/v1"
    env_key = "QIONGGEME_API_KEY"
    wire_api = "responses"

    The value of env_key is the name of the environment variable Codex should read, not the API key itself. Do not add an api_key field.

  3. Set the API key on macOS or Linux

    Set the environment variable in the terminal that will launch Codex:

    export QIONGGEME_API_KEY="your qionggeme API key"

    If you add it to a shell startup file, reload that file or open a new terminal before starting a new Codex session.

  4. Set the API key in Windows PowerShell

    Run the following in PowerShell:

    $env:QIONGGEME_API_KEY="your qionggeme API key"

    This applies to the current PowerShell session. Start codex in the same window. If you change the variable or TOML configuration, close the old Codex session and start a new one.

  5. Restart Codex and verify the provider

    After changing the configuration file or environment variable, exit any running Codex process and run codex again. If the example model is not available to the current token, replace the top-level model value with a Codex-compatible ID returned by the console. The model pricing page is only a reference for highlighted models.

Configuration example

model_provider = "qionggeme"
model = "gpt-5.3-codex-spark"

[model_providers.qionggeme]
name = "qionggeme"
base_url = "https://qionggeme.com/v1"
env_key = "QIONGGEME_API_KEY"
wire_api = "responses"

# macOS / Linux
export QIONGGEME_API_KEY="your qionggeme API key"

# Windows PowerShell
$env:QIONGGEME_API_KEY="your qionggeme API key"

Troubleshooting

Codex reports that QIONGGEME_API_KEY is missing

Confirm that QIONGGEME_API_KEY is set in the terminal running Codex. env_key contains only the variable name; Codex reads the actual secret from the process environment. Restart Codex after setting it.

The API returns 401 Unauthorized

Copy the key again from the token console, make sure the environment variable has no unintended spaces or quoting, and verify the token status, account balance, and model permissions.

The API returns 404 or the request URL is wrong

Set base_url exactly to https://qionggeme.com/v1. Codex’s Responses provider needs the OpenAI Base URL. Do not replace it with the root URL or add /docs.

The custom provider reports an unsupported protocol or endpoint

Confirm wire_api = "responses". The current official custom-provider setup uses Responses; do not change it to Chat Completions or another value.

gpt-5.3-codex-spark does not exist or is unavailable

Check the model list visible to the current token in the console. If that ID is absent, replace model with a listed Codex-compatible ID. The pricing page shows only the models highlighted by this site.

Codex still uses the old config.toml values

Confirm the file is located at ~/.codex/config.toml, save it, stop the old Codex process, and start a new session. A running session is not guaranteed to reload file changes immediately.

Ready to get started?

Create a qionggeme account, generate an API key, and access every currently available model.

Create an account

Frequently asked questions

Should env_key contain my API key?

No. env_key must contain the environment-variable name QIONGGEME_API_KEY. Set the real API key with export on macOS/Linux or $env in PowerShell.

Can I add an api_key field to config.toml?

Do not do that. This guide follows the official custom-provider approach using env_key so the plaintext secret is not stored in the configuration file.

Can wire_api be changed to chat?

No. The current official custom-provider setup uses wire_api = "responses".

Why must Codex base_url include /v1?

This provider targets the OpenAI Responses API, so its Base URL is https://qionggeme.com/v1. Do not use the root URL or the content-site address containing /docs.

Do I need to restart after changing the environment variable or TOML file?

Yes. Exit the old Codex session and start it again so the new process reads the latest configuration and environment.

Where can I confirm the currently available Codex models?

Use the model list visible to your token in the console. The pricing page is a reference for highlighted models only. If the example ID is unavailable, replace it with a listed Codex-compatible model.