Skip to content

Add Codex CLI support to thv llm setup #5783

Description

@jerm-dro

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

Metadata

Metadata

Assignees

Labels

cliChanges that impact CLI functionalityenhancementNew feature or requestllm gatewayLLM gateway authentication feature

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions