stx7-gateway
v0.1.0
Published
Multi-provider gateway for Claude Code — route requests to OpenAI, Gemini, Ollama, Mistral, and more
Maintainers
Readme
⚡ claude-gateway
Multi-provider gateway for Claude Code — route your Claude Code requests through OpenAI, Gemini, Ollama, Mistral, and more.
What is this?
A local proxy server that sits between Claude Code and any LLM provider. Claude Code sends Anthropic API requests → the gateway translates them to the active provider's format → streams responses back as Anthropic-format SSE.
Claude Code ──→ claude-gateway (localhost:4747) ──→ OpenAI / Gemini / Ollama / ...Supported Providers
| Provider | Models | Auth |
|---|---|---|
| OpenAI | GPT-4o, GPT-5.x, o-series | OPENAI_API_KEY |
| Google Gemini | Gemini 2.5 Pro, 2.0 Flash | GEMINI_API_KEY |
| Ollama | Llama, Qwen, DeepSeek, Codestral (local) | None |
| Mistral | Devstral, Codestral, Mistral Large | MISTRAL_API_KEY |
| NVIDIA NIM | Nemotron, Llama, DeepSeek | NVIDIA_API_KEY |
| MiniMax | MiniMax M2.5, M1 | MINIMAX_API_KEY |
| GitHub Copilot | GPT-4o, Claude, o3-mini | GITHUB_TOKEN |
| OpenAI Codex | GPT-5.x reasoning models | OPENAI_API_KEY |
Quick Start
1. Install
npm i -g claude-gateway2. Set up a provider
# Set your OpenAI key
claude-gateway key openai sk-your-key-here
# Or use Ollama (no key needed, just have Ollama running)
claude-gateway switch ollama3. Start the gateway
claude-gateway start4. Configure Claude Code
Add to your ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "http://localhost:4747"
},
"mcpServers": {
"gateway": {
"command": "claude-gateway",
"args": ["mcp"]
}
}
}Now Claude Code routes through your chosen provider, and you can switch providers from within Claude Code using the MCP tools!
CLI Commands
claude-gateway # Start the proxy server
claude-gateway start # Start the proxy server
claude-gateway mcp # Start MCP server (for Claude Code integration)
claude-gateway status # Show current status
claude-gateway providers # List all providers
claude-gateway switch <id> # Switch active provider
claude-gateway key <id> <k> # Set provider API key
claude-gateway help # Show helpMCP Tools (inside Claude Code)
Once configured as an MCP server, these tools are available inside Claude Code:
list_providers— Show all providers and their statusswitch_provider— Switch to a different providerlist_models— List models for a providerswitch_model— Change the active modelset_api_key— Configure a provider's API keygateway_status— Check gateway status
Configuration
Config is stored at ~/.claude-gateway/config.json:
{
"activeProvider": "openai",
"activeModel": "gpt-4o",
"port": 4747,
"providers": {
"openai": {
"apiKey": "sk-...",
"defaultModel": "gpt-4o"
},
"gemini": {
"apiKey": "AIza..."
}
}
}You can also use environment variables (OPENAI_API_KEY, GEMINI_API_KEY, etc.) instead of storing keys in config.
How it works
- Claude Code sends a
POST /v1/messagesrequest (Anthropic format) - The gateway translates the request to the active provider's API format
- The provider processes the request and returns a response
- The gateway translates the response back to Anthropic format
- Claude Code receives a response it understands
For streaming requests, the gateway converts provider-specific SSE events into Anthropic's message_start → content_block_delta → message_stop event sequence.
License
MIT
