OhMyGPT
Coding Tools

Codex CLI

Run OpenAI Codex CLI on OhMyGPT with your OhMyGPT key, on GPT or any other model in the catalog.

Codex CLI runs on OhMyGPT with one provider entry in its config file. Your OhMyGPT key then gives Codex the GPT models and the rest of the catalog, switchable per run with codex -m. You can test the whole setup for free with ohmygpt/mock.

Configure

Add the provider to ~/.codex/config.toml:

~/.codex/config.toml
model = "openai/gpt-5.5"
model_provider = "ohmygpt"

[model_providers.ohmygpt]
name = "OhMyGPT"
base_url = "https://api.ohmygpt.com/v1"
env_key = "OHMYGPT_API_KEY"
wire_api = "responses"

Codex reads your key from the variable named in env_key. Export it in the shell that runs Codex:

export OHMYGPT_API_KEY="sk-..."
codex
  • base_url ends in /v1. Codex appends /responses.
  • wire_api = "responses" selects the Responses API, which Codex uses for every provider.
  • model is any model ID from Choose a model. To use another model for one run, start Codex with codex -m <model id>.

Check the connection

Send a Responses request, the kind Codex sends, to the free test model ohmygpt/mock:

curl https://api.ohmygpt.com/v1/responses \
  -H "Authorization: Bearer $OHMYGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "ohmygpt/mock", "input": "ping"}'
{
  "id": "resp_MRazQMjAopUMBIjoOfs2bSUL",
  "object": "response",
  "status": "completed",
  "model": "mock",
  "output": [
    {
      "type": "message",
      "id": "msg_0",
      "role": "assistant",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "text": "This is a mock reply from OhMyGPT. Your integration works; switch to a real model when ready."
        }
      ]
    }
  ],
  "usage": { "input_tokens": 15, "output_tokens": 17, "total_tokens": 32 }
}

To run Codex itself at no cost, start it with codex -m ohmygpt/mock. The mock calls the first tool Codex declares, gets the result back and replies with text, so you see one full turn of the agent loop. The mock is available once your account has been topped up.

Choose a model

List the models you can use with Codex:

curl -s https://api.ohmygpt.com/v1/models \
  | jq -r '.data[] | select(.available and any(.protocols[]?; .id == "openai-responses")) | .id'

Prices for each are on the Models page.

Codex is tuned for OpenAI's GPT models, and openai/gpt-* IDs give you the full experience. Other models in the list, such as zhipu/glm-5.3, run Codex too, including its tool calls and reasoning settings.

Troubleshooting

SymptomCauseFix
Missing environment variable: `OHMYGPT_API_KEY`.The variable is not exported in the shell that runs Codexexport OHMYGPT_API_KEY=..., then start Codex again
`wire_api = "chat"` is no longer supported.The provider entry uses an older Codex settingSet wire_api = "responses"
Every request returns 404base_url is missing /v1, so requests go to /responsesSet base_url = "https://api.ohmygpt.com/v1"
401 with Invalid API keyThe key is mistyped or was deletedCopy a key from API keys
404 saying the model does not existThe ID is misspelledCopy the ID from GET /v1/models
402The balance or the key's spending limit is used upTop up at Billing

Every response carries an X-Request-ID header, and Usage shows what each request cost.

On this page