Документация

Codex

Configure the OpenAI Codex CLI with a custom EasyAPI provider to access every supported model through the relay.

Prerequisites

  • Codex CLI installed (https://developers.openai.com/codex)
  • An EasyAPI API token created in the console

Step 1: Get Your EasyAPI Token

Sign in to the EasyAPI console → Token Management and copy the API Key starting with sk-.

The token must have permission to call the target model.

Step 2: Edit the Codex Config

Edit the user-level config file ~/.codex/config.toml and add an easyapi provider: set base_url to the EasyAPI API address (including /v1), env_key to OPENAI_API_KEY, and point model_provider to easyapi.

Alternatively, set openai_base_url to EasyAPI (including /v1) and keep using the built-in openai provider.

API Base URLhttps://token.easyapi.com/v1

Create your token in Console → Token Management; see Standard Integration for the standard integration guide.

~/.codex/config.toml

model = "gpt-4o"
model_provider = "easyapi"

[model_providers.easyapi]
name = "EasyAPI"
base_url = "https://token.easyapi.com/v1"
env_key = "OPENAI_API_KEY"

Step 3: Configure Environment Variables

In your terminal, set OPENAI_API_KEY to your EasyAPI token so the env_key in config.toml can read it.

$ export OPENAI_API_KEY="sk-your-easyapi-token"

$ codex

Codex ready — connected via EasyAPI

Step 4: Launch Codex

Run the codex command in your terminal, start an interactive session, and confirm requests are routed through EasyAPI.

Use EasyAPI-supported model IDs, for example gpt-4o.

Verification

  • Running codex enters the interactive interface
  • A matching model call appears in EasyAPI console usage records