Back to API Docs
Codex CLI
OpenAI's Codex CLI via an OpenAI-compatible provider.
Connection
- URL cơ sở
- https://your-domain.com/v1
- Install
- npm install -g @openai/codex
Default model
Setup
- Install the Codex CLI globally via npm.
- Configure your shell environment with the keys.
- Save the configuration to ~/.codex/config.toml.
- Run `codex` in your project directory.
Cấu hình
Biến môi trường
~/.zshrc
bash
export OPENAI_API_KEY="YOUR_API_KEY"
export OPENAI_BASE_URL="https://your-domain.com/v1"Provider config
~/.codex/config.toml
toml
model = "gpt-4o-mini"
model_provider = "gateway"
[model_providers.gateway]
name = "API Gateway"
base_url = "https://your-domain.com/v1"
wire_api = "chat"
env_key = "OPENAI_API_KEY"Tip: Use wire_api = "chat" for OpenAI-compatible chat completions. Use "responses" only if the upstream is the official OpenAI Responses API.
