llm-proxy

module
v0.0.0-...-ce1014b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: Apache-2.0

README

llm-proxy - All-in-one AI Development Platform

Use any SDK. Access any model. Zero code changes.


❤️ Sponsor

Atlas Cloud
Atlas Cloud

Atlas Cloud is a full-modal AI inference platform that gives developers a single AI API to access video generation, image generation, and LLM APIs. Instead of managing multiple vendor integrations, you connect once and get unified access to 300+ curated models across all modalities.

Check out Atlas Cloud's new coding plan promotion for more budget-friendly API access.

Krill AI
Krill AI

Thank you to Krill AI for sponsoring this project. Krill provides official, stable, high-speed API relay services for GPT, Claude, Gemini, and a wide range of Chinese models, with enterprise customization, invoicing support, and dedicated technical support 16 hours a day, 7 days a week. Its optimized WebSocket connection can deliver a faster time to first token.

Register through this link and enter the llm-proxy coupon code when topping up to receive 23% off your first Codex plan purchase.


Sponsor Description
Bloome
Bloome
Try llm-proxy with zero local setup on Bloome: Quick start, one click from your browser or phone, easy to share with your team.


📖 Project Introduction

All-in-one AI Development Platform

llm-proxy is the AI gateway that lets you switch between model providers without changing a single line of code.

Whether you're using OpenAI SDK, Anthropic SDK, or any AI SDK, llm-proxy transparently translates your requests to work with any supported model provider. No refactoring, no SDK swaps—just change a configuration and you're done.

What it solves:

  • 🔒 Vendor lock-in - Switch from GPT-4 to Claude or Gemini instantly
  • 🔧 Integration complexity - One API format for 10+ providers
  • 📊 Observability gap - Complete request tracing out of the box
  • 💸 Cost control - Real-time usage tracking and budget management
llm-proxy Architecture

Core Features
Feature What You Get
🔄 Any SDK → Any Model Use OpenAI SDK to call Claude, or Anthropic SDK to call GPT. Zero code changes.
🔍 Full Request Tracing Complete request timelines with thread-aware observability. Debug faster.
🔐 Enterprise RBAC Fine-grained access control, usage quotas, and data isolation.
Smart Load Balancing Auto failover in <100ms. Always route to the healthiest channel.
💰 Real-time Cost Tracking Per-request cost breakdown. Input, output, cache tokens—all tracked.

📚 Documentation

For detailed technical documentation, API references, architecture design, and more:


🎯 Demo

Try llm-proxy live at our demo instance!

Note:The demo instance currently configures Zhipu and OpenRouter free models.

Demo Account

⭐ Features

📸 Screenshots

Here are some screenshots of llm-proxy in action:

System Dashboard
System Dashboard
Channel Management
Channel Management
Model Price
Model Price
Models
Models
Trace Viewer
Trace Viewer
Request Monitoring
Request Monitoring

🚀 API Types
API Type Status Description Document
Text Generation ✅ Done Conversational interface OpenAI API, Anthropic API, Gemini API
Image Generation ✅ Done Image generation Image Generation
Rerank ✅ Done Results ranking Rerank API
Embedding ✅ Done Vector embedding generation Embedding API
Realtime 📝 Todo Live conversation capabilities -

🤖 Supported Providers
Provider Status Supported Models Compatible APIs
OpenAI ✅ Done GPT-4, GPT-4o, GPT-5, etc. OpenAI, Anthropic, Gemini, Embedding, Image Generation
Anthropic ✅ Done Claude 3.5, Claude 3.0, etc. OpenAI, Anthropic, Gemini
Zhipu AI ✅ Done GLM-4.5, GLM-4.5-air, etc. OpenAI, Anthropic, Gemini
Moonshot AI (Kimi) ✅ Done kimi-k2, etc. OpenAI, Anthropic, Gemini
DeepSeek ✅ Done DeepSeek-V3.1, etc. OpenAI, Anthropic, Gemini
ByteDance Doubao ✅ Done doubao-1.6, etc. OpenAI, Anthropic, Gemini, Image Generation
Gemini ✅ Done Gemini 2.5, etc. OpenAI, Anthropic, Gemini, Image Generation
Fireworks ✅ Done MiniMax-M2.5, GLM-5, Kimi K2.5, etc. OpenAI
Jina AI ✅ Done Embeddings, Reranker, etc. Jina Embedding, Jina Rerank
OpenRouter ✅ Done Various models OpenAI, Anthropic, Gemini, Image Generation
ZAI ✅ Done - Image Generation
AWS Bedrock 🔄 Testing Claude on AWS OpenAI, Anthropic, Gemini
Google Cloud 🔄 Testing Claude on GCP OpenAI, Anthropic, Gemini
NanoGPT ✅ Done Various models, Image Gen OpenAI, Anthropic, Gemini, Image Generation

