by FalihPrada
Claude Code Gateway for Kimi, GLM, DeepSeek, and OpenRouter
# Add to your Claude Code skills
git clone https://github.com/FalihPrada/claude-code-gatewayGuides for using api integration skills like claude-code-gateway.
See how claude-code-gateway compares with popular alternatives.
claude-code-gateway is an open-source api integration skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by FalihPrada. Claude Code Gateway for Kimi, GLM, DeepSeek, and OpenRouter. It has 89 GitHub stars.
claude-code-gateway's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/FalihPrada/claude-code-gateway" and add it to your Claude Code skills directory (see the Installation section above).
claude-code-gateway is primarily written in Python. It is open-source under FalihPrada on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other API Integration skills you can browse and compare side by side. Open the API Integration category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-code-gateway against similar tools.
No comments yet. Be the first to share your thoughts!
Top skills in this category by stars
Available after the catalog security scan passes.
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
Free-Claude-Code-Gateway is a TypeScript proxy that lets the Claude Code CLI and any Anthropic-compatible client operate against OpenAI-compatible providers such as Kimi, GLM, DeepSeek, and OpenRouter. It accepts Anthropic Messages API requests, converts them to OpenAI format, forwards them to your configured upstream endpoint, and translates responses back with full streaming and bidirectional tool-calling support. Model mappings resolve through exact matches, glob-based family rules, and configurable fallbacks, all editable at runtime from the built-in admin dashboard. Request history, configuration overrides, and routing rules persist across restarts, and every route is designed to run locally or in containers without an Anthropic API key.
POST /v1/messages — Full Anthropic Messages API compatibility. Validates, maps, converts, and returns responses in the exact shape Claude Code expects, including streaming.POST /v1/chat/completions — OpenAI-compatible passthrough with server-side key injection, so downstream clients never handle upstream credentials.GET /v1/models — Enumerates available models from the configured upstream provider in real time.tools / tool_use / tool_result ↔ OpenAI tools / tool_calls, plus full request and response body conversion in both directions.message_start, content_block_*, message_delta, and message_stop events matching the Anthropic streaming contract.The gateway operates as a protocol translator sitting between Anthropic-compatible clients and OpenAI-compatible providers. Every incoming request hits the Express server, which validates the payload against the Anthropic Messages API schema before any upstream call is made.
Request translation. For POST /v1/messages, the gateway parses the Anthropic request body — model, messages, system, max_tokens, tools, tool_choice, and sampling parameters — and rewrites it into the OpenAI chat-completions shape. System prompts are hoisted into a leading system role message. Content blocks are flattened: text blocks pass through, tool_use blocks become tool_calls, and tool_result blocks become tool role messages. The mapped provider model ID is substituted for the incoming Claude model name.
Model resolution. Before translation, the router resolves the requested Claude model through a deterministic chain: exact mapping first, then glob-based family rules (Opus, Sonnet, Haiku, default wildcard), then pass-through when strict mode is off, and finally the configured fallback model. Mappings live in config/models.json and can be edited live from the Model Router view without a restart.
Streaming. When stream: true is present, the gateway opens an SSE connection to the upstream and re-emits the OpenAI delta stream as Anthropic events: message_start, then content_block_start, content_block_delta for each text or tool-call fragment, content_block_stop, message_delta carrying stop reason and usage, and message_stop. Chunk boundaries are buffered so partial JSON tool arguments are never emitted mid-fragment.
Tool calling. Anthropic tools definitions are converted to OpenAI function schemas with JSON Schema parameters preserved. On the return path, tool_calls arrays are reassembled from streamed fragments into discrete tool_use content blocks with parsed input objects. Stop reasons map between the two vocabularies (tool_use ↔ tool_calls, max_tokens, end_turn ↔ stop).
Resilience. Every upstream route runs behind a circuit breaker. Consecutive failures trip the breaker open and reroute traffic to the configured fallback model without waiting on timeouts. If an upstream accepts streaming requests but returns malformed deltas, the gateway retrieves the non-streaming response and synthesizes the expected SSE sequence so the client sees a valid stream. The breaker probes failed routes in a half-open state and restores them once healthy responses resume.
Observability. Each request is logged to .blueclaude-data/request-log.json with a bounded ring buffer, and the Live Requests view streams the same events over SSE. Authorization headers and provider keys are redacted at the logging boundary, so the persisted history never contains credentials. Runtime configuration changes made through the admin API are written to config-overrides.json and applied to the in-memory config on the next request.
The gateway targets the Anthropic Messages API surface, so any client that speaks that protocol can use it without modification. This includes the Claude Code CLI, VS Code extensions such as Cline and Roo Code, Continue.dev, Aider, and general OpenAI-style clients like LibreChat, Open WebUI, and LobeChat.
On the upstream side, compatibility is defined by the OpenAI-compatible chat completions contract. Any endpoint that implements POST /v1/chat/completions and GET /v1/models with bearer-token auth can serve as a provider. That covers hosted services including Kimi, GLM, DeepSeek, OpenRouter, Mistral, Fireworks AI, Cerebras, Groq, and Databricks, plus local runtimes such as LM Studio, Ollama, vLLM, and llama.cpp.
Model identity is resolved through the router rather than hardcoded, so Claude model names are mapped to provider model IDs via exact matches, glob-based family rules, pass-through, or the configured default. Streaming is supported end to end: the gateway translates Anthropic SSE events (message_start, content_block_*, message_delta, message_stop) to and from OpenAI-style chunks, and synthesizes a stream when an upstream only supports non-streaming responses. Tool calling is translated bidirectionally between Anthropic tools/tool_use/tool_result and OpenAI tools/tool_calls.
Runtime requirements are Node.js 20 or newer. The gateway itself is provider-agnostic and stateless with respect to the model backend — swapping providers requires only configuration changes, not code changes.
The gateway is driven by environment variables and a small set of runtime-configurable settings. Every value below can be supplied at process start via .env, overridden at runtime through the Admin Dashboard, and reloaded without a restart unless noted otherwise.
| Variable | Required | Default | Description |
|---|---|---|---|
GATEWAY_API_KEY |
yes | — | Upstream provider API key used for outbound requests |
GATEWAY_BASE_URL |
no | — | Base URL of the upstream provider endpoint |
PORT |
no | 8787 |
Port the gateway binds to |
DEFAULT_MODEL |
no | — | Fallback target when no routing rule matches |
STRICT_MODEL_MAPPING |
no | false |
When true, unmatched models are rejected with a 400 instead of passed through |
PROXY_API_KEY |
no | — | When set, requires Authorization: Bearer <key> on all proxy routes |
ADMIN_PASSWORD |
no | — | Enables HTTP Basic auth for /admin and its API surface |
REQUEST_TIMEOUT_MS |
no | 120000 |
Upstream request timeout in milliseconds |
MAX_RETRIES |
no | 2 |
Retry attempts per upstream call before fallback engages |
CORS_ORIGINS |
no | * |
Comma-separated list of allowed orig |