Skip to content

Type to search the docs and the model list.

Codex CLI

Run the Codex command-line agent on eWest models.

Codex CLI talks to eWest over the Responses API (/v1/responses), set up as a custom model provider.

Setup

Add an ewest provider to ~/.codex/config.toml and make it the default with model_provider. Keep wire_api = "responses". Don't call the provider openai, ollama or lmstudio: Codex reserves those ids.

Codex reads the key from the environment variable named in env_key, so export EWEST_KEY in the shell where you run Codex.

# Codex reads the key from the environment variable named in env_key.
model = "ewest/claude-sonnet"
model_provider = "ewest"
# eWest doesn't offer web search yet; without this line Codex's requests are refused.
web_search = "disabled"

[model_providers.ewest]
name = "eWest"
base_url = "https://api.ewest.ai/v1"
env_key = "EWEST_KEY"
wire_api = "responses"

Choose a model

Set model in config.toml, or pass --model for one run, always with the ewest/ prefix. ewest/claude-sonnet is a good default for coding; ewest/claude-haiku and ewest/gemini-flash are faster and cheaper.

# For one session (or change model in ~/.codex/config.toml):
codex --model ewest/claude-opus
codex exec --model ewest/gemini-flash "Summarize README.md"

Verify it works

codex exec runs one task without the interactive UI; --skip-git-repo-check lets it run outside a Git repository. A warning that model metadata for the ewest/* id was not found is harmless.

Every response has an x-request-id header; paste it into the console under Requests to see the request (trace IDs).

# Needs EWEST_KEY in the environment and the config.toml above.
codex exec --skip-git-repo-check --model ewest/claude-haiku "Reply with the single word OK"

Streaming and tools

Codex streams over /v1/responses and calls its own tools (shell commands, file edits) with function calling; nothing to set. Codex sends the whole conversation in input every turn, which works with any setting; eWest also keeps Responses conversations by default, so previous_response_id and fetching a stored response by id work too (see Responses).

# Codex streams over /v1/responses and runs its shell tool; --json prints every event.
codex exec --skip-git-repo-check --json --model ewest/claude-haiku \
  "How many files are in this folder? Use ls."

Troubleshooting

  • Codex says the key or EWEST_KEY is missing: export it in the same shell, or add it to ~/.zshrc / ~/.bashrc.
  • 401: the key is missing, mistyped or revoked. Copy it again from API keys.
  • 404 with model_not_found: the model name needs the ewest/ prefix (ewest/claude-haiku, not claude-haiku) and must be in Models.
  • 403: your key is not allowed to use that model; 402: the key's budget is used up. See Errors.
  • To rule Codex out, send the request below: it is a /v1/responses call with the same key and model.
# The request Codex makes, without Codex: if this fails, the key or model is the problem.
curl https://api.ewest.ai/v1/responses \
  -H "Authorization: Bearer $EWEST_KEY" \
  -H "content-type: application/json" \
  -d '{"model": "ewest/claude-haiku", "input": "Reply with the single word OK"}'

Still stuck? Follow Troubleshoot a request.