Skip to main content
Codex CLI provides powerful code generation and completion capabilities directly in your terminal.
If your Allowed Headers are already set to *, you can skip this note. If not, and you face issues integrating Bifrost with Codex CLI, try switching to * or adding the specific headers required by your client. By default, Bifrost whitelists: Content-Type, Authorization, X-Requested-With, X-Stainless-Timeout, and X-Api-Key.

Installing Codex CLI

Configuring Codex CLI with Bifrost

Codex CLI always prefers OAuth over custom API keys. Make sure you run /logout before configuring the Bifrost gateway with Codex.

Update codex.toml

Add the Bifrost base URL and credentials to your global ~/.codex/config.toml or project-specific .codex/config.toml:
Always run codex from the same terminal session where you exported variables, or restart the terminal after changing your profile. GUI-launched terminals or IDEs may not pick up shell-profile exports unless the environment is configured there as well.

Using Non-OpenAI models

Codex CLI defaults to websocket mode for the Responses API and automatically falls back to HTTPS if the WebSocket connection fails. Non-OpenAI models are not supported in WebSocket mode, because in this mode, the server is expected to maintain the conversation context. If you are using non-OpenAI models, you must enable HTTPS mode. To enable https for Codex CLI by default, add these settings in your config.toml:

Model Configuration

Use the --model flag to start Codex with a specific model:
You can also switch models mid-session with the /model command:

Using Non-OpenAI Models with Codex CLI

Bifrost automatically translates OpenAI API requests to other providers, so you can use Codex CLI with models from Anthropic, Google, Mistral, and more. Use the provider/model-name format to specify any Bifrost-configured model:

Supported Providers

Bifrost supports the following providers with the provider/model-name format: openai, azure, gemini, vertex, bedrock, mistral, groq, cerebras, deepseek, cohere, perplexity, xai, ollama, openrouter, huggingface, nebius, parasail, replicate, vllm, sgl
Non-OpenAI models must support tool use for Codex CLI to work properly. Codex CLI relies on tool calling for file operations, terminal commands, and code editing. Models without tool use support will fail on most operations.

Listing Non-OpenAI Models in the Model Picker

You can always start or switch to a non-OpenAI model by passing it explicitly (codex --model bedrock/... or /model bedrock/...). However, these models do not appear in the /models picker by default, and selecting them logs a warning like:
This happens because Codex CLI builds its model picker from its own catalogue i.e. a list bundled into the Codex binary plus a refresh tied to your OpenAI account. Bifrost sits on the inference path, not Codex’s model-discovery path, so Codex never learns about your non-OpenAI models. The fallback metadata also assigns a conservative context window, which can trigger premature history compaction. To make non-OpenAI models show up in /models and carry correct metadata, create a local model catalog file and reference it from config.toml.

1. Create a model catalog file

You don’t need to create a model entry from scratch. First choose a complete, compatible entry from ~/.codex/models_cache.json, then copy it into ~/.codex/bifrost_catalog.json while overriding only slug, display_name, and context_window. The following example shows the complete entry shape. The two <COPY-...> values represent long, version-specific strings; copy their full values from the same source entry without modifying them.
The catalog JSON schema is internal to Codex and can change between versions. Select a source entry whose API behavior and capabilities are closest to the target model. Preserve every other field from that entry, including compatibility, response parsing, priority, visibility, truncation, reasoning, and tooling metadata. Do not trim the copied object into a minimal entry or remove fields that appear optional.

2. Reference it from config.toml

Add the model_catalog_json key to your ~/.codex/config.toml, pointing at the file:
Restart Codex and run /models — your Bifrost models now appear in the picker, and the metadata warning is gone.
This makes non-OpenAI models appear in the Codex CLI picker only. The Codex desktop app’s model dropdown is populated from your OpenAI account’s catalogue and does not merge the local model_catalog_json file. Non-OpenAI models won’t appear there. In the app, select them with the in-session /model bedrock/... command instead.