Codex

Codex is OpenAI's Agentic Coding Environment. It is a development workbench that lets models enter your project, read code, edit files, run commands, and verify results. In Codex, you can hand off tasks such as fixing bugs, implementing features, adding tests, and updating docs to an agent. Codex uses project context to run multi-step operations and returns change notes with verification results when done. By configuring it, you can connect to AI models on the Unisound MaaS Platform through two access methods: pay-as-you-go and U Plan.

1. Install Codex

  1. Install or update Node.js (v18.0 or later).
  2. Run the following command in a terminal to install Codex.
npm install -g @openai/codex

Run the following command to verify the installation.

codex --version

2. Configure access credentials

Access requires editing the config file ~/.codex/config.toml and setting the environment variable OPENAI_API_KEY. Choose the configuration that matches your access method.

API Key type
Description
How to get it (API Key examples below)
Pay-as-you-go
Billed by actual usage; suitable for light use
  • API Key format: sk-xxxxx

Go to API Key Management to create an API Key

U Plan
Fixed subscription fee with plan-based call limits
  • API Key format: tp-xxxxx

After successfully subscribing to U Plan, go to Subscription Management to get the dedicated API Key

1. Set environment variables

Set the OPENAI_API_KEY environment variable to the API Key you use.

  1. In a terminal, run the following command to check the default shell.
echo $SHELL
  1. Set the environment variable based on your shell type:
Bash

# 将 YOUR_API_KEY 替换为实际使用的 API Key

echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.bash_profile
  1. Run the following command to apply the environment variable.
Bash
source ~/.bash_profile

2. Model configuration

Choose one of the following configurations based on the access method the model supports:

Find the Codex config file

On Windows it is usually:

C:\Users\<your-username>\.codex\config.toml

If the file does not exist, create one.

Double-click config.toml to open it.

If prompted to choose an app, Notepad or VS Code both work. Edit this file next.

Choose an access method

Connect via Responses API

Connect via the Responses API for models that support OpenAI Responses API. Works with the latest Codex.

  1. Add the following configuration to config.toml:
model_provider = "unisound"
model = "u2-flash"
approval_policy = "never"
service_tier = "default"
wire_api = "responses"
[model_providers.unisound]
name = "unisound"
base_url = "https://maas-api.unisound.com/v1"
wire_api = "responses"
env_key = "OPENAI_API_KEY"
  1. Restart Codex to apply

After saving config.toml, fully quit Codex, then reopen it. (You must restart before it can be used.) Environment variables set with setx only apply to newly started processes, so you must reopen Codex to read the API Key.

Connect via Chat/Completions API

For models that only support Chat/Completions API, install Codex 0.80.0 (newer Codex no longer supports wire_api = "chat"):

  1. Add the following configuration to config.toml:
model = "u2-flash"
model_provider = "unisound"
[model_providers.unisound]
name = "unisound"
base_url = "https://maas-api.unisound.com/v1"
env_key = "OPENAI_API_KEY"
wire_api = "chat"
  1. Restart Codex to apply

After saving config.toml, fully quit Codex, then reopen it. (You must restart before it can be used.) Environment variables set with setx only apply to newly started processes, so you must reopen Codex to read the API Key.

Verify configuration

After configuration, open a new terminal window and run the following command to start Codex:

codex

If you enter the chat UI normally, the configuration succeeded.

3. Connect with CC Switch

CC Switch is a community open-source desktop GUI for switching API Keys or billing plans in one click, without manually editing ~/.codex/config.toml.

Install

  • macOS: run brew tap farion1231/ccswitch && brew install --cask cc-switch, or download the .dmg from Releases.
  • Windows: download the .msi installer or portable .zip from Releases.
  • Linux: on Arch run paru -S cc-switch-bin; other distros download .deb / .rpm / .AppImage from Releases.

Requires CC Switch v3.17 or later (first Codex support).

Add a provider

  1. In CC Switch, select the Codex icon in the top icon bar, click + in the upper right to add a provider, fill in the table below, then click Add.
Billing planConfiguration
U PlanProvider name: Unisound API Key: Get from console Request URL: https://maas-api.unisound.com/v1
Pay-as-you-goProvider name: Unisound API Key: Get from console Request URL: https://maas-api.unisound.com/v1

Also expand Advanced options and fill in the model name.

Unisound is compatible with multiple protocols. In CC Switch Advanced options, set Upstream format to the protocol you use:

Unisound protocolUpstream formatRequest URLEnable routing
Responses APIResponseshttps://maas-api.unisound.com/v1No — direct, no conversion
Chat/Completions APIChat Completionshttps://maas-api.unisound.com/v1Yes — router converts protocol
Anthropic MessagesAnthropic Messageshttps://maas-api.unisound.com/anthropicYes — router converts protocol

Enable protocol conversion routing (when Upstream format is Chat Completions / Anthropic Messages)

CC Switch local routing starts a proxy on this machine and converts protocols automatically:

  1. Open Settings → Routing and turn on the master switch.
  2. Enable Codex takeover.
  3. Keep CC Switch running in the background.

When Upstream format is Responses, it is direct mode — skip routing and this step.

Verify configuration

  1. On the home screen, click the Unisound provider card to make it current.
  2. Fully quit and restart Codex.
  3. Send a message in Codex; a Unisound model reply means success.
  4. To switch back to an official model, click that provider card in CC Switch — no file edits needed.

4. Quick access to capability models

We provide built-in U2-ASR, U2-TTS, U2-TTS-Clone, and U2-OCR capabilities. Add the corresponding model Skill in Codex to call these services quickly without integrating each model API separately.

Open a Skill page below to install via chat or CLI. After installation, the Skill guides you through model configuration.

Model
Skill Name
Skill Description
Action
U2-OCR
u1-ocr-parser-pro
Document Parsing
U2-OCR
u1-ocr-extract-pro
Document Information Extraction and Classification
U2-OCR-Med
u1-ocr-med-pro
Medical Document Information Extraction and Classification
U2-ASR
u2-asr-pro
Speech Transcription
U2-TTS
u2-tts-pro
Speech Synthesis
U2-TTS-Clone
u2-tts-clone-pro
Voice Cloning