Codex CLI
Use 678API in Codex CLI
Define 678API as a custom model provider in Codex configuration and read its key from an environment variable.
Install or update
npm install -g @openai/codex
codex --versionSet the API key
export API678_API_KEY="YOUR_API_KEY"Configure the provider
Edit ~/.codex/config.toml:
model = "MODEL_ID_FROM_CONSOLE"
model_provider = "api678"
[model_providers.api678]
name = "678API"
base_url = "https://www.678api.com/v1"
env_key = "API678_API_KEY"
wire_api = "responses"Replace MODEL_ID_FROM_CONSOLE with the exact model ID shown in the 678API console.
Start Codex
cd /path/to/your/project
codexSecurity
Keep the real key out of config.toml and repositories. The env_key setting reads it from your environment.
Do I need to sign out of ChatGPT?
No. model_provider = "api678" selects 678API for this configuration. Restore your previous model and provider, then restart Codex, to return to the official service.