claude-code-proxy: Use Anthropic Clients with OpenAI and Gemini Models
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
`claude-code-proxy` is a powerful proxy server that allows developers to use Anthropic clients, such as Claude Code, with various backend models including OpenAI, Gemini, or even Anthropic's own models. It provides seamless translation of API requests and responses, offering flexibility and control over your AI model choices. This tool is ideal for integrating different LLM providers without modifying existing Anthropic client code.
Repository Information
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
claude-code-proxy is an innovative proxy server designed to bridge the gap between Anthropic clients and various large language models (LLMs). This Python-based tool allows you to seamlessly use Anthropic clients, such as Claude Code, with powerful backends like OpenAI, Google Gemini, or even directly with Anthropic's own models, all powered by LiteLLM. It acts as a transparent intermediary, translating API requests and responses to ensure compatibility across different LLM providers.
Installation
Getting claude-code-proxy up and running is straightforward, whether you prefer installing from source or using Docker.
Prerequisites
- An OpenAI API key.
- A Google AI Studio (Gemini) API key (if you plan to use Google as a provider).
- uv installed, a fast Python package installer.
From Source
- Clone the repository:
git clone https://github.com/1rgs/claude-code-proxy.git cd claude-code-proxy - Install uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | shuvwill manage dependencies when the server runs. - Configure Environment Variables:
Copy the example environment file and edit
.envwith your API keys and model preferences.cp .env.example .envKey variables to configure include:
ANTHROPIC_API_KEY: (Optional) For proxying to Anthropic models.OPENAI_API_KEY: Your OpenAI API key.GEMINI_API_KEY: Your Google AI Studio (Gemini) API key.PREFERRED_PROVIDER: Set toopenai(default),google, oranthropic.BIG_MODEL: Model forsonnetrequests (e.g.,gpt-4o,gemini-2.5-pro-preview-03-25).SMALL_MODEL: Model forhaikurequests (e.g.,gpt-4o-mini,gemini-2.0-flash).
- Run the server:
uv run uvicorn server:app --host 0.0.0.0 --port 8082 --reloadThe
--reloadflag is optional, useful for development.
Docker
For a containerized setup, first download the example environment file and configure it:
curl -O .env https://raw.githubusercontent.com/1rgs/claude-code-proxy/refs/heads/main/.env.example
Then, use Docker Compose (recommended) or a direct Docker command.
With Docker Compose:
Create a docker-compose.yml file:
services:
proxy:
image: ghcr.io/1rgs/claude-code-proxy:latest
restart: unless-stopped
env_file: .env
ports:
- 8082:8082
With a Docker command:
docker run -d --env-file .env -p 8082:8082 ghcr.io/1rgs/claude-code-proxy:latest
Examples
Once the proxy server is running, integrating it with your Anthropic clients is simple.
Using with Claude Code
- Install Claude Code (if you haven't already):
npm install -g @anthropic-ai/claude-code - Connect to your proxy:
Set the
ANTHROPIC_BASE_URLenvironment variable to point to your proxy server.ANTHROPIC_BASE_URL=http://localhost:8082 claudeYour Claude Code client will now route requests through
claude-code-proxy, utilizing your configured backend models.
Customizing Model Mapping
claude-code-proxy offers extensive control over how Anthropic models (haiku, sonnet) are mapped to your chosen backend LLMs. This is configured via environment variables in your .env file.
Example 1: Default (Use OpenAI)
OPENAI_API_KEY="your-openai-key"
# GEMINI_API_KEY="your-google-key" # Needed for fallback if PREFERRED_PROVIDER=google
# PREFERRED_PROVIDER="openai" # Optional, it's the default
# BIG_MODEL="gpt-4.1" # Optional, it's the default
# SMALL_MODEL="gpt-4.1-mini" # Optional, it's the default
Example 2: Prefer Google
GEMINI_API_KEY="your-google-key"
OPENAI_API_KEY="your-openai-key" # Needed for fallback
PREFERRED_PROVIDER="google"
# BIG_MODEL="gemini-2.5-pro-preview-03-25" # Optional, it's the default for Google pref
# SMALL_MODEL="gemini-2.0-flash" # Optional, it's the default for Google pref
Example 3: Use Direct Anthropic ("Just an Anthropic Proxy" Mode)
This mode allows you to use the proxy infrastructure while still using actual Anthropic models.
ANTHROPIC_API_KEY="sk-ant-..."
PREFERRED_PROVIDER="anthropic"
# BIG_MODEL and SMALL_MODEL are ignored in this mode
Example 4: Use Specific OpenAI Models
OPENAI_API_KEY="your-openai-key"
PREFERRED_PROVIDER="openai"
BIG_MODEL="gpt-4o" # Example specific model for sonnet
SMALL_MODEL="gpt-4o-mini" # Example specific model for haiku
Why Use claude-code-proxy?
claude-code-proxy provides several compelling advantages for developers working with LLMs:
- Unmatched Flexibility: Easily switch between OpenAI, Gemini, or Anthropic models without altering your client-side code. This allows you to experiment with different providers or leverage specific model strengths.
- Cost Optimization: By mapping Anthropic models to potentially more cost-effective alternatives like
gpt-4o-miniorgemini-2.0-flash, you can significantly reduce API expenses. - Seamless Integration: Maintain your existing Anthropic client workflows, such as those with Claude Code, while benefiting from a wider array of backend LLMs.
- Centralized Control: The proxy acts as a single point of entry, which can be extended for logging, monitoring, rate limiting, or other middleware functionalities.
Links
- GitHub Repository: https://github.com/1rgs/claude-code-proxy
Related repositories
Similar repositories that may be relevant next.

AMD Skills: Empowering AI Agents with AMD's Optimized Software Stack
August 16, 2026
AMD Skills is the official catalog of AI agent skills from AMD, designed to empower AI agents with optimized software for AMD hardware. This repository provides knowledge, scripts, and conventions for working with AMD's stack, enabling seamless integration with major coding agents like Cursor, Claude Code, OpenAI Codex, and Gemini CLI.

agent-tackle-box: A Terminal Debugger for LangGraph & LangChain Agents
August 15, 2026
agent-tackle-box is a comprehensive toolkit for developing AI agents, featuring the powerful `agent-debugger`. This terminal debugger provides deep insights into LangGraph and LangChain agents. It allows developers to inspect state, monitor tool calls, and step through Python code, all within a unified Textual UI.

ADR: Uber's Enterprise Security System for AI Agents
August 14, 2026
ADR (Agentic AI Detection and Response) is an enterprise security system developed by Uber to secure AI agents. It offers critical capabilities like observability, security benchmarking, and threat detection, ensuring the safe operation of both employee and customer-facing AI applications. This open-source project is deployed in production at Uber and was accepted to MLSys 2026.

SkillOpt: Optimizing Self-Evolving Agent Skills for LLMs
August 11, 2026
SkillOpt is an innovative text-space optimizer from Microsoft that enables the training of reusable natural-language skills for frozen LLM agents. It approaches skill development with the rigor of deep-learning optimization, using trajectory-driven edits and validation-gated updates. This results in deployable `best_skill.md` artifacts that significantly boost agent performance across various benchmarks and models without modifying model weights.
Source repository
Open the original repository on GitHub.
18 counted GitHub visits