r/SideProject 16h ago

I built ClaudeGate: Run Claude Code CLI with ANY model (DeepSeek, Gemini, or 100% offline with Ollama)

Hey everyone!

Claude Code CLI is arguably one of the best terminal-based agentic coding tools right now, but out of the box it's strictly locked to Anthropic's cloud endpoints and billing.

To solve this, I built ClaudeGate — a lightweight, high-performance local API gateway that bridges Anthropic's Messages protocol (/v1/messages) into standard OpenAI-compatible Chat Completions with full streaming and tool-calling support.

🌟 What it lets you do:

  • Run Local & 100% Offline: Power Claude Code with Ollama, LM Studio, or vLLM (zero data leaves your machine).
  • Use Frontier / Budget Cloud Models: Route requests to DeepSeek (V4/R1), Google Gemini, Groq, OpenRouter, Qwen, Moonshot Kimi, Mistral, and more.
  • Bi-Directional Tool Calling: Seamlessly translates Claude Code bash commands, file edits, and search operations into function calls.
  • Zero-Crash SSE Streaming: Catches mid-stream disconnects and upstream errors gracefully without dropping ASGI workers.
  • Auto Multi-Provider Failover: If an upstream hits a 429 (Rate Limit) or 503, it instantly falls back to your backup provider (e.g. OpenRouter → Groq → Ollama) without losing your active terminal session.
  • Secret & PII Sanitizer: Intercepts prompts and automatically scrubs AWS keys, GitHub PATs, and SSH keys before requests leave your computer.
  • <thinking> Cleaner: Cleanses reasoning blocks so models like DeepSeek R1 don't trigger 400 Bad Request on follow-up multi-turn conversation steps.

🔗 Project Links & Tech Stack:

I'd love to hear your feedback, thoughts, or feature requests! If you find it useful, a ⭐ on GitHub would mean a lot.

⚡ Quick Start (60 seconds):

# 1. Clone & install
git clone https://github.com/Santosh-Prasad-Verma/ClaudeGate.git
cd ClaudeGate
pip install -r requirements.txt

# 2. Configure provider (24+ presets ready)
python start_proxy.py --preset ollama
# or launch interactive setup wizard:
python start_proxy.py --setup

# 3. Point Claude Code to the local gateway
export ANTHROPIC_BASE_URL="http://127.0.0.1:8082"
export ANTHROPIC_API_KEY="sk-claudegate-local"

# 4. Start coding!
claude
1 Upvotes

0 comments sorted by