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
- Install or update Node.js (v18.0 or later).
- Run the following command in a terminal to install Codex.
npm install -g @openai/codexRun the following command to verify the installation.
codex --version2. 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 format: sk-xxxxx
Go to API Key Management to create an API Key
- 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.
- In a terminal, run the following command to check the default shell.
echo $SHELL- Set the environment variable based on your shell type:
# 将 YOUR_API_KEY 替换为实际使用的 API Key
echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.bash_profile- Run the following command to apply the environment variable.
source ~/.bash_profile2. 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.tomlIf 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.
- 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"- 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"):
- 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"- 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:
codexIf 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
- 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 plan | Configuration |
|---|---|
| U Plan | Provider name: Unisound API Key: Get from console Request URL: https://maas-api.unisound.com/v1 |
| Pay-as-you-go | Provider 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 protocol | Upstream format | Request URL | Enable routing |
|---|---|---|---|
| Responses API | Responses | https://maas-api.unisound.com/v1 | No — direct, no conversion |
| Chat/Completions API | Chat Completions | https://maas-api.unisound.com/v1 | Yes — router converts protocol |
| Anthropic Messages | Anthropic Messages | https://maas-api.unisound.com/anthropic | Yes — 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:
- Open Settings → Routing and turn on the master switch.
- Enable Codex takeover.
- Keep CC Switch running in the background.
When Upstream format is Responses, it is direct mode — skip routing and this step.
Verify configuration
- On the home screen, click the Unisound provider card to make it current.
- Fully quit and restart Codex.
- Send a message in Codex; a Unisound model reply means success.
- 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.