Open Source Gateway

Free Claude Code Gateway

Run Claude Code CLI for free — route requests through DeepSeek, Kimi, GLM, Groq, or any OpenAI-compatible provider. No Anthropic subscription needed.

One Endpoint. Any Provider. Claude Code Compatible.
┌─────────────────┐     ┌─────────────┐     ┌──────────────┐
│  Claude Code CLI │────▶│   Gateway   │────▶│   Provider   │
│  (Anthropic API) │◀────│ :8787       │◀────│  (OpenAI API)│
└─────────────────┘     └─────────────┘     └──────────────┘
MIT License Node.js 20+

What You Get

Anthropic API Compatible

Drop-in replacement at POST /v1/messages. Zero client changes required.

OpenAI Passthrough

Native POST /v1/chat/completions support for OpenAI-compatible clients.

Smart Model Routing

Glob pattern family rules map claude-3-* to your chosen provider model.

Full Streaming SSE

Real-time token streaming with Server-Sent Events, fully proxied.

Tool Calling Support

Function calling and tool use fully translated between API formats.

Admin Dashboard

Built-in web UI at /admin to monitor requests and configure routing.

No Database Required

Stateless design with flat-file persistence. No setup, no migrations.

Docker & PM2 Ready

Production deployment with Docker Compose or PM2 process manager.

TypeScript Express Node.js 20+

How It Works

  1. Install & configure the Gateway locally
  2. Set the base URL ANTHROPIC_BASE_URL=http://localhost:8787 in your tool
  3. The Gateway translates your Claude API request to OpenAI format
  4. Your chosen Provider processes the request
  5. The Gateway proxies the response back to Anthropic format
Claude Code
Anthropic format
Gateway
:8787
Provider
OpenAI format

Supported Providers

Kimi (MoonShot)

https://api.moonshot.cn/v1

moonshot-v1-8k, moonshot-v1-32k

GLM / Z.ai

https://open.bigmodel.cn/api/paas/v4

glm-4, glm-4-flash (free tier)

DeepSeek

https://api.deepseek.com/v1

deepseek-chat, deepseek-coder

OpenRouter

https://openrouter.ai/api/v1

100+ models, unified billing

Mistral

https://api.mistral.ai/v1

mistral-large, codestral

Fireworks AI

https://api.fireworks.ai/inference/v1

Fast inference, Llama 3

Cerebras

https://api.cerebras.ai/v1

Ultra-fast Llama 3 inference

Groq

https://api.groq.com/openai/v1

Fastest free tier available

LM Studio

http://localhost:1234/v1

Local models, privacy-first

Ollama

http://localhost:11434/v1

Self-hosted, 100% offline

Works with any OpenAI-compatible API endpoint — self-hosted, vLLM, llama.cpp, and more.

Quick Start

1. Clone the repository

git clone https://github.com/rajakumar865465/Free-Claude-Code-Gateway.git

2. Install dependencies

cd Free-Claude-Code-Gateway && npm install

3. Configure environment

cp .env.example .env

4. Start the gateway

npm run dev

5. Configure Claude Code CLI

export ANTHROPIC_BASE_URL=http://localhost:8787
export ANTHROPIC_MODEL=claude-3-5-sonnet-20241022
claude

The gateway starts at http://localhost:8787. Point any Claude-compatible tool at it.

Frequently Asked Questions

Can I use Claude Code for free?
Yes. This open-source gateway translates Claude Code CLI requests to OpenAI format and forwards them to a free provider like DeepSeek, Groq, GLM, or Kimi — all of which offer free tiers.
Do I need an Anthropic API key?
No. You point Claude Code at the local gateway (http://localhost:8787) instead of Anthropic's servers. The gateway uses your chosen provider's API key, not Anthropic's.
Which AI providers are supported?
Any OpenAI-compatible endpoint works: DeepSeek, Kimi (MoonShot), GLM/Z.ai, OpenRouter, Groq, Mistral, Fireworks AI, Cerebras, LM Studio, Ollama, and vLLM.
Is this legal and does it violate Anthropic's terms?
The gateway is a standard API format converter — it does not bypass, crack, or circumvent any Anthropic system. You are responsible for complying with both Anthropic's and your upstream provider's terms of service.
Does it support streaming and tool use?
Yes. The gateway fully proxies Server-Sent Events (SSE) for real-time token streaming and translates tool/function calling between Anthropic and OpenAI formats.

Responsible Use

This gateway does not bypass, crack, or circumvent Anthropic's systems. It is a standard API format converter — the same thing any OpenAI-compatible client library does.

You are responsible for complying with the terms of service of both Anthropic and your chosen upstream provider.

💙 Buy Claude Code — Support Anthropic

If this gateway is useful and you can afford it — please support Anthropic and buy Claude Code. It's the right thing to do.

Not affiliated with or endorsed by Anthropic. Claude® is a trademark of Anthropic, PBC.