Why
thv llm setup currently detects and configures Claude Code, Gemini CLI, Cursor, VS Code, Xcode, and Claude Desktop to use the ToolHive LLM gateway, but not the OpenAI Codex CLI. Users who want Codex to route through the gateway have to hand-edit ~/.codex/config.toml today.
Note: this is distinct from #3586 (closed), which was about Codex as an MCP-client auto-configure target (thv client) — this issue is about the LLM gateway feature (thv llm setup).
What
Add a codex client entry to the LLM-gateway client registry (pkg/client/config.go) so thv llm setup can detect and configure it automatically.
Key differences from existing clients that setup will need to handle:
- Codex's config format is TOML, not JSON/JSONC — the existing
LLMGatewayKeys JSON-Pointer patching mechanism (pkg/client/llm_gateway.go) assumes JSON and would need a TOML-writing path.
- Codex requires
wire_api = "responses" (OpenAI Responses API) on any custom provider — Chat Completions support was removed in Feb 2026. Whether the gateway's upstream exposes a Responses-API-compatible endpoint needs confirming with the gateway team before this can be direct-mode.
- Codex supports command-backed token auth (
[model_providers.<id>.auth] with command/args/refresh_interval_ms), which maps cleanly onto the same thv llm token helper pattern used for Claude Code's apiKeyHelper — this is the most likely integration point for direct mode.
- Proxy mode (routing through
thv llm proxy start) is also possible and doesn't require gateway-side Responses API support, since the proxy just forwards bytes.
References
Why
thv llm setupcurrently detects and configures Claude Code, Gemini CLI, Cursor, VS Code, Xcode, and Claude Desktop to use the ToolHive LLM gateway, but not the OpenAI Codex CLI. Users who want Codex to route through the gateway have to hand-edit~/.codex/config.tomltoday.Note: this is distinct from #3586 (closed), which was about Codex as an MCP-client auto-configure target (
thv client) — this issue is about the LLM gateway feature (thv llm setup).What
Add a
codexclient entry to the LLM-gateway client registry (pkg/client/config.go) sothv llm setupcan detect and configure it automatically.Key differences from existing clients that setup will need to handle:
LLMGatewayKeysJSON-Pointer patching mechanism (pkg/client/llm_gateway.go) assumes JSON and would need a TOML-writing path.wire_api = "responses"(OpenAI Responses API) on any custom provider — Chat Completions support was removed in Feb 2026. Whether the gateway's upstream exposes a Responses-API-compatible endpoint needs confirming with the gateway team before this can be direct-mode.[model_providers.<id>.auth]withcommand/args/refresh_interval_ms), which maps cleanly onto the samethv llm tokenhelper pattern used for Claude Code'sapiKeyHelper— this is the most likely integration point for direct mode.thv llm proxy start) is also possible and doesn't require gateway-side Responses API support, since the proxy just forwards bytes.References