[!NOTE] MT (Machine Translation): This document is machine translated. For the most accurate information, please refer to the Chinese version.
[!NOTE]
This is an open-source project developed based on One API
[!IMPORTANT]
- This project is for personal learning purposes only, with no guarantee of stability or technical support.
- Users must comply with OpenAI's Terms of Use and applicable laws and regulations, and must not use it for illegal purposes.
- According to the 《Interim Measures for the Management of Generative Artificial Intelligence Services》, please do not provide any unregistered generative AI services to the public in China.
No particular order
For detailed documentation, please visit our official Wiki: https://docs.newapi.pro/
You can also access the AI-generated DeepWiki:
New API offers a wide range of features, please refer to Features Introduction for details:
-high suffix for high reasoning effort (e.g.: o3-mini-high)-medium suffix for medium reasoning effort (e.g.: o3-mini-medium)-low suffix for low reasoning effort (e.g.: o3-mini-low)-thinking suffix to enable thinking mode (e.g.: claude-3-7-sonnet-20250219-thinking)Prompt Cache Ratio option in System Settings-Operation SettingsPrompt Cache Ratio in the channel, range 0-1, e.g., setting to 0.5 means billing at 50% when cache is hitThis version supports multiple models, please refer to API Documentation-Relay Interface for details:
For detailed configuration instructions, please refer to Installation Guide-Environment Variables Configuration:
GENERATE_DEFAULT_TOKEN: Whether to generate initial tokens for newly registered users, default is falseSTREAMING_TIMEOUT: Streaming response timeout, default is 300 secondsDIFY_DEBUG: Whether to output workflow and node information for Dify channels, default is trueGET_MEDIA_TOKEN: Whether to count image tokens, default is trueGET_MEDIA_TOKEN_NOT_STREAM: Whether to count image tokens in non-streaming cases, default is trueUPDATE_TASK: Whether to update asynchronous tasks (Midjourney, Suno), default is trueGEMINI_VISION_MAX_IMAGE_NUM: Maximum number of images for Gemini models, default is 16MAX_FILE_DOWNLOAD_MB: Maximum file download size in MB, default is 20CRYPTO_SECRET: Encryption key used for encrypting Redis database contentAZURE_DEFAULT_API_VERSION: Azure channel default API version, default is 2025-04-01-previewNOTIFICATION_LIMIT_DURATION_MINUTE: Notification limit duration, default is 10 minutesNOTIFY_LIMIT_COUNT: Maximum number of user notifications within the specified duration, default is 2ERROR_LOG_ENABLED=true: Whether to record and display error logs, default is falseFor detailed deployment guides, please refer to Installation Guide-Deployment Methods:
[!TIP] Latest Docker image:
calciumion/new-api:latest
SESSION_SECRET must be set, otherwise login status will be inconsistent across multiple machinesCRYPTO_SECRET must be set, otherwise Redis content cannot be accessed across multiple machines/data directory)Install BaoTa Panel (version 9.2.0 or above), find New-API in the application store and install it. Tutorial with images
# Download the project
git clone https://github.com/Calcium-Ion/new-api.git
cd new-api
# Edit docker-compose.yml as needed
# Start
docker-compose up -d
# Using SQLite
docker run --name new-api -d --restart always -p 3000:3000 -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
# Using MySQL
docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:123456@tcp(localhost:3306)/oneapi" -e TZ=Asia/Shanghai -v /home/ubuntu/data/new-api:/data calciumion/new-api:latest
Channel retry functionality has been implemented, you can set the number of retries in Settings->Operation Settings->General Settings->Failure Retry Count, recommended to enable caching functionality.
REDIS_CONN_STRING: Set Redis as cacheMEMORY_CACHE_ENABLED: Enable memory cache (no need to set manually if Redis is set)For detailed API documentation, please refer to API Documentation:
Other projects based on New API:
If you have any questions, please refer to Help and Support: