Codex on your own models

Point the Codex CLI at a model on any of your machines, for one run or for good.

Before you start

  • Corewire running on this computer — the app, or corewire agent.
  • The Codex CLI installed: the codex command.
  • A model whose runtime speaks the Responses API, which is the only one Codex speaks now — Ollama 0.13.3 or newer, LM Studio 0.3.29 or newer, vLLM 0.10 or newer, SGLang, MTPLX, oMLX, Docker Model Runner or Lemonade — on this machine or any of your others. Sharing Ollama takes a minute.
01

Pick a model

On laptop
corewire modelsNAME                        RUNTIME  STATE    WORKS WITHmac-studio/gpt-oss:20b      ollama   serving  claude-code, codex, opencodemac-studio/qwen3-coder:30b  ollama   serving  claude-code, codex, opencode

Any row with codex under WORKS WITH will do.

02

Launch

On laptop
corewire launch codex -model mac-studio/gpt-oss:20bstarting Codex on mac-studio/gpt-oss:20b through this device's gateway (key 4b7e0d2a91c3f685)

Codex gets a provider called corewire for this run, as -c overrides on its command line: the gateway’s /v1 address, the Responses wire API, and the key read from COREWIRE_GATEWAY_KEY — never passed as an argument, where anyone listing processes could read it. Your ~/.codex/config.toml is not touched. The key is minted for this launch, limited to models, and retired after thirty days unused.

Arguments after -- go to Codex:

On laptop
corewire launch codex -model mac-studio/gpt-oss:20b -- exec "add tests for the parser"

-print starts nothing and prints the export line and the command instead, for a terminal of your own; in the desktop app, Agents › Codex › Launch shows the same.

Set it up for good

Make Codex a key of its own:

On laptop
corewire keys new -label "Codex" -scopes models

Export it as COREWIRE_GATEWAY_KEY wherever you keep secrets for your shell, and add the provider to Codex’s configuration:

~/.codex/config.toml
model = "mac-studio/gpt-oss:20b"
model_provider = "corewire"

[model_providers.corewire]
name = "Corewire"
base_url = "http://127.0.0.1:36121/v1"
env_key = "COREWIRE_GATEWAY_KEY"
wire_api = "responses"

Plain codex then runs on your model, and codex -m mac-studio/qwen3-coder:30b picks another.

When something is off

  • The launch is refused. The model’s runtime does not speak the Responses API. Nothing starts and no key is minted; the refusal lists the models Codex can use. Updating the runtime is usually the fix.
  • A 404 naming the model. The name is not one the gateway lists — check it against corewire models; the refusal names the closest ones.
corewire keys lists every key; corewire keys revoke ID retires one for good.