English | 简体中文
Next-generation AI gateway, using OpenAI as the protocol entry point.
- Intelligent error retry
- Channel selection based on priority and error rate
- Alert notifications
- Channel balance warning
- Error rate warning
- Unauthorized channel warning
- and more...
- Logging and auditing
- Comprehensive request log data
- Request and response body recording
- Request log tracing
- Data statistics and analysis
- Request volume statistics
- Error volume statistics
- RPM TPM statistics
- Consumption statistics
- Model statistics
- Channel error rate analysis
- and more...
- Rerank support
- PDF support
- STT model mapping support
- Multi-tenant system separation
- Model RPM TPM limits
- Think model support
<think>
split toreasoning_content
docker run -d --name aiproxy -p 3000:3000 -v $(pwd)/aiproxy:/aiproxy ghcr.io/labring/aiproxy:latest
Copy docker-compose.yaml to directory.
docker-compose up -d
ADMIN_KEY
: The admin key for the AI Proxy Service, admin key is used to admin api and relay api, default is emptyINTERNAL_TOKEN
: Internal token for service authentication, default is emptyFFPROBE_ENABLED
: Whether to enable ffprobe, default isfalse
DEBUG
: Enable debug mode, default isfalse
DEBUG_SQL
: Enable SQL debugging, default isfalse
SQL_DSN
: The database connection string, default is empty, eg:postgres://postgres:postgres@localhost:5432/postgres
LOG_SQL_DSN
: The log database connection string, default is empty, eg:postgres://postgres:postgres@localhost:5432/postgres
REDIS_CONN_STRING
: The redis connection string, default is empty, eg:redis://localhost:6379
DISABLE_AUTO_MIGRATE_DB
: Disable automatic database migration, default isfalse
SQL_MAX_IDLE_CONNS
: The maximum number of idle connections in the database, default is100
SQL_MAX_OPEN_CONNS
: The maximum number of open connections to the database, default is1000
SQL_MAX_LIFETIME
: The maximum lifetime of a connection in seconds, default is60
SQLITE_PATH
: The path to the sqlite database, default isaiproxy.db
SQL_BUSY_TIMEOUT
: The busy timeout for the database, default is3000
NOTIFY_NOTE
: Custom notification note, default isAI Proxy
NOTIFY_FEISHU_WEBHOOK
: The feishu notify webhook url, default is empty, eg:https://open.feishu.cn/open-apis/bot/v2/hook/xxxx
DISABLE_MODEL_CONFIG
: Disable model configuration, default isfalse
RETRY_TIMES
: Number of retry attempts, default is0
ENABLE_MODEL_ERROR_AUTO_BAN
: Enable automatic banning of models with errors, default isfalse
MODEL_ERROR_AUTO_BAN_RATE
: Rate threshold for auto-banning models with errors, default is0.3
TIMEOUT_WITH_MODEL_TYPE
: Timeout settings for different model types, default is{}
DEFAULT_CHANNEL_MODELS
: Default models for each channel, default is{}
DEFAULT_CHANNEL_MODEL_MAPPING
: Model mapping for each channel, default is{}
LOG_STORAGE_HOURS
: Hours to store logs (0 means unlimited), default is0
SAVE_ALL_LOG_DETAIL
: Save all log details, default isfalse
LOG_DETAIL_REQUEST_BODY_MAX_SIZE
: Maximum size for request body in log details, default is128KB
LOG_DETAIL_RESPONSE_BODY_MAX_SIZE
: Maximum size for response body in log details, default is128KB
LOG_DETAIL_STORAGE_HOURS
: Hours to store log details, default is72
(3 days)
DISABLE_SERVE
: Disable serving requests, defaultfalse
GROUP_MAX_TOKEN_NUM
: Maximum number of tokens per group (0 means unlimited), default is0
GROUP_CONSUME_LEVEL_RATIO
: Consumption level ratio for groups, default is{}
GEMINI_SAFETY_SETTING
: Safety setting for Gemini models, default isBLOCK_NONE
BILLING_ENABLED
: Enable billing functionality, default istrue