s1d1-router / tutorials /04-codex.md
scombat's picture
Integrations: policy, server, LiteLLM, tutorials (untested parts labelled)
7783834 verified
|
Raw History Blame Contribute Delete
1.5 kB
# Codex CLI
Facts from the Codex configuration reference (2026-10-15): `config.toml` keys `model`, `model_provider`,
`[model_providers.<id>]` (`base_url`, `env_key`, `wire_api`; `responses` is the only supported value),
`model_reasoning_effort` (values depend on the model: `low`, `medium`, `high`, `xhigh`, …), profile files
`$CODEX_HOME/<name>.config.toml` selected with `--profile`, and lifecycle hooks (`features.hooks = true`, event
`UserPromptSubmit`, command handlers). I did not find a documented way for a hook to change the model.
## 1. Choose at launch (*router untested; `-m` and `-c` assumed from the Codex CLI*)
```bash
python integrations/serve.py --model scombat/s1d1-router --policy integrations/policy.example.yaml &
python integrations/routed.py codex "fix the failing test in utils/"
```
runs `codex -m <model> -c model_reasoning_effort="<effort>" "<prompt>"`. Edit the `codex` profile in
`policy.example.yaml` first: put the model ids of your account in `models` (they are placeholders) and keep only the
efforts your models accept. If `-c` is not available in your version, use profile files (one per tier) and
`--profile`.
## 2. Through a gateway
Point a custom provider at a LiteLLM proxy (`base_url = "http://localhost:4000/v1"`, `env_key`), with the Responses
API enabled on the proxy, and use the hook of `02-litellm.md`. *Untested: the Responses path of the hook is not
written; check that LiteLLM runs `async_pre_call_hook` on `/v1/responses` for your version.*