Claude Code
Use GreenPT Code models in Claude Code via the honey-llm-proxy translation layer.
Claude Code is Anthropic's terminal-based coding agent. It speaks only the Anthropic Messages API — it cannot talk to an OpenAI-style Chat Completions endpoint directly.
GreenPT doesn't expose an Anthropic endpoint yet
GreenPT serves the OpenAI Chat Completions API. It does not yet expose an Anthropic Messages-compatible endpoint, so Claude Code needs a local translation proxy that converts Anthropic Messages requests to Chat Completions.
Recommended: honey-llm-proxy
honey-llm-proxy is GreenPT's own translation proxy — a single small Rust binary (no Python, no LiteLLM) that lets both Claude Code and Codex use GreenPT models. It translates the Anthropic Messages 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:4000Options: --port N (or PORT env), and GREENPT_BASE_URL (default
https://api.greenpt.ai/v1).
Point Claude Code at the proxy
export ANTHROPIC_BASE_URL="http://localhost:4000"
export ANTHROPIC_AUTH_TOKEN="dummy"
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.2"
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.2"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="minimax-m2.5"
claudeThe ANTHROPIC_DEFAULT_*_MODEL variables map Claude Code's internal model tiers
(opus / sonnet / haiku) to GreenPT model IDs — here glm-5.2 handles the heavy
work and minimax-m2.5 (the cheapest model) covers the fast/background tier
Claude Code uses for lightweight internal tasks. The proxy passes model names
through verbatim, so any GreenPT ID works (glm-5.2, minimax-m2.5,
kimi-k2.6).
To make it permanent instead of exporting each session, add these to
~/.claude/settings.json under "env", or wrap them in a shell function:
greenpt-code() {
export ANTHROPIC_BASE_URL="http://localhost:4000"
export ANTHROPIC_AUTH_TOKEN="dummy"
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.2"
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.2"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="minimax-m2.5"
claude "$@"
}Then greenpt-code starts a GreenPT-backed session while plain claude keeps
using your regular Anthropic account.
Verify
curl -s localhost:4000/v1/messages -H 'content-type: application/json' \
-d '{"model":"glm-5.2","max_tokens":50,"messages":[{"role":"user","content":"Say hi"}]}'A successful Anthropic-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 or claude-code-router
Any Anthropic→Chat-Completions translator works. LiteLLM in proxy mode is the most common general-purpose option:
# 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_KEYpip install 'litellm[proxy]'
litellm --config litellm-config.yaml --port 4000
export ANTHROPIC_BASE_URL="http://localhost:4000"
export ANTHROPIC_AUTH_TOKEN="dummy"
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.2"
claudeclaude-code-router follows the same architecture. These general-purpose proxies add a local hop and occasional protocol-translation rough edges (especially around tool calling and usage reporting) — honey-llm-proxy is purpose-built for GreenPT and handles both Claude Code and Codex.
Troubleshooting
| Symptom | Fix |
|---|---|
| Claude Code asks for Anthropic login on first run | Complete onboarding once, or add "hasCompletedOnboarding": true to ~/.claude.json |
| 401 with a valid GreenPT key | Use ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY); the proxy takes the real key from GREENPT_API_KEY |
| Requests still hit api.anthropic.com | ANTHROPIC_BASE_URL isn't set in the environment Claude Code runs in — check settings.json or your shell function |
| Connection refused on :4000 | The proxy isn't running — start greenpt-proxy (with GREENPT_API_KEY exported) first |
| Model errors | The model ID must be one GreenPT recognizes (glm-5.2, minimax-m2.5, kimi-k2.6) — Claude model names won't resolve |
| Missing/incorrect cost display | Token/cost display is approximate through a proxy — treat GreenPT's dashboard as the source of truth |