🚀 Quick Start

30-Second Local Start
# Download and extract (macOS ARM64 example)
curl -sSL https://github.com/mutallipp/llm-proxy/releases/latest/download/llm-proxy_darwin_arm64.tar.gz | tar xz
cd llm-proxy_*

# Run with SQLite (default)
./llm-proxy

# Open http://localhost:8090
# First run: Follow the setup wizard to initialize the system (create admin account, password must be at least 6 characters)

That's it! Now configure your first AI channel and start calling models through llm-proxy.

Zero-Code Migration Example

Your existing code works without any changes. Just point your SDK to llm-proxy:

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8090/v1",  # Point to llm-proxy
    api_key="your-llm-proxy-api-key"        # Use llm-proxy API key
)

# Call Claude using OpenAI SDK!
response = client.chat.completions.create(
    model="claude-3-5-sonnet",  # Or gpt-4, gemini-pro, deepseek-chat...
    messages=[{"role": "user", "content": "Hello!"}]
)

Switch models by changing one line: model="gpt-4"model="claude-3-5-sonnet". No SDK changes needed.

1-click Deploy to Render

Deploy llm-proxy with 1-click on Render for free.


🚀 Deployment Guide

💻 Personal Computer Deployment

Perfect for individual developers and small teams. No complex configuration required.

Quick Download & Run
  1. Download the latest release from GitHub Releases

    • Choose the appropriate version for your operating system:
  2. Extract and run

    # Extract the downloaded file
    unzip llm-proxy_*.zip
    cd llm-proxy_*
    
    # Add execution permissions (only for Linux/macOS)
    chmod +x llm-proxy
    
    # Run directly - default SQLite database
    
    # Install llm-proxy to system
    sudo ./install.sh
    
    # Start llm-proxy service
    ./start.sh
    
    # Stop llm-proxy service
    ./stop.sh
    
  3. Access the application

    http://localhost:8090
    

🖥️ Server Deployment

For production environments, high availability, and enterprise deployments.

Database Support

llm-proxy supports multiple databases to meet different scale deployment needs:

Database Supported Versions Recommended Scenario Auto Migration Links
TiDB Cloud Starter Serverless, Free tier, Auto Scale ✅ Supported TiDB Cloud
TiDB Cloud Dedicated Distributed deployment, large scale ✅ Supported TiDB Cloud
TiDB V8.0+ Distributed deployment, large scale ✅ Supported TiDB
Neon DB - Serverless, Free tier, Auto Scale ✅ Supported Neon DB
PostgreSQL 15+ Production environment, medium-large deployments ✅ Supported PostgreSQL
MySQL 8.0+ Production environment, medium-large deployments ✅ Supported MySQL
SQLite 3.0+ Development environment, small deployments ✅ Supported SQLite
Configuration

llm-proxy uses YAML configuration files with environment variable override support:

# config.yml
server:
  port: 8090
  name: "llm-proxy"
  debug: false

db:
  dialect: "tidb"
  dsn: "<USER>.root:<PASSWORD>@tcp(gateway01.us-west-2.prod.aws.tidbcloud.com:4000)/llm-proxy?tls=true&parseTime=true&multiStatements=true&charset=utf8mb4"

log:
  level: "info"
  encoding: "json"

Environment variables:

LLM_PROXY_SERVER_PORT=8090
LLM_PROXY_DB_DIALECT="tidb"
LLM_PROXY_DB_DSN="<USER>.root:<PASSWORD>@tcp(gateway01.us-west-2.prod.aws.tidbcloud.com:4000)/llm-proxy?tls=true&parseTime=true&multiStatements=true&charset=utf8mb4"
LLM_PROXY_LOG_LEVEL=info

