678APIdocs
https://www.678api.com/v1
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

text
npm install -g @openai/codex
codex --version

Set the API key

text
export API678_API_KEY="YOUR_API_KEY"

Configure the provider

Edit ~/.codex/config.toml:

text
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

text
cd /path/to/your/project
codex
Security

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.

© 2026 678API · AI API Gateway Documentation