Sign inSign up

legard/claude-code-proxy

By legard

Updated 8 months ago

Proxy server enabling Claude Code CLI to work with OpenAI-compatible API providers

Image
Developer tools
0

1.5K

legard/claude-code-proxy repository overview

Claude Code Proxy

A proxy server that enables Claude Code CLI to work with OpenAI-compatible API providers. Convert Claude API requests to OpenAI API calls, allowing you to use various LLM providers (OpenAI, Azure OpenAI, local models) through the Claude Code interface.

Features

  • Full Claude API compatibility (/v1/messages endpoint)
  • Multiple provider support (OpenAI, Azure OpenAI, Ollama, any OpenAI-compatible API)
  • Smart model mapping via environment variables
  • Complete tool use/function calling support
  • Streaming responses with SSE
  • Image input support (base64 encoded)
  • Custom HTTP headers injection

Quick Start

docker run -d \
  --name claude-proxy \
  -p 8082:8082 \
  -e OPENAI_API_KEY="your-openai-key" \
  -e BIG_MODEL="gpt-4o" \
  -e SMALL_MODEL="gpt-4o-mini" \
  legard/claude-code-proxy:latest

Or with docker-compose:

services:
  proxy:
    image: legard/claude-code-proxy:latest
    ports:
      - "8082:8082"
    env_file:
      - .env

Configuration

Required environment variables:

  • OPENAI_API_KEY - Your API key for the target provider

Optional configuration:

  • BIG_MODEL - Model for Claude Opus requests (default: gpt-4o)
  • SMALL_MODEL - Model for Claude Haiku requests (default: gpt-4o-mini)
  • OPENAI_BASE_URL - Custom API endpoint for OpenAI-compatible providers
    • Default: https://api.openai.com/v1
    • Examples:
      • Azure OpenAI: https://YOUR_RESOURCE.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT
      • Ollama: http://localhost:11434/v1
      • Other compatible APIs: Any OpenAI-compatible endpoint

See full configuration guide

Use with Claude Code

ANTHROPIC_BASE_URL=http://localhost:8082 claude

Supported Platforms

  • linux/amd64
  • linux/arm64

Tag summary

Content type

Image

Digest

sha256:647602f78

Size

191.8 MB

Last updated

8 months ago

docker pull legard/claude-code-proxy