Codex CLI Integration
OGX includes built-in support for connecting Codex CLI with a single command. You can launch Codex against a running OGX server without manually editing your existing ~/.codex/config.toml.
Quick Start
1. Start OGX
ogx go --no-auth --insecure
ogx go auto-detects running inference providers (vLLM, Ollama, OpenAI via OPENAI_API_KEY, and more). For a local, non-exposed server, --no-auth turns off the API key (no OGX_API_KEY needed below) and --insecure runs without TLS, so the connect step below needs no extra flags. Both are local-development only.
Keep --insecure on the server for Codex: Codex itself cannot connect to self-signed certificates. Without it, ogx go serves HTTPS with a self-signed certificate, and even ogx connect --insecure codex (which only relaxes connect's own probe) fails once the launched Codex hits the server. The alternatives are a properly trusted certificate, or adding the self-signed one to your system trust store. With a trusted certificate, pair the printed API keys with ogx connect --api-key <key>.
2. Connect Codex
ogx connect codex
That launches the Codex TUI with an OGX-specific session config and model catalog generated from the models currently exposed by your running OGX server. Your existing ~/.codex/config.toml is left unchanged.
Codex CLI must be installed and on your PATH.
3. Test it out
The launched TUI is already connected — just type:
> What is 2+2?
> Create a Flask hello world app
For a non-interactive one-shot, forward codex arguments after --:
ogx connect codex -- exec "What is 2+2?"
How It Works
The ogx connect codex command:
- Queries the running OGX server for available models
- Filters out embedding models
- Selects the requested model or defaults to the first available non-embedding model
- Generates a temporary Codex session home with an OGX provider profile and model catalog
- Launches
codex -p ogx, forwarding any arguments given after--
ogx connect codex
|
v
GET /v1/models (discover available models)
|
v
Build OGX model catalog + select default model
|
v
Launch codex -p ogx using a generated session config
|
v
Codex TUI (connected to OGX)
CLI Reference
ogx connect [--url URL] codex [--model MODEL] [-- CODEX_ARGS...]
| Flag | Default | Description |
|---|---|---|
--model | First available model | Model to pre-select for Codex |
--url (group) | https://localhost:8321/v1 | Full OGX OpenAI-compatible API base URL, including /v1. Applies to all ogx connect subcommands. Also reads OGX_BASE_URL. |
--api-key (group) | OGX_API_KEY env var, or none | Bearer API key for the OGX server. Applies to all ogx connect subcommands. |
--insecure / -k (group) | off | Allow HTTPS connections to servers with untrusted (for example, self-signed) certificates, like curl -k. Codex itself cannot connect to self-signed servers; add the certificate to your system trust store, or run the server with ogx go --insecure |
Arguments after -- are forwarded to the codex command.
For more information about OGX's provider architecture, see Providers Overview. For Codex CLI documentation, visit the Codex GitHub repository.