For detailed configuration instructions, please refer to configuration documentation.

Docker Compose Deployment
# Clone project
git clone https://github.com/mutallipp/llm-proxy.git
cd llm-proxy

# Set environment variables
export LLM_PROXY_DB_DIALECT="tidb"
export LLM_PROXY_DB_DSN="<USER>.root:<PASSWORD>@tcp(gateway01.us-west-2.prod.aws.tidbcloud.com:4000)/llm-proxy?tls=true&parseTime=true&multiStatements=true&charset=utf8mb4"

# Start services
docker compose up -d --build --force-recreate

# Check status
docker compose ps
Helm Kubernetes Deployment

Deploy llm-proxy on Kubernetes using the official Helm chart:

# Quick installation
git clone https://github.com/mutallipp/llm-proxy.git
cd llm-proxy
helm install llm-proxy ./deploy/helm

# Production deployment
helm install llm-proxy ./deploy/helm -f ./deploy/helm/values-production.yaml

# Access llm-proxy
kubectl port-forward svc/llm-proxy 8090:8090
# Visit http://localhost:8090

Key Configuration Options:

Parameter Description Default
llm-proxy.replicaCount Replicas 1
llm-proxy.dbPassword DB password llm-proxy_password
postgresql.enabled Embedded PostgreSQL true
ingress.enabled Enable ingress false
persistence.enabled Data persistence false

For detailed configuration and troubleshooting, see Helm Chart Documentation.

Virtual Machine Deployment

Download the latest release from GitHub Releases

# Extract and run
unzip llm-proxy_*.zip
cd llm-proxy_*

# Set environment variables
export LLM_PROXY_DB_DIALECT="tidb"
export LLM_PROXY_DB_DSN="<USER>.root:<PASSWORD>@tcp(gateway01.us-west-2.prod.aws.tidbcloud.com:4000)/llm-proxy?tls=true&parseTime=true&multiStatements=true&charset=utf8mb4"

sudo ./install.sh

# Configuration file check
llm-proxy config check

# Start service
#  For simplicity, we recommend managing llm-proxy with the helper scripts:

# Start
./start.sh

# Stop
./stop.sh

📖 Usage Guide

Unified API Overview

llm-proxy provides a unified API gateway that supports both OpenAI Chat Completions and Anthropic Messages APIs. This means you can:

  • Use OpenAI API to call Anthropic models - Keep using your OpenAI SDK while accessing Claude models
  • Use Anthropic API to call OpenAI models - Use Anthropic's native API format with GPT models
  • Use Gemini API to call OpenAI models - Use Gemini's native API format with GPT models
  • Automatic API translation - llm-proxy handles format conversion automatically
  • Zero code changes - Your existing OpenAI or Anthropic client code continues to work
1. Initial Setup
  1. Access Management Interface

    http://localhost:8090
    
  2. Configure AI Providers

    • Add API keys in the management interface
    • Test connections to ensure correct configuration
  3. Create Users and Roles

    • Set up permission management
    • Assign appropriate access permissions
2. Channel Configuration

Configure AI provider channels in the management interface. For detailed information on channel configuration, including model mappings, parameter overrides, and troubleshooting, see the Channel Configuration Guide.

3. Model Management

llm-proxy provides a flexible model management system that supports mapping abstract models to specific channels and model implementations through Model Associations. This enables:

  • Unified Model Interface - Use abstract model IDs (e.g., gpt-4, claude-3-opus) instead of channel-specific names
  • Intelligent Channel Selection - Automatically route requests to optimal channels based on association rules and load balancing
  • Flexible Mapping Strategies - Support for precise channel-model matching, regex patterns, and tag-based selection
  • Priority-based Fallback - Configure multiple associations with priorities for automatic failover

For comprehensive information on model management, including association types, configuration examples, and best practices, see the Model Management Guide.

4. Create API Keys

Create API keys to authenticate your applications with llm-proxy. Each API key can be configured with multiple profiles that define:

  • Model Mappings - Transform user-requested models to actual available models using exact match or regex patterns
  • Channel Restrictions - Limit which channels an API key can use by channel IDs or tags
  • Model Access Control - Control which models are accessible through a specific profile
  • Profile Switching - Change behavior on-the-fly by activating different profiles

