Codex CLI
OpenAI’s Codex CLI talks to providers through the Responses API, which OpenPike serves at /v1/responses. Add OpenPike as a custom model provider in Codex’s config, and every Codex request goes through your virtual key, budgets and Logs.
| OpenPike endpoint | POST /v1/responses |
| Base URL | https://api.openpike.dev/v1 |
| Key | A virtual key, from the environment variable named in env_key |
| Models | openai/<model>, for example openai/gpt-5.4; also xai/, groq/ and openrouter/ models |
| Tags | http_headers in the provider config |
1. Add a provider key and create a key for Codex
Section titled “1. Add a provider key and create a key for Codex”Add your OpenAI API key (or an xAI, Groq or OpenRouter key) on the Providers page. Then, on the Keys page, create a virtual key for Codex and set it as an environment variable:
export OPENPIKE_API_KEY="opk_live_..."$env:OPENPIKE_API_KEY = "opk_live_..."2. Configure Codex
Section titled “2. Configure Codex”Add a model provider to ~/.codex/config.toml and make it the default:
model = "openai/gpt-5.4"model_provider = "openpike"
[model_providers.openpike]name = "OpenPike"base_url = "https://api.openpike.dev/v1"env_key = "OPENPIKE_API_KEY"wire_api = "responses"http_headers = { "x-openpike-tags" = "agent=codex" }modelis OpenPike’sprovider/modelname. An alias made for the Responses endpoint works too, for exampleopenpike/codex.env_keynames the variable Codex reads the virtual key from. Codex sends it asAuthorization: Bearer.wire_api = "responses"is Codex’s only supported value, and the format OpenPike serves at/v1/responses.http_headersaddsx-openpike-tagsto every request, so Codex’s requests show as the agentcodexin Logs, Activity and Agents.
A run ID per task
Section titled “A run ID per task”A run budget caps one task’s spend, requests and time. http_headers values are fixed, but env_http_headers maps a header to an environment variable, so each task can carry its own run ID:
[model_providers.openpike]# ...as above, plus:env_http_headers = { "x-openpike-run" = "OPENPIKE_RUN", "x-openpike-run-label" = "OPENPIKE_RUN_LABEL" }OPENPIKE_RUN="triage-$(date +%s)" OPENPIKE_RUN_LABEL="Nightly triage" codex exec "triage the open issues"$env:OPENPIKE_RUN = "triage-$(Get-Date -UFormat %s)"$env:OPENPIKE_RUN_LABEL = "Nightly triage"codex exec "triage the open issues"Once the run reaches a cap, Codex’s requests get 429 run_limit_exceeded and the task stops. Set a new OPENPIKE_RUN for each task.
To keep your normal Codex setup and use OpenPike only sometimes, leave out the first two lines and pick the provider per run: codex -c model_provider=openpike -m openai/gpt-5.4.
Groq models
Section titled “Groq models”Codex also works with Groq models through OpenPike’s Responses endpoint: add your Groq key on the Providers page and change the model line. The provider block stays the same.
model = "groq/openai/gpt-oss-120b"Everything after groq/ is Groq’s own model ID, here OpenAI’s open-weight gpt-oss-120b as Groq serves it. Groq’s Responses API is in beta, and its built-in tools (browser search, code execution) work only on openai/gpt-oss-20b and openai/gpt-oss-120b, according to Groq’s docs. Groq’s GPT OSS and Qwen models are priced from Groq’s own models page, so their requests show a cost; Groq’s Llama models are sold through its sales team, have no public price, and show tokens only.
3. Check it
Section titled “3. Check it”Run a small task, then open Logs: each Codex turn is a request on the Responses endpoint, tagged agent=codex, with its tokens and cost.
codex exec "List the files in this directory and say which one is largest."What to know
Section titled “What to know”- Requests Codex makes: only
POST /v1/responses, streamed, withstore: false, so each request carries the whole conversation and OpenAI keeps no state. When Codex compacts a long thread it sends that through/v1/responsesas well. Every request counts toward your plan’s monthly requests and your budgets. - Budgets and loop limits apply as for any agent. A hard budget or a loop pause stops Codex with a
429; see Stop a runaway agent. - Hosted tools such as web search are billed by OpenAI on top of tokens, and are not in OpenPike’s cost. See Usage and cost.
- Background responses (
background: true) are not supported by OpenPike. Codex does not use them. - Skill: the OpenPike skills repo has an
openpike-setupskill that Codex can load to set this up for you. It never asks for or writes a provider key.