GreenPT Docs
GreenPT Code

Codex CLI

Use GreenPT Code models in OpenAI's Codex CLI via the honey-llm-proxy translation layer.

Codex is OpenAI's coding agent for the terminal, IDE, and CI. It supports custom providers via ~/.codex/config.toml — but with one hard protocol requirement that changed in early 2026:

Codex speaks only the OpenAI Responses API

As of February 2026, wire_api = "chat" (Chat Completions) has been removed — configs that set it fail on startup. Any endpoint Codex talks to must implement /v1/responses. GreenPT serves Chat Completions and does not yet expose a Responses endpoint, so Codex needs a local translation proxy.

honey-llm-proxy is GreenPT's own translation proxy — a single small Rust binary (no Python, no LiteLLM) that lets both Codex and Claude Code use GreenPT models. It translates the OpenAI Responses API to Chat Completions, including streaming and tool calling.

Install & run

cargo install --path .
export GREENPT_API_KEY="your-greenpt-key"
greenpt-proxy            # listens on http://127.0.0.1:4000

Options: --port N (or PORT env), and GREENPT_BASE_URL (default https://api.greenpt.ai/v1).

Point Codex at the proxy

Add to ~/.codex/config.toml (user-level only — Codex ignores model_provider and model_providers in project-local .codex/config.toml files):

model = "glm-5.2"
model_provider = "greenpt"

[model_providers.greenpt]
name = "GreenPT (via greenpt-proxy)"
base_url = "http://localhost:4000/v1"
env_key = "GREENPT_API_KEY"
wire_api = "responses"

Restart Codex after config changes (it reads config only at startup). Switch models per invocation with codex --model minimax-m2.5, or change the top-level model key (glm-5.2, minimax-m2.5, kimi-k2.6).

Notes:

  • env_key must name an environment variable — you cannot paste the API key directly into the TOML.
  • The provider IDs openai, ollama, and lmstudio are reserved — always define GreenPT under its own ID as above.
  • The proxy is stateless: previous_response_id is rejected (Codex sends the full context each turn), and unknown request params are dropped rather than errored.

Verify

curl -s localhost:4000/v1/responses -H 'content-type: application/json' \
  -d '{"model":"glm-5.2","input":"Say hi"}'

A valid Responses-format reply confirms the proxy is translating correctly.

Security

The proxy binds to 127.0.0.1 and does not validate incoming auth headers — the upstream key comes from GREENPT_API_KEY only. Don't expose it beyond localhost.

Alternative: LiteLLM translation proxy

LiteLLM in proxy mode is a general-purpose Responses→Chat translator:

# litellm-config.yaml
model_list:
  - model_name: glm-5.2
    litellm_params:
      model: openai/glm-5.2
      api_base: https://api.greenpt.ai/v1
      api_key: os.environ/GREENPT_API_KEY
      drop_params: true
pip install 'litellm[proxy]'
litellm --config litellm-config.yaml --port 4000

Point Codex at it with the same TOML block above (adjust env_key to your LiteLLM master key). drop_params: true strips Responses-specific request fields the upstream Chat Completions endpoint doesn't recognize, preventing API errors. honey-llm-proxy handles this automatically and covers Claude Code too.

Troubleshooting

SymptomFix
Startup error mentioning wire_api = "chat"Chat Completions support was removed — set wire_api = "responses" (or omit it; responses is the default)
Connection refused on :4000The proxy isn't running — start greenpt-proxy (with GREENPT_API_KEY exported) first
Config changes ignoredCodex reads config.toml only at startup — restart the CLI
Provider settings ignored in a repomodel_provider / model_providers only work in user-level ~/.codex/config.toml, not project-local config
Auth errorsenv_key must reference an exported environment variable, not a literal key string
Streaming stallsVerify the proxy is running and reachable; the endpoint supports SSE streaming for Responses

On this page