Local FastAPI server exposing the small Anthropic API surface Claude Code needs, while forwarding to a local LiteLLM proxy configured for ChatGPT subscription/Codex OAuth models.
Claude Code -> local shim -> LiteLLM proxy -> ChatGPT subscription/Codex OAuth
python3 -m venv .venv
. .venv/bin/activate
pip install -e ".[test]"Copy the examples and edit if needed:
cp examples/.env.example .env
cp examples/litellm-config.yaml litellm-config.yamlImportant variables:
ANTHROPIC_AUTH_TOKEN: local bearer token Claude Code must send to the shim.LITELLM_BASE_URL: LiteLLM proxy URL, defaulthttp://127.0.0.1:4000.SHIM_MODEL_OPUS,SHIM_MODEL_SONNET,SHIM_MODEL_HAIKU: upstream LiteLLM model aliases.
By default, Opus, Sonnet, and Haiku requests route to LiteLLM aliases
chatgpt-opus, chatgpt-sonnet, and chatgpt-haiku. Each alias calls
chatgpt/gpt-5.5 in litellm-config.yaml.
Start both LiteLLM and the shim:
scripts/start-all.shComplete the interactive ChatGPT OAuth flow if LiteLLM asks for it.
In another terminal, launch Claude Code through the shim:
scripts/claude-code.shOr run the services separately. Start LiteLLM:
scripts/start-litellm.shComplete the interactive ChatGPT OAuth flow if LiteLLM asks for it.
Start the shim:
scripts/start-shim.shLaunch Claude Code through the shim:
scripts/claude-code.shPOST /v1/messagesPOST /v1/messages/count_tokensGET /v1/modelsGET /healthz
This is intentionally scoped to local personal use. It does not implement the full Anthropic API, hosted Anthropic tools, Files API, prompt caching guarantees, or production multi-user auth.