24.4K stars! Manage the world's mainstream AI models with one click. This open source API gateway is amazing!

One-click deployment of global AI models, a new benchmark for enterprise-level AI management!
Core content:
1. Unified access to 18+ mainstream AI models to solve the three major pain points of enterprise-level applications
2. Core function highlights: full model access, intelligent routing, cost control, enterprise-level security
3. Technical architecture analysis: high-performance concurrency, enterprise-level management experience, fast deployment, multi-database support
One API
It is the most powerful AI model API management platform. Developers only need to deploy one service to uniformly access 18+ mainstream AI models such as OpenAI, Azure, Claude, Gemini, etc. It solves the three major pain points in enterprise-level applications:
Key management chaos : centrally manage all your API keys Difficulty in cost control : Intelligent allocation of request channels Complex system connection : unified and standardized API interface
# Typical deployment commands (Docker version)
docker run --name one-api -d --restart always \
-p 3000:3000 -e TZ=Asia/Shanghai \
-v /home/ubuntu/data/one-api:/data \
justsong/one-api
Core Features Highlights
Unified access to all models
Support includes:
International giants : OpenAI GPT-4o, Google Gemini Pro Domestic large models : Wenxin Yiyan, iFlytek Spark Open source upstarts : ChatGLM, DeepSeek Industry-specific : ByteDance, Tencent Hunyuan
Intelligent routing engine
// Configuration example for automatically selecting the optimal channel
{
"strategy" : "weighted-random" , // weighted random
"retry" : 3 , // Number of failed retries
"timeout" : 30 // Timeout (seconds)
}
Accurate cost control
Dynamically calculate token consumption (supports 2x completion rate of GPT-4) Multi-dimensional statistical reports (user/channel/model dimensions) Real-time usage warning (email/webhook notification)
Enterprise-grade security
# Security Configuration Example
MEMORY_CACHE_ENABLED=true # Enable cache acceleration
GLOBAL_API_RATE_LIMIT=300 # Single IP request limit per minute
RELAY_PROXY=http://proxy:8080 # Enterprise-level proxy support
? Scalable architecture
## Technical architecture analysis
| Components | Technology Selection | Advantages |
|-----------------|---------------------|----------------------------|
| Core framework | Golang | High performance concurrent processing |
| Front-end interface | React + Ant Design | Enterprise-level management experience |
| Deployment plan | Docker single file | 5 minutes quick deployment |
| Database support | SQLite/MySQL | Lightweight and high availability, free choice |
| Cache mechanism | Memory cache + batch update | Throughput increased by 300% |
| Monitoring system | Prometheus + built-in indicators | Real-time channel health detection |
## Six application scenarios
1. **SaaS product development**: Rapid integration of multi-model capabilities
2. **Enterprise internal system**: unified management of AI resources
3. Educational and scientific research institutions: flexible allocation of computing resources
4. **Developer Studio**: Reduce API call costs
5. AI Application Market: Building a Model Distribution Platform
6. **Cross-border business system**: intelligent switching of regional nodes

## Comparison of similar projects
| Project Name | Core Advantages | Limitations | Applicable Scenarios |
|---------------|-------------------------|-------------------------|----------------------|
| **One API** | Supports the most models/easiest to deploy | Technical interface | Enterprise-level API gateway |
| LobeChat | Excellent interactive experience | Only supports basic models | Individual developers |
| FastGPT | Powerful knowledge base | Depends on specific cloud services | Intelligent customer service system |
| API Gateway | General API Management | No AI-specific optimization | Traditional microservice architecture |
## Actual combat case demonstration
**Scenario**: E-commerce customer service system needs to use GPT-4 and Wenxinyiyan at the same time
```Python
# Unified call example
import requests
def ask_ai(prompt):
url = "https://api.yourcompany.com/v1/chat/completions"
headers = { "Authorization" : "Bearer sk-xxxx" }
data = {
"model" : "gpt-4" , # Automatically route to available channels
"messages" : [{ "role" : "user" , "content" : prompt}]
}
response = requests.post(url, json=data, headers=headers)
return response.json()
Project Deployment Guide
Basic deployment (suitable for individual developers)
# Quick Start with SQLite
./one-api --port 3000 -- log -dir ./logs
Enterprise-level deployment (high availability solution)
# docker-compose-pro.yml
version: '3'
services:
one-api:
image: justsong/one-api
environment:
- DATABASE_URL=mysql://user:pass@db:3306/oneapi
- MEMORY_CACHE_ENABLED=true
ports:
- "3000:3000"
depends_on:
-db
db:
image: mysql:8.0
environment:
- MYSQL_ROOT_PASSWORD=securepassword
Ecosystem expansion recommendation
FastGPT : A knowledge base system based on a large model ChatGPT-Next-Web : Cross-platform client VChart : Intelligent visualization solution CherryStudio : Enterprise-level AI development platform