Yomi APIYomi APIDocs Open console

中文

Yomi API / Documentation / Codex CLI

Connect an agent

Codex CLI

Codex is an AI coding agent that runs in your terminal. Point its provider to Yomi API in config.toml to use models such as gpt-5.6-sol and gpt-5.6-terra for coding tasks.

Prerequisites

  • Node.js: 18 or later.
  • API key: Create a key in the console's API Keys page, copy it and store it safely. It is visible only at creation.
  • Key group (important): The gpt-5.6 series is available in groups including GPT Discount Route Optimized, GPT Discount Route 2, GPT Plus Route, GPT Pro High Performance Route and GPT Discount Test. Choose a group that includes your model when creating the key. An unsupported group returns "No available channel".

Installation

Install globally with npm. The command is the same on all platforms:

npm install -g @openai/codex

Run the following command. A version number confirms successful installation:

codex --version

Configure Yomi API

The Codex configuration file is in your user directory. Create it manually if it does not exist:

  • macOS / Linux: ~/.codex/config.toml
  • Windows: %USERPROFILE%\.codex\config.toml

Add the following configuration:

model = "gpt-5.6-sol"
model_provider = "yomi"

[model_providers.yomi]
name = "Yomi API"
base_url = "https://api.yomiapi.com/v1"
env_key = "YOMI_API_KEY"
wire_api = "responses"

Field meanings: model is the default model. Use a platform catalog ID (such as gpt-5.6-sol, or claude-sonnet-5, gpt-5.6-terra); base_url points to the platform's OpenAI-compatible prefix; env_key reads the key from the environment variable YOMI_API_KEY; wire_api = "responses" selects the /v1/responses endpoint.

Supply the key through an environment variable. Do not put a plaintext key in config.toml, so sharing or committing the configuration does not expose it.

Set the key on macOS / Linux

Append the following to ~/.zshrc (for bash, use ~/.bashrc), then save and run source ~/.zshrc:

export YOMI_API_KEY=YOUR_API_KEY

Set the key on Windows

Run the following command, then close and reopen the terminal to apply it:

setx YOMI_API_KEY "YOUR_API_KEY"

Start and verify

Open your project directory and start Codex:

codex
  1. Enter a simple task, such as "Write a .gitignore for the current directory." A normal response confirms that the connection works.
  2. Sign in to the console and check "Usage" in the User Center. The corresponding record confirms that the request went through Yomi API.

Common questions

Should wire_api be responses or chat?

The platform supports the OpenAI Responses API (/v1/responses), so we recommend wire_api = "responses". If a particular version has compatibility issues, change it to "chat" to use /v1/chat/completions.

What if the key is invalid?

In the configuration, env_key specifies that the key is read from YOMI_API_KEY. Ensure the variable is set, the terminal has been reopened and the key is valid in API Keys.

What if the model is unavailable?

model must be a platform catalog ID (such as gpt-5.6-sol), not a display name. Also check that your key's group includes the model; see Models in the console for availability.