claude-code-proxy  by 1rgs

API proxy for using Anthropic clients with other backends

created 4 months ago
1,675 stars

Top 25.8% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This project provides a proxy server that allows users of Anthropic's API clients, such as Claude Code, to leverage models from OpenAI and Google Gemini. It's designed for developers and researchers who want to use familiar Anthropic client interfaces with alternative, potentially more cost-effective or performant, LLM backends.

How It Works

The proxy intercepts requests formatted for the Anthropic API and translates them into the appropriate format for either OpenAI or Google Gemini using the LiteLLM library. It then forwards the request to the chosen backend, receives the response, and converts it back into the Anthropic API format before returning it to the client. This approach enables seamless integration with existing Anthropic-compatible tools.

Quick Start & Requirements

  • Install dependencies using uv: uv run uvicorn server:app --host 0.0.0.0 --port 8082 --reload
  • Prerequisites: OpenAI API key, Google AI Studio (Gemini) API key (if using Gemini), uv installed.
  • Configuration: Set API keys and preferred provider (openai or google) via .env file.
  • Usage: Set ANTHROPIC_BASE_URL=http://localhost:8082 and use Anthropic clients.

Highlighted Details

  • Maps Claude haiku and sonnet models to specified OpenAI or Gemini models.
  • Supports automatic model prefixing (openai/ or gemini/).
  • Handles both streaming and non-streaming responses.
  • Configurable via environment variables for backend preference and specific model mapping.

Maintenance & Community

Contributions are welcome via Pull Requests. No specific community channels or contributor information is detailed in the README.

Licensing & Compatibility

The repository does not explicitly state a license. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The project does not specify a license, which may impact commercial adoption. Detailed information on supported Gemini models beyond the defaults is not provided, and the project appears to be primarily focused on OpenAI and Gemini as backends.

Health Check
Last commit

3 months ago

Responsiveness

Inactive

Pull Requests (30d)
3
Issues (30d)
6
Star History
1,168 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.