ClaudeProxy

Multi-provider reverse proxy, payload sanitizer, and request router for Claude Code

TypeScriptTypeScriptNode.jsNode.jsREST APIsREST APIsServer-Sent EventsServer-Sent EventsOpenAI APIGoogle GeminiGoogle GeminiGitHub CopilotGitHub Copilot
Target Wire API
Anthropic /v1/messages
Routing Overhead
< 5ms Proxy Translation
Supported Backends
OpenAI, Gemini, Copilot, Ollama

Overview

ClaudeProxy is an API routing proxy built for developers running Claude Code and terminal AI agent workflows.

By setting Claude Code’s base URL endpoint to http://localhost:8082, developers can route requests to any upstream provider (Anthropic, Google Gemini via Antigravity, OpenAI GPT-4o, GitHub Copilot, DeepSeek, or local Ollama instances) without breaking agentic tool calling or thinking token headers.

Request Flow & Translation Pipeline

The proxy operates across four stages:

Stage Component Technical Action
1. Client Ingress HTTP Server (0.0.0.0:8082) Accepts Anthropic Messages API requests (/v1/messages, /v1/messages/count_tokens, /v1/models)
2. Reactor Router Rules Engine Categorizes models into reactors (haiku, sonnet, opus, research) and matches provider endpoints
3. Schema Adapter Payload Sanitizer Converts Anthropic message schemas and tool_use/tool_result blocks into OpenAI function calls
4. Stream Transformer SSE Chunk Normalizer Converts downstream token streams into Anthropic SSE wire events (content_block_delta, text_delta)

Key Technical Features

1. Unified Anthropic wire protocol

The proxy exposes standard endpoints defined by the Anthropic API. Claude Code interacts with the proxy transparently without requiring modifications to internal CLI commands.

2. Bidirectional schema translation & sanitization

Different LLM providers require distinct payload formats for message histories, system prompts, and tool calling definitions:

  • Translates Anthropic tool_use and tool_result blocks into standard OpenAI function calling JSON structures.
  • Adapts thinking / reasoning token headers across different model response formats.
  • Repairs malformed tool call JSON from downstream providers before delivering results back to Claude Code.

3. Server-Sent Events (SSE) streaming

The proxy normalizes chunk formats into Anthropic-compatible SSE events (message_start, content_block_start, content_block_delta, message_delta, message_stop), ensuring uninterrupted token rendering inside the terminal CLI.

4. Provider integrations & web management dashboard

  • Google Gemini Bridge: Connects to Gemini 3 Flash/Pro models via Antigravity API (localhost:8081).
  • GitHub Copilot Device Flow: Authenticates via device-code OAuth flow (/api/copilot/login/start) to utilize Copilot subscriptions.
  • Web Dashboard: Includes a web management UI with SVG reactor rings, live provider latency monitoring, and token usage analytics.