Tidak Ada Deskripsi

feitianbubu 0fafcdca69 feat: topUp show correct symbol 6 bulan lalu
.github f91522b51e CI: ignore pre-release and alpha tags in electron build workflow 6 bulan lalu
bin 6a34813bea chore: add model parameter to the time_test script (#245) 2 tahun lalu
common fe9b092b0b feat: doubao-seedream support image edit 6 bulan lalu
constant a2d34b9e47 feat: add minimax api adaptor 6 bulan lalu
controller 8511ea0fff fix: prevent refund on video task update error 6 bulan lalu
docs 087248c2f9 feat: add French translation glossary for consistent terminology 6 bulan lalu
dto a4c46e999e feat: doubao-seedream-4-0-250828 image to image 6 bulan lalu
electron a0a10e63c8 chore(deps-dev): bump electron from 28.3.3 to 35.7.5 in /electron 7 bulan lalu
logger b70b4597ce fix: prevent duplicate refunds on task failure #2050 6 bulan lalu
middleware 86cd2802d5 fix: fail get moel by 6 bulan lalu
model 812ab67780 refactor: replace iota with explicit values for log type constants 6 bulan lalu
relay a25c11df2a feat: add support for Submodel channel type in relay info 6 bulan lalu
router 5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 6 bulan lalu
service b3fc7255ee feat: endpoint type log 6 bulan lalu
setting d43751f262 feat: support free model setting 6 bulan lalu
types 31e09b960f refactor: aws 6 bulan lalu
web 0fafcdca69 feat: topUp show correct symbol 6 bulan lalu
.dockerignore 56ffbd57b9 fix: legal setting 7 bulan lalu
.env.example f0183785c9 feat(option): enhance UpdateOption to handle various value types and improve validation 8 bulan lalu
.gitignore 56ffbd57b9 fix: legal setting 7 bulan lalu
Dockerfile 1e39b5ede1 fix: version 6 bulan lalu
LICENSE 9992229b90 ⚖️ docs(LICENSE): update license information from Apache 2.0 to New API Licensing 9 bulan lalu
README.en.md 1ffbf8918c chore: update README files 7 bulan lalu
README.fr.md 1ffbf8918c chore: update README files 7 bulan lalu
README.ja.md 1ffbf8918c chore: update README files 7 bulan lalu
README.md 6e08c5dc67 docs: update README for project cloning and Docker Compose instructions 6 bulan lalu
VERSION f4450040b9 fix: add a blank VERSION file (#135) 2 tahun lalu
docker-compose.yml ffb60c9749 feat: add Umami and Google Analytics integration 6 bulan lalu
go.mod 5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 6 bulan lalu
go.sum 5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 6 bulan lalu
main.go ffb60c9749 feat: add Umami and Google Analytics integration 6 bulan lalu
makefile 8c9dfd3bb4 feat: use bun when develop locally 11 bulan lalu
new-api.service 5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 6 bulan lalu

README.en.md

中文 | English | Français | 日本語

[!NOTE] MT (Machine Translation): This document is machine translated. For the most accurate information, please refer to the Chinese version.

![new-api](/web/public/logo.png) # New API 🍥 Next-Generation Large Model Gateway and AI Asset Management System

license release docker docker GoReportCard

📝 Project Description

[!NOTE]
This is an open-source project developed based on One API

[!IMPORTANT]

🤝 Trusted Partners

 

No particular order

<img

src="./docs/images/cherry-studio.png" alt="Cherry Studio" height="120"

/> <img

src="./docs/images/pku.png" alt="Peking University" height="120"

/> <img

src="./docs/images/ucloud.png" alt="UCloud" height="120"

/> <img

src="./docs/images/aliyun.png" alt="Alibaba Cloud" height="120"

/> <img

src="./docs/images/io-net.png" alt="IO.NET" height="120"

/>

 

📚 Documentation

For detailed documentation, please visit our official Wiki: https://docs.newapi.pro/

You can also access the AI-generated DeepWiki: Ask DeepWiki

✨ Key Features

New API offers a wide range of features, please refer to Features Introduction for details:

  1. 🎨 Brand new UI interface
  2. 🌍 Multi-language support
  3. 💰 Online recharge functionality, currently supports EPay and Stripe
  4. 🔍 Support for querying usage quotas with keys (works with neko-api-key-tool)
  5. 🔄 Compatible with the original One API database
  6. 💵 Support for pay-per-use model pricing
  7. ⚖️ Support for weighted random channel selection
  8. 📈 Data dashboard (console)
  9. 🔒 Token grouping and model restrictions
  10. 🤖 Support for more authorization login methods (LinuxDO, Telegram, OIDC)
  11. 🔄 Support for Rerank models (Cohere and Jina), API Documentation
  12. ⚡ Support for OpenAI Realtime API (including Azure channels), API Documentation
  13. ⚡ Support for OpenAI Responses format, API Documentation
  14. ⚡ Support for Claude Messages format, API Documentation
  15. ⚡ Support for Google Gemini format, API Documentation
  16. 🧠 Support for setting reasoning effort through model name suffixes:
    1. OpenAI o-series models
      • Add -high suffix for high reasoning effort (e.g.: o3-mini-high)
      • Add -medium suffix for medium reasoning effort (e.g.: o3-mini-medium)
      • Add -low suffix for low reasoning effort (e.g.: o3-mini-low)
    2. Claude thinking models
      • Add -thinking suffix to enable thinking mode (e.g.: claude-3-7-sonnet-20250219-thinking)
  17. 🔄 Thinking-to-content functionality
  18. 🔄 Model rate limiting for users
  19. 🔄 Request format conversion functionality, supporting the following three format conversions:
    1. OpenAI Chat Completions => Claude Messages
    2. Claude Messages => OpenAI Chat Completions (can be used for Claude Code to call third-party models)
    3. OpenAI Chat Completions => Gemini Chat
  20. 💰 Cache billing support, which allows billing at a set ratio when cache is hit:
    1. Set the Prompt Cache Ratio option in System Settings-Operation Settings
    2. Set Prompt Cache Ratio in the channel, range 0-1, e.g., setting to 0.5 means billing at 50% when cache is hit
    3. Supported channels:
      • OpenAI
      • Azure
      • DeepSeek
      • Claude

Model Support

This version supports multiple models, please refer to API Documentation-Relay Interface for details:

  1. Third-party models gpts (gpt-4-gizmo-*)
  2. Third-party channel Midjourney-Proxy(Plus) interface, API Documentation
  3. Third-party channel Suno API interface, API Documentation
  4. Custom channels, supporting full call address input
  5. Rerank models (Cohere and Jina), API Documentation
  6. Claude Messages format, API Documentation
  7. Google Gemini format, API Documentation
  8. Dify, currently only supports chatflow
  9. For more interfaces, please refer to API Documentation

Environment Variable Configuration

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 false
  • STREAMING_TIMEOUT: Streaming response timeout, default is 300 seconds
  • DIFY_DEBUG: Whether to output workflow and node information for Dify channels, default is true
  • GET_MEDIA_TOKEN: Whether to count image tokens, default is true
  • GET_MEDIA_TOKEN_NOT_STREAM: Whether to count image tokens in non-streaming cases, default is true
  • UPDATE_TASK: Whether to update asynchronous tasks (Midjourney, Suno), default is true
  • GEMINI_VISION_MAX_IMAGE_NUM: Maximum number of images for Gemini models, default is 16
  • MAX_FILE_DOWNLOAD_MB: Maximum file download size in MB, default is 20
  • CRYPTO_SECRET: Encryption key used for encrypting Redis database content
  • AZURE_DEFAULT_API_VERSION: Azure channel default API version, default is 2025-04-01-preview
  • NOTIFICATION_LIMIT_DURATION_MINUTE: Notification limit duration, default is 10 minutes
  • NOTIFY_LIMIT_COUNT: Maximum number of user notifications within the specified duration, default is 2
  • ERROR_LOG_ENABLED=true: Whether to record and display error logs, default is false

Deployment

For detailed deployment guides, please refer to Installation Guide-Deployment Methods:

[!TIP] Latest Docker image: calciumion/new-api:latest

Multi-machine Deployment Considerations

  • Environment variable SESSION_SECRET must be set, otherwise login status will be inconsistent across multiple machines
  • If sharing Redis, CRYPTO_SECRET must be set, otherwise Redis content cannot be accessed across multiple machines

Deployment Requirements

  • Local database (default): SQLite (Docker deployment must mount the /data directory)
  • Remote database: MySQL version >= 5.7.8, PgSQL version >= 9.6

Deployment Methods

Using BaoTa Panel Docker Feature

Install BaoTa Panel (version 9.2.0 or above), find New-API in the application store and install it. Tutorial with images

Using Docker Compose (Recommended)

# 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 Docker Image Directly

# 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 and Cache

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.

Cache Configuration Method

  1. REDIS_CONN_STRING: Set Redis as cache
  2. MEMORY_CACHE_ENABLED: Enable memory cache (no need to set manually if Redis is set)

API Documentation

For detailed API documentation, please refer to API Documentation:

Related Projects

Other projects based on New API:

Help and Support

If you have any questions, please refer to Help and Support:

🌟 Star History

Star History Chart