Claude Code & Codex
Home · Getting Started · Configuration · API Reference · Claude Code & Codex
Claude Code
Automatic setup
Run the setup wizard with the Claude Code step enabled:
./target/release/ghc-proxy --setup --claudecode
This patches ~/.claude/settings.json, merging env.ANTHROPIC_BASE_URL so
Claude Code routes its Anthropic API calls through the proxy. Existing settings
are preserved — only the base URL key is added or updated, and the file is left
untouched if it is not valid JSON.
Manual setup
Set ANTHROPIC_BASE_URL to the proxy in ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "http://127.0.0.1:8314"
}
}
Or export it in your shell before launching Claude Code:
export ANTHROPIC_BASE_URL="http://127.0.0.1:8314"
Mapping Claude Code’s models
Claude Code sends specific model names (for example claude-opus-4-7[1m]). Use
model mappings to route those to whichever
Copilot model you want. For example, to always use Claude Opus 4.8 with its
native 1M context:
model_mappings:
exact:
claude-opus-4-8: claude-opus-4.8
prefix:
claude-opus-4-7: claude-opus-4.8
Restart the proxy after editing config.yaml — mappings are read at startup.
Codex CLI
The Codex /v1/responses endpoint is supported with adapters that make the
upstream Copilot Responses API behave like the Codex client expects:
apply_patchtool rewritingX-Initiatorheader (uservsagent)- context-compaction trimming
service_tiernulling- stripping of unsupported tools
Point the Codex CLI at the proxy’s base URL:
export OPENAI_BASE_URL="http://127.0.0.1:8314/v1"
Tips
- Use
GET /usage(orghc-proxy check-usage) to monitor your Copilot quota. - The dashboard at
http://127.0.0.1:8314/shows live request statistics and the full list of supported models. - If a tool reports a model is unavailable, check
GET /v1/modelsfor the exact model id and add a mapping.