For detailed information on API key profiles, including configuration examples, validation rules, and best practices, see the API Key Profile Guide.

5. AI Coding Tools Integration

See the dedicated guides for detailed setup steps, troubleshooting, and tips on combining these tools with llm-proxy model profiles:


6. SDK Usage

For detailed SDK usage examples and code samples, please refer to the API documentation:

🛠️ Development Guide

For detailed development instructions, architecture design, and contribution guidelines, please see docs/en/development/development.md.

本地开发 vs 生产部署
场景 端口 配置文件 数据库 启动命令
prod(生产) 8090 docker-compose.yml + .env llm-proxy make start / make stop / make restart / make logs
dev(本地开发) 后端 18090、前端 15173 docker-compose.dev.yml + .env.dev + .env.dev.local llm-proxy-dev(独立库) make dev-up / make dev-frontend / make dev-down

dev 与 prod 状态完全隔离:dev DB 库名为 llm-proxy-dev(独立 PostgreSQL 库),dev 容器名为 llm-proxy-dev,互不冲突。.env.dev 是可提交的默认配置;首次运行前,在被 Git 忽略的 .env.dev.local 写入完整 LLM_PROXY_DB_DSN。如需以线上库的最新表结构初始化 dev 库,执行 make dev-db-sync-schema:它同步表、索引、约束与序列,但不会复制业务数据、API Key、OAuth token 或渠道 Cookie;dev 库非空时会拒绝执行,避免误覆盖开发数据。需要完整复刻线上数据时,执行 make dev-db-sync-full:它会先停止 dev、销毁并重建 dev DB,再导入完整 prod 快照,包括 API Key、OAuth token 与渠道 Cookie,且会覆盖现有 dev 数据

环境变量已统一为 LLM_PROXY_* 前缀(旧 AXONHUB_* 已彻底移除)。常见字段:

LLM_PROXY_DB_DSN          # 数据库连接串
LLM_PROXY_DB_DIALECT      # postgres | sqlite | mysql | tidb
LLM_PROXY_SERVER_PORT     # 监听端口
LLM_PROXY_SERVER_HOST     # 监听地址
LLM_PROXY_LOG_LEVEL       # debug | info | warn | error
LLM_PROXY_HTTP_PROXY      # 出口代理(可选)

完整配置字段见 conf/conf.goconfig.example.yml


🤝 Acknowledgments


📄 License

This project is licensed under multiple licenses (Apache-2.0 and LGPL-3.0). See LICENSE file for the detailed licensing overview and terms.


llm-proxy - All-in-one AI Development Platform, making AI development simpler

🏠 Homepage📚 Documentation🐛 Issue Feedback

Built with ❤️ by the llm-proxy team

Directories

Path Synopsis
cmd
llm-proxy command
internal
authz
Package authz implements the Ent Privacy governance mechanism, providing controlled privacy bypass and a single-principal authorization model.
Package authz implements the Ent Privacy governance mechanism, providing controlled privacy bypass and a single-principal authorization model.
dumper
Package dumper for internal debug use only.
Package dumper for internal debug use only.
ent
log
objects
Package objects contains some objects need used by schema and biz.
Package objects contains some objects need used by schema and biz.
pkg/xcache/live
Package live provides a generic in-memory cache that automatically refreshes its data periodically or on demand using polling mechanism.
Package live provides a generic in-memory cache that automatically refreshes its data periodically or on demand using polling mechanism.
pkg/xcache/redis
Package redis is a generated GoMock package.
Package redis is a generated GoMock package.
pkg/xurl
Package xurl provides utilities for URL parsing and manipulation.
Package xurl provides utilities for URL parsing and manipulation.
server/biz/racetest
Package racetest holds opt-in, build-tagged integration tests that need a real concurrent database (PostgreSQL, MySQL, or TiDB).
Package racetest holds opt-in, build-tagged integration tests that need a real concurrent database (PostgreSQL, MySQL, or TiDB).
server/gql/qb
Package qb provides database utilities and query builders for llm-proxy.
Package qb provides database utilities and query builders for llm-proxy.
server/gqlgen command
llm module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL