Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code ChatGPT Subscription Shim

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

Install

python3 -m venv .venv
. .venv/bin/activate
pip install -e ".[test]"

Configure

Copy the examples and edit if needed:

cp examples/.env.example .env
cp examples/litellm-config.yaml litellm-config.yaml

Important variables:

  • ANTHROPIC_AUTH_TOKEN: local bearer token Claude Code must send to the shim.
  • LITELLM_BASE_URL: LiteLLM proxy URL, default http://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.

Run

Start both LiteLLM and the shim:

scripts/start-all.sh

Complete the interactive ChatGPT OAuth flow if LiteLLM asks for it.

In another terminal, launch Claude Code through the shim:

scripts/claude-code.sh

Or run the services separately. Start LiteLLM:

scripts/start-litellm.sh

Complete the interactive ChatGPT OAuth flow if LiteLLM asks for it.

Start the shim:

scripts/start-shim.sh

Launch Claude Code through the shim:

scripts/claude-code.sh

Endpoints

  • POST /v1/messages
  • POST /v1/messages/count_tokens
  • GET /v1/models
  • GET /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.

About

A lightweight compatibility layer between Claude Code workflows and ChatGPT sub.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages