Add Yunhai as a provider in your user-level Codex configuration.
1. Set the key
powershell
$env:YUNHAI_API_KEY="YOUR_API_KEY"This sets the variable for the current PowerShell session. On macOS or Linux use export YUNHAI_API_KEY="YOUR_API_KEY".
2. Edit user configuration
Merge the following into ~/.codex/config.toml, preserving existing settings.
toml
model = "YOUR_MODEL_ID"
model_provider = "yunhai"
[model_providers.yunhai]
name = "Yunhai"
base_url = "http://localhost:3187/v1"
env_key = "YUNHAI_API_KEY"
wire_api = "responses"3. Start and verify
Start Codex from the terminal with the environment variable set, choose an available model and send a short request. If the protocol or model is incompatible, diagnose it with the Responses request example first.