$ -weight: 500;">docker pull justsong/one-api
-weight: 500;">docker run -d ---weight: 500;">restart always \\ --name one-api \\ -p 3000:3000 \\ -v /data/one-api:/data \\ justsong/one-api
-weight: 500;">docker pull justsong/one-api
-weight: 500;">docker run -d ---weight: 500;">restart always \\ --name one-api \\ -p 3000:3000 \\ -v /data/one-api:/data \\ justsong/one-api
-weight: 500;">docker pull justsong/one-api
-weight: 500;">docker run -d ---weight: 500;">restart always \\ --name one-api \\ -p 3000:3000 \\ -v /data/one-api:/data \\ justsong/one-api
# Login
-weight: 500;">curl -X POST http://localhost:3000/api/user/login \\ -H 'Content-Type: application/json' \\ -d '{"username":"root", "password": "***"}' # Add channel
-weight: 500;">curl http://localhost:3000/api/channel/ \\ -X POST \\ -H 'Content-Type: application/json' \\ -d '{ "name": "Aliyun Bailian", "type": 41, "key": "sk-your-bailian-key", "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1", "models": "qwen-plus,qwen-turbo" }'
# Login
-weight: 500;">curl -X POST http://localhost:3000/api/user/login \\ -H 'Content-Type: application/json' \\ -d '{"username":"root", "password": "***"}' # Add channel
-weight: 500;">curl http://localhost:3000/api/channel/ \\ -X POST \\ -H 'Content-Type: application/json' \\ -d '{ "name": "Aliyun Bailian", "type": 41, "key": "sk-your-bailian-key", "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1", "models": "qwen-plus,qwen-turbo" }'
# Login
-weight: 500;">curl -X POST http://localhost:3000/api/user/login \\ -H 'Content-Type: application/json' \\ -d '{"username":"root", "password": "***"}' # Add channel
-weight: 500;">curl http://localhost:3000/api/channel/ \\ -X POST \\ -H 'Content-Type: application/json' \\ -d '{ "name": "Aliyun Bailian", "type": 41, "key": "sk-your-bailian-key", "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1", "models": "qwen-plus,qwen-turbo" }'
from openai import OpenAI client = OpenAI( api_key="your-one-api-token", base_url="http://your-server:3000/v1"
) response = client.chat.completions.create( model="qwen-plus", messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
from openai import OpenAI client = OpenAI( api_key="your-one-api-token", base_url="http://your-server:3000/v1"
) response = client.chat.completions.create( model="qwen-plus", messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
from openai import OpenAI client = OpenAI( api_key="your-one-api-token", base_url="http://your-server:3000/v1"
) response = client.chat.completions.create( model="qwen-plus", messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content) - Single endpoint for all major LLM providers
- Load balancing and failover between models
- Token quota management per user/group
- Usage analytics and cost tracking - Disable open registration — turn off public signups
- Enable CORS restrictions — don't leave Access-Control-Allow-Origin: *
- Rate limiting — set 60 req/min per user as a baseline
- HTTPS — put Nginx in front with a Let's Encrypt cert
- Regular admin password rotation — use strong 16+ char passwords - Chat/QA: qwen-turbo or deepseek-chat ($0.02-0.05/1M tokens)
- Code generation: claude-3-haiku or gpt-4o-mini
- Complex reasoning: claude-3.5-sonnet or gpt-4o
- Batch processing: route to cheapest model with retry fallback