Use Claude Code with any model from providers like GreenPT, Eurouter, OpenRouter, Together AI, Groq, and more. This lightweight proxy translates Anthropic Messages API to OpenAI Chat Completions API format, unlocking access to hundreds of models.
| Provider | Highlights | Get Started |
|---|---|---|
| GreenPT | Fast inference, great coding models (Qwen, DeepSeek, Llama) | Get $5 Free Credits β |
| Eurouter | EU-based infrastructure, DeepSeek models | Visit Eurouter β |
βββββββββββββββββββ Anthropic API βββββββββββββββββββ OpenAI API βββββββββββββββββββ
β β βββββββββββββββββββββΆ β β βββββββββββββββββββΆ β Eurouter β
β Claude Code β β Proxy β β GreenPT β
β β βββββββββββββββββββββ β β βββββββββββββββββββ β OpenRouter β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- β Full message translation β Anthropic β OpenAI formats
- β Streaming support β Real-time response streaming via SSE
- β Tool/Function calling β Anthropic tools to OpenAI functions
- β System prompts β Proper system message handling
- β Multi-turn conversations β Full context preservation
- β Model mapping β Map Claude tiers (Opus/Sonnet/Haiku) to any models
- β
Web configuration UI β Configure via browser at
http://localhost:8080 - β Docker support β Easy containerized deployment
pip install claude-code-multi-model-proxyThen run with GreenPT (get free credits):
claude-code-proxy \
--target-url https://api.greenpt.ai/v1 \
--api-key YOUR_API_KEY \
--default-model qwen3-coder-30b-a3b-instructOr with Eurouter:
claude-code-proxy \
--target-url https://api.eurouter.ai/api/v1 \
--api-key YOUR_API_KEY \
--default-model deepseek/deepseek-chat-v3git clone https://github.com/robertkeus/claude-code-all-models.git
cd claude-code-all-models
pip install -r requirements.txt
python -m anthropic_openai_proxy.proxy --target-url https://api.eurouter.ai/api/v1 --api-key YOUR_API_KEYdocker run -p 8080:8080 \
-e TARGET_URL=https://api.eurouter.ai/api/v1 \
-e API_KEY=your-api-key \
-e DEFAULT_MODEL=deepseek/deepseek-chat-v3 \
robertkeus/claude-code-all-models# Set your API key
export GREENPT_API_KEY=your-api-key
# Run
docker-compose up -dclaude-code-proxy \
--target-url https://api.eurouter.ai/api/v1 \
--api-key YOUR_API_KEY \
--default-model deepseek/deepseek-chat-v3# Log out of any existing Anthropic account
claude logout
# Set environment variables
export ANTHROPIC_BASE_URL=http://localhost:8080
export ANTHROPIC_AUTH_TOKEN=proxy
export ANTHROPIC_API_KEY=""
# Run Claude Code
claude --model gpt-4claude logout && \
ANTHROPIC_BASE_URL=http://localhost:8080 \
ANTHROPIC_AUTH_TOKEN=proxy \
ANTHROPIC_API_KEY="" \
claude --model gpt-4| Flag | Environment Variable | Default | Description |
|---|---|---|---|
--target-url |
TARGET_URL |
https://api.openai.com/v1 |
OpenAI-compatible API base URL |
--api-key |
API_KEY |
"" |
API key for target endpoint |
--default-model |
DEFAULT_MODEL |
gpt-4 |
Default model name |
--opus-model |
OPUS_MODEL |
(default) | Model for Claude Opus requests |
--sonnet-model |
SONNET_MODEL |
(default) | Model for Claude Sonnet requests |
--haiku-model |
HAIKU_MODEL |
(default) | Model for Claude Haiku requests |
--port |
PORT |
8080 |
Proxy server port |
--host |
HOST |
0.0.0.0 |
Host to bind to |
Claude Code uses different models for different tasks. You can map each tier to specific models on your provider:
claude-code-proxy \
--target-url https://api.eurouter.ai/api/v1 \
--api-key YOUR_KEY \
--default-model deepseek/deepseek-chat-v3 \
--haiku-model deepseek/deepseek-chat-v3 \
--sonnet-model deepseek/deepseek-chat-v3 \
--opus-model deepseek/deepseek-r1| Claude Tier | Use Case | Suggested Mapping |
|---|---|---|
| Haiku | Quick tasks, summaries, titles | Fast/cheap model |
| Sonnet | Main coding tasks | Good coding model |
| Opus | Complex reasoning | Best available model |
Access the configuration interface at http://localhost:8080 after starting the proxy:
- Select your provider (GreenPT, OpenRouter, or custom)
- Enter your API key
- Choose models for each Claude tier
- Save and copy the launch commands
| Provider | Target URL | Example Model |
|---|---|---|
| GreenPT β | https://api.greenpt.ai/v1 |
qwen3-coder-30b-a3b-instruct |
| Eurouter β | https://api.eurouter.ai/api/v1 |
deepseek/deepseek-chat-v3 |
| OpenRouter | https://openrouter.ai/api/v1 |
openai/gpt-4-turbo |
| Together AI | https://api.together.xyz/v1 |
meta-llama/Llama-3-70b-chat-hf |
| Groq | https://api.groq.com/openai/v1 |
llama-3.1-70b-versatile |
| Fireworks | https://api.fireworks.ai/inference/v1 |
accounts/fireworks/models/llama-v3-70b |
| LM Studio | http://localhost:1234/v1 |
local-model |
| Ollama | http://localhost:11434/v1 |
llama3 |
| OpenAI | https://api.openai.com/v1 |
gpt-4-turbo |
π‘ New to this? Get $5 free credits from GreenPT to try it out!
| Anthropic (incoming) | OpenAI (outgoing) |
|---|---|
POST /v1/messages |
POST /v1/chat/completions |
POST /v1/messages/count_tokens |
(estimated locally) |
Anthropic format (Claude Code sends this):
{
"model": "claude-3-sonnet-20240229",
"max_tokens": 1024,
"system": "You are a helpful assistant.",
"messages": [
{"role": "user", "content": "Hello"}
]
}OpenAI format (Proxy sends this):
{
"model": "gpt-4",
"max_tokens": 1024,
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello"}
]
}OpenAI format (Provider returns this):
{
"choices": [{"message": {"content": "Hi there!"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 10, "completion_tokens": 3}
}Anthropic format (Proxy returns this):
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"content": [{"type": "text", "text": "Hi there!"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 10, "output_tokens": 3}
}You need to log out of Anthropic first:
claude logoutMake sure the proxy is running before starting Claude Code:
# Terminal 1: Start proxy
claude-code-proxy --target-url ... --api-key ...
# Terminal 2: Start Claude Code
ANTHROPIC_BASE_URL=http://localhost:8080 claude --model deepseek/deepseek-chat-v3Specify the exact model name that your provider supports:
claude --model qwen3-coder-30b-a3b-instructIf you experience streaming problems, the proxy automatically falls back to simulated streaming from non-streaming responses.
git clone https://github.com/robertkeus/claude-code-all-models.git
cd claude-code-all-models
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install with dev dependencies
pip install -e ".[dev]"pytest# Format
black src/ proxy.py
# Lint
ruff check src/ proxy.py
# Type check
mypy src/# Install build tools
pip install build twine
# Build
python -m build
# Upload to PyPI
twine upload dist/*# Build
docker build -t robertkeus/claude-code-all-models .
# Push
docker push robertkeus/claude-code-all-modelsanthropic-openai-proxy/
βββ src/
β βββ anthropic_openai_proxy/
β βββ __init__.py # Package entry point
β βββ proxy.py # Main FastAPI application
β βββ config.py # Configuration & model mapping
β βββ routes.py # API route handlers
β βββ converters.py # Format translation logic
β βββ streaming.py # SSE stream handling
β βββ templates/
β βββ config.html # Web configuration UI
βββ public/
β βββ assets/ # Static assets
βββ Dockerfile # Docker build configuration
βββ docker-compose.yml # Docker Compose setup
βββ pyproject.toml # Python package configuration
βββ requirements.txt # Dependencies
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is not affiliated with, endorsed by, or associated with GreenPT, OpenRouter, Eurouter, Anthropic, or any other API provider mentioned in this documentation.
Use at your own risk. The authors and contributors are not responsible for any damages, data loss, API costs, or other issues that may arise from using this software. Always review your API provider's terms of service before use.
MIT License - See LICENSE for details.