Skip to content

Codex Integration

Codex is an agentic coding assistant from OpenAI that communicates via the Responses API and supports custom providers configured in ~/.codex/config.toml.

  1. Install Environment: Install Codex CLI (npm install -g @openai/codex) and run it at least once to initialize the ~/.codex directory.
  2. Obtain API Key: Go to AlphaTech Sign Up & API Keys to generate your API Key (sk-xxxx).
  3. Verify Models: Review Models and pricing to choose an active model compatible with Responses API (e.g. gpt-6-luna, gpt-5.6-luna, or deepseek-v4.1-flash).

Open the configuration file at ~/.codex/config.toml (located at %USERPROFILE%\.codex\config.toml on Windows):

model = "gpt-6-luna"
model_provider = "alphatech"
model_reasoning_effort = "high"
[model_providers.alphatech]
name = "AlphaTech"
base_url = "https://alphatech.net.cn/v1"
wire_api = "responses"
experimental_bearer_token = "sk-xxxx"

Menu / Path Reference: Navigate to your home directory, reveal the hidden .codex/ folder, and edit config.toml with any text editor.

2. Environment Variable Authentication (Optional)

Section titled “2. Environment Variable Authentication (Optional)”

If you prefer not storing your key in plaintext within config.toml, replace experimental_bearer_token with env_key:

[model_providers.alphatech]
name = "AlphaTech"
base_url = "https://alphatech.net.cn/v1"
wire_api = "responses"
env_key = "ALPHATECH_API_KEY"

Then export the key in your terminal:

终端窗口
export ALPHATECH_API_KEY="sk-xxxx"

Navigate to your workspace directory and run:

终端窗口
cd /path/to/your-project
codex
  1. Check the startup status in Codex. It should display model gpt-6-luna under provider alphatech.
  2. Issue a sample instruction:
Write a Bash script to inspect local port usage and print corresponding process names.
  1. If Codex generates the plan and streams the implementation, and AlphaTech console logs show requests to /v1/responses, configuration is successful.

1. wire_api = "chat" is no longer supported error

Section titled “1. wire_api = "chat" is no longer supported error”

Codex no longer supports legacy Chat Completions format. Ensure your provider section explicitly states wire_api = "responses".

This happens if the Base URL lacks /v1. Setting https://alphatech.net.cn causes Codex to request https://alphatech.net.cn/responses, which falls back to the frontend SPA instead of the API gateway. Always use https://alphatech.net.cn/v1.

Check that experimental_bearer_token has no typos or missing characters. If using env_key, confirm echo $ALPHATECH_API_KEY prints your key in the active shell.


Reference: OpenAI Codex Documentation
Last verified on 2026-11-04

需要进一步了解企业方案,或确认服务状态?