English | 中文
AI Gateway Chat — A unified multi-model aggregation chat platform for small and medium-sized teams
Whether for enterprise teams or individual users, the private management of LLM conversation data is becoming increasingly important. Driven by recent real-world requirements for private Chatlog Data management, this project delivers a validated AI-Agent-Chatlog aggregation platform for small teams and companies, now fully functional and stably deployed.
While it is essentially an AI Gateway Chat project, we prefer to call it Team AI Platform.
- Multi-Model Chat Platform — Designed for small/medium teams and companies, supporting all major LLM providers
- Unified Auth & i18n — Email/phone cross-verification registration/login with multi-language internationalization
- Prompt Engineering & Agent Orchestration — Prompt engineering, AI Native ChatAgent orchestration, and native model hyperparameter tuning
- Private Chatlog Management — Multi-Agent Workflow orchestration with cross-reuse and Agent marketplace sharing
- Centralized API Key Control — Aggregated official models with API keys managed by the Admin backend; team members focus on conversations and agent outputs
- Extensible Channel Support — Supports domestic and international model providers, plus third-party relay interfaces for downstream expansion
- 7 Channels, 165+ Model Matrix — Integrated with Zhipu, DeepSeek, Alibaba Cloud Bailian, Kimi, Volcano Doubao, Xiaomi MiMo — 7 API channels with 165+ models on demand
- Conversation Operations — Chat History hot-editing, Chat Fork, Chat Export (Picture/Markdown), Chat with Internet (third-party)
- RAG/MCP & Artifact Strategy — Chat Platform artifact policies, RAG/MCP, side-by-side model/agent comparison
- Fine-Grained Management & Data Isolation — Admin Panel for user/group management, containerized data isolation ensuring data security
Development is nearing completion. Registration will be available once domain approval is finalized.
This project stands on the shoulders of giants. Thanks to the following excellent open-source projects:
This project is licensed under the Apache License 2.0.
An internal AI chat integration repo based on NEW-API + LibreChat. The goal is to consolidate company-purchased upstream model capabilities into NEW-API, with LibreChat providing the chat interface for department members. Local entry points: http://localhost:3081 and http://localhost:13001.
- Codex handles full implementation, structural organization, documentation, script generation, configuration templates, integration path design, self-testing, and issue resolution.
- The project owner is responsible for final acceptance only.
- Users provide valid API keys for Zhipu, DeepSeek, Alibaba Cloud Bailian, Kimi, Volcano Doubao, Xiaomi MiMo, or MiniMax.
- Final acceptance uses the Zhipu API channel as the primary verification channel.
- Users are not responsible for engineering integration beyond filling in real keys and performing final acceptance.
Zhipu / DeepSeek / Alibaba Cloud Bailian / Kimi / Volcano Doubao / Xiaomi MiMo / MiniMax / Other Upstream Models
-> NEW-API
-> LibreChat
-> Department Users
This repo uses by default:
NEW-APInativeZhipuV4channel + Volcano Doubao native channel + DeepSeek / Alibaba Cloud Bailian / Kimi / Xiaomi MiMo / MiniMax OpenAI-compatible channelsLibreChatcustom OpenAI-compatible endpoints split by provider:API-zhipu/API-deepseek/API-aliyun/API-kimi/API-doubao/API-mimo/API-minimax, all routing throughNEW-APIDocker Composeas the unified orchestration for local and single-node production- Production defaults to direct-ip port access;
Caddyis only enabled for domain HTTPS reverse proxy whenCOMPOSE_PROFILES=domain-proxy
calciumion/new-api:v0.12.1ghcr.io/danny-avila/librechat:v0.8.5postgres:16-alpineredis:7.4.2-alpinemongo:8.0.20caddy:2.10.0-alpine
Version rationale:
NEW-API v0.12.1from official GitHub Release / Docker Hub tag.LibreChat v0.8.5from official Git tag and GHCR image tag.- All core base images are pinned to specific versions to avoid
latestdrift; the local Admin Panel is controlled byLIBRECHAT_ADMIN_PANEL_VERSION, defaulting to the upstreamlatest, and is not enabled in production compose by default.
- Copy the environment file and fill in at least one real upstream key:
Required:
cp .env.example .env
ZHIPU_API_KEY,DEEPSEEK_API_KEY,ALIYUN_API_KEY,KIMI_API_KEY,DOUBAO_API_KEY,MIMO_API_KEY, orMINIMAX_API_KEY. If you only want DeepSeek, Alibaba Cloud Bailian, Kimi, Doubao, MiMo, or MiniMax and no longer use Zhipu, setZHIPU_ENABLED=false. - Initialize local directories and auto-generate non-sensitive random keys:
make init
- Start core services:
make up
- Run Zhipu integration and main-chain smoke test:
If DeepSeek is enabled:
make smoke-zhipu
If Alibaba Cloud Bailian is enabled:make smoke-deepseek
If Kimi is enabled:make smoke-aliyun
If Volcano Doubao is enabled:make smoke-kimi
If Xiaomi MiMo is enabled:make smoke-doubao
If MiniMax is enabled:make smoke-mimo
make smoke-minimax
- If you later adjust the upstream model matrix or configure LibreChat frontend whitelists:
make sync-provider-models
Notes:
make smoke-*commands all invokescripts/bootstrap-new-api.shfirst, which automatically initializesNEW-API, writes rate-limit parameters, creates enabled provider channels, and generates LibreChat service user and token.- The bootstrap process writes the auto-generated
NEW_API_SERVICE_TOKENback to the local.env— no manual token copying needed. - Local compose includes
LibreChat Admin Panelby default, controlled byLIBRECHAT_ADMIN_PANEL_PORT; the main local deployment useshttp://localhost:3003to avoid conflicts with running branches and other local processes. - Main branch containers use
ai-gateway-main-*naming to avoid overlapping withai-gateway-*branch environments. - A default admin account is created (email and password configured via
LIBRECHAT_DEFAULT_ADMIN_EMAIL/LIBRECHAT_DEFAULT_ADMIN_PASSWORDin.env), synced to LibreChat local user store and Casdoorteam-aiorganization; the first non-default registered user is automatically promoted toADMIN. - LibreChat OIDC state/session is persisted to
new-api-redisDB 1 — no repeated login prompts after restart. - Casdoor login page styles are script-rendered with browser
light/darktheme adaptation; login/register pages default to Chinese. - Production compose now supports domain-less direct access: ports are exposed via
LIBRECHAT_PUBLIC_URL / NEW_API_PUBLIC_URL / CASDOOR_PUBLIC_URL; Caddy is only started for domain HTTPS reverse proxy whenCOMPOSE_PROFILES=domain-proxy. - Production env templates and compose are tuned for Aliyun 2C2G with ~1.6GB usable memory; Admin Panel and Caddy are disabled by default in production.
- When
ZHIPU_ENABLED=true,DEEPSEEK_ENABLED=true,ALIYUN_ENABLED=true,KIMI_ENABLED=true,DOUBAO_ENABLED=true,MIMO_ENABLED=true,MINIMAX_ENABLED=trueare all enabled,make bootstrapcreates/updateszhipu-primary,deepseek-primary,aliyun-bailian-primary,kimi-primary,doubao-primary,mimo-primary, andminimax-primarychannels; LibreChat displaysAPI-zhipu/API-deepseek/API-aliyun/API-kimi/API-doubao/API-mimo/API-minimaxas seven endpoints, all sharing the sameNEW_API_SERVICE_TOKEN.
docs/ Requirements, architecture, deployment, acceptance, self-test docs
deploy/ Local/prod compose and config templates
scripts/ Init, start/stop, health check, bootstrap, backup/restore
tests/smoke/ Smoke test request templates
.github/workflows/ Basic CI checks
runtime/ Local and production runtime data directory (not tracked)
make init: Initialize local directories, copy env files, generate random key placeholders.make up: Start local compose.make down: Stop local compose.make restart: Restart local compose.make bootstrap: InitializeNEW-APIand configure enabled provider channels.make bootstrap-librechat-admin: Create or fix LibreChat default admin and promote the first non-default registered user toADMIN.make sync-provider-models: Detect provider model APIs, syncNEW-APIchannels, and re-render LibreChat model list.make sync-librechat-models: Compatibility alias, equivalent tomake sync-provider-models.make health: CheckNEW-APIandLibreChatapplication-layer health.make smoke: Run generic smoke test.make smoke-zhipu: Run Zhipu verification channel smoke test.make smoke-deepseek: Run DeepSeek verification channel smoke test.make smoke-aliyun: Run Alibaba Cloud Bailian verification channel smoke test.make smoke-kimi: Run Kimi verification channel smoke test.make smoke-doubao: Run Volcano Doubao verification channel smoke test.make smoke-mimo: Run Xiaomi MiMo verification channel smoke test.make smoke-minimax: Run MiniMax verification channel smoke test.make doctor: Diagnose dependencies, ports, env, compose config.make verify-no-secrets: Scan tracked files for obvious key risks.
Default deployment notes:
MeiliSearchhas reserved variables but is disabled by default and not part of the acceptance main chain.- To enable search, restore the
meilisearchservice in compose and setLIBRECHAT_SEARCH_ENABLED=true.
Fill in at least the following fields in the root .env:
ZHIPU_ENABLED=true
ZHIPU_API_KEY=__FILL_BY_USER__
ZHIPU_API_BASE_URL=https://open.bigmodel.cn
ZHIPU_DEFAULT_MODEL=glm-5.1
ZHIPU_TEST_MODEL=glm-5.1
ZHIPU_EXPOSED_MODEL=glm-5.1,glm-5,glm-5-turbo,glm-4.7,glm-4.6,glm-4.5-air,glm-4.5
ZHIPU_LIBRECHAT_ENDPOINT_NAME=API-zhipuThe main config detects available models from the Zhipu model API, then syncs sorted ZHIPU_EXPOSED_MODEL to NEW-API and LibreChat's API-zhipu endpoint, achieving:
- Frontend never holds official procurement keys
- LibreChat only shows Zhipu models under
API-zhipu - NEW-API can extend other upstreams without changing the frontend
NEW-API's ZhipuV4 channel auto-appends /api/paas/v4, so ZHIPU_API_BASE_URL must be https://open.bigmodel.cn — do not include the full path.
Fill in at least the following fields in the root .env to enable DeepSeek:
DEEPSEEK_ENABLED=true
DEEPSEEK_API_KEY=__FILL_BY_USER__
DEEPSEEK_API_BASE_URL=https://api.deepseek.com
DEEPSEEK_DEFAULT_MODEL=deepseek-v4-flash
DEEPSEEK_TEST_MODEL=deepseek-v4-flash
DEEPSEEK_EXPOSED_MODEL=deepseek-v4-pro,deepseek-v4-flash
DEEPSEEK_LIBRECHAT_ENDPOINT_NAME=API-deepseekNotes:
- This repo uses
type=1OpenAI-compatible channel for DeepSeek official API. make bootstrapcreates/updatesdeepseek-primarychannel whenDEEPSEEK_ENABLED=true.- Bootstrap corrects
deepseek-primaryand other enabled provider channels'balancetoNEW_API_PROVIDER_CHANNEL_BALANCE; no per-channel balance limits in this project. - DeepSeek official docs specify OpenAI-compatible
base_urlashttps://api.deepseek.com— no need to manually append/v1. make sync-provider-modelsdynamically refreshesDEEPSEEK_EXPOSED_MODELfrom the DeepSeek model API; current real API returnsdeepseek-v4-pro/deepseek-v4-flash.
Fill in at least the following fields in the root .env to enable Bailian:
ALIYUN_ENABLED=true
ALIYUN_API_KEY=__FILL_BY_USER__
ALIYUN_API_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode
ALIYUN_DEFAULT_MODEL=qwen-plus
ALIYUN_TEST_MODEL=qwen-plus
ALIYUN_EXPOSED_MODEL=qwen3.6-max-preview,qwen3-max,qwen-max-latest,qwen-max,qwen-plus-latest,qwen-plus
ALIYUN_LIBRECHAT_ENDPOINT_NAME=API-aliyunNotes:
- This repo uses
type=1OpenAI-compatible channel for Alibaba Cloud DashScope. make bootstrapcreates/updatesaliyun-bailian-primarychannel whenALIYUN_ENABLED=true.ALIYUN_API_BASE_URLis set tohttps://dashscope.aliyuncs.com/compatible-mode; model detection is configured separately viaALIYUN_MODEL_LIST_URLS=https://dashscope.aliyuncs.com/compatible-mode/v1/models.make sync-provider-modelsdynamically refreshesALIYUN_EXPOSED_MODELfrom the Bailian model API, sorted byALIYUN_MODEL_ORDER(higher-tier first).
Fill in at least the following fields in the root .env to enable Kimi:
KIMI_ENABLED=true
KIMI_API_KEY=__FILL_BY_USER__
KIMI_API_BASE_URL=https://api.moonshot.cn
KIMI_DEFAULT_MODEL=kimi-k2.6
KIMI_TEST_MODEL=kimi-k2.6
KIMI_EXPOSED_MODEL=kimi-k2.6,kimi-k2.5,moonshot-v1-128k,moonshot-v1-32k,moonshot-v1-8k
KIMI_LIBRECHAT_ENDPOINT_NAME=API-kimiNotes:
- This repo uses
type=1OpenAI-compatible channel for Kimi Open Platform. make bootstrapcreates/updateskimi-primarychannel whenKIMI_ENABLED=true.- Kimi official SDK Base URL is
https://api.moonshot.cn/v1; NEW-API channel useshttps://api.moonshot.cn, with model detection viaKIMI_MODEL_LIST_URLS=https://api.moonshot.cn/v1/models. make sync-provider-modelsdynamically refreshesKIMI_EXPOSED_MODELfrom the Kimi model API, sorted byKIMI_MODEL_ORDER(higher-tier first).
Fill in at least the following fields in the root .env to enable Doubao:
DOUBAO_ENABLED=true
DOUBAO_API_KEY=__FILL_BY_USER__
DOUBAO_API_BASE_URL=https://ark.cn-beijing.volces.com
DOUBAO_DEFAULT_MODEL=doubao-seed-1-6-250615
DOUBAO_TEST_MODEL=doubao-seed-1-6-250615
DOUBAO_EXPOSED_MODEL=doubao-seed-1-6-250615,doubao-seed-1-6-flash-250828,doubao-1-5-pro-32k-250115
DOUBAO_LIBRECHAT_ENDPOINT_NAME=API-doubaoNotes:
- This repo uses
type=45NEW-API Volcano Ark native channel for Doubao. DOUBAO_API_BASE_URLis set to the roothttps://ark.cn-beijing.volces.com; the NEW-API adapter appends/api/v3/chat/completions.- Model detection is configured via
DOUBAO_MODEL_LIST_URLS=https://ark.cn-beijing.volces.com/api/v3/models, filtering out disabled, embedding, image, audio/video, and other non-chat models. - Volcano Ark accounts must enable the corresponding model service or create a callable inference endpoint in the console; otherwise, the API key can list models but real chat requests will return "model service not enabled".
Fill in at least the following fields in the root .env to enable MiMo:
MIMO_ENABLED=true
MIMO_API_KEY=__FILL_BY_USER__
MIMO_API_BASE_URL=https://api.xiaomimimo.com
MIMO_DEFAULT_MODEL=mimo-v2.5-pro
MIMO_TEST_MODEL=mimo-v2.5-pro
MIMO_EXPOSED_MODEL=mimo-v2.5-pro,mimo-v2.5,mimo-v2-pro,mimo-v2-omni,mimo-v2-flash
MIMO_LIBRECHAT_ENDPOINT_NAME=API-mimoNotes:
- This repo uses
type=1OpenAI-compatible channel for Xiaomi MiMo. - MiMo official SDK Base URL is
https://api.xiaomimimo.com/v1; NEW-API channel useshttps://api.xiaomimimo.com, with model detection viaMIMO_MODEL_LIST_URLS=https://api.xiaomimimo.com/v1/models. make sync-provider-modelsdynamically refreshesMIMO_EXPOSED_MODELfrom the MiMo model API, filtering TTS/voiceclone/voicedesign non-chat models, sorted byMIMO_MODEL_ORDER(higher-tier first).
Fill in at least the following fields in the root .env to enable MiniMax:
MINIMAX_ENABLED=true
MINIMAX_API_KEY=__FILL_BY_USER__
MINIMAX_API_BASE_URL=https://api.minimaxi.com
MINIMAX_DEFAULT_MODEL=MiniMax-M2.7
MINIMAX_TEST_MODEL=MiniMax-M2.7
MINIMAX_EXPOSED_MODEL=MiniMax-M2.7,MiniMax-M2.7-highspeed,MiniMax-M2.5,MiniMax-M2.5-highspeed,MiniMax-M2.1,MiniMax-M2.1-highspeed,MiniMax-M2
MINIMAX_LIBRECHAT_ENDPOINT_NAME=API-minimaxNotes:
- This repo uses
type=1OpenAI-compatible channel for MiniMax. - MiniMax official OpenAI SDK Base URL is
https://api.minimaxi.com/v1; NEW-API channel useshttps://api.minimaxi.com, with model detection viaMINIMAX_MODEL_LIST_URLS=https://api.minimaxi.com/v1/models. make sync-provider-modelsdynamically refreshesMINIMAX_EXPOSED_MODELfrom the MiniMax model API, defaulting toMiniMax-M2.7,MiniMax-M2.7-highspeed,MiniMax-M2.5,MiniMax-M2.5-highspeed,MiniMax-M2.1,MiniMax-M2.1-highspeed,MiniMax-M2, sorted byMINIMAX_MODEL_ORDER(higher-tier first).
The default strategy splits LibreChat model endpoints by provider:
API-zhipu: Zhipu models only, sorted byZHIPU_MODEL_ORDER(higher-tier first).API-deepseek: DeepSeek models only, sorted byDEEPSEEK_MODEL_ORDER(higher-tier first).API-aliyun: Alibaba Cloud Bailian models only, sorted byALIYUN_MODEL_ORDER(higher-tier first).API-kimi: Kimi models only, sorted byKIMI_MODEL_ORDER(higher-tier first).API-doubao: Volcano Doubao models only, sorted byDOUBAO_MODEL_ORDER(higher-tier first).API-mimo: Xiaomi MiMo models only, sorted byMIMO_MODEL_ORDER(higher-tier first).API-minimax: MiniMax models only, sorted byMINIMAX_MODEL_ORDER(higher-tier first).- All endpoints share the same
NEW_API_SERVICE_TOKENforNEW-API /v1/*requests.
Recommended default settings:
NEW_API_SERVICE_TOKEN_QUOTA=1000000000000NEW_API_SERVICE_TOKEN_UNLIMITED=trueNEW_API_PROVIDER_CHANNEL_BALANCE=999999999999NEW_API_RATE_LIMIT_ENABLED=falseNEW_API_TOKEN_MODEL_LIMITS_ENABLED=falseNEW_API_SYNC_CHANNEL_MODELS_FROM_ENV=trueLIBRECHAT_SPLIT_PROVIDER_ENDPOINTS=trueLIBRECHAT_FETCH_MODELS=trueLIBRECHAT_VISIBLE_MODELS=(leave empty)
Daily dynamic sync:
make install-model-sync-cronDefault cron is 17 4 * * *, executing make sync-provider-models: detect provider model APIs, update *_EXPOSED_MODEL, replay bootstrap, and restart LibreChat.
A local admin account is enabled by default for first-time login to LibreChat and Admin Panel:
LIBRECHAT_DEFAULT_ADMIN_ENABLED=true
LIBRECHAT_DEFAULT_ADMIN_EMAIL=<YOUR_ADMIN_EMAIL>
LIBRECHAT_DEFAULT_ADMIN_PASSWORD=<YOUR_ADMIN_PASSWORD>
LIBRECHAT_DEFAULT_ADMIN_CASDOOR_ENABLED=true
LIBRECHAT_FIRST_USER_ADMIN_ENABLED=trueNotes:
make upandmake bootstrapauto-executescripts/bootstrap-librechat-admin.sh.- The default admin is written to both LibreChat MongoDB and Casdoor
team-aiorganization, supporting both LibreChat local login and Casdoor unified auth login. - If auto-redirected to the unified auth page when logging into LibreChat, open
http://localhost:3081/login?redirect=falseto use the default admin account (see.envconfig). - The first non-default registered user is automatically set to
ADMIN; subsequent users remain asUSERfor user group and permission debugging in Admin Panel.
- General check:
make smoke
- Zhipu primary verification:
make smoke-zhipu
- DeepSeek primary verification:
make smoke-deepseek
- Alibaba Cloud Bailian primary verification:
make smoke-aliyun
- Kimi primary verification:
make smoke-kimi
- Volcano Doubao primary verification:
make smoke-doubao
- Xiaomi MiMo primary verification:
make smoke-mimo
- MiniMax primary verification:
make smoke-minimax
- Application-layer health check:
make health
- Requirements: docs/architecture/requirements.md
- Architecture: docs/architecture/architecture.md
- Implementation Plan: docs/architecture/implementation-plan.md
- Local Deployment: docs/architecture/deployment-local.md
- Cloud Deployment: docs/architecture/deployment-cloud.md
- Zhipu Integration: docs/architecture/provider-zhipu.md
- DeepSeek Integration: docs/architecture/provider-deepseek.md
- Alibaba Cloud Bailian Integration: docs/architecture/provider-aliyun.md
- Kimi Integration: docs/architecture/provider-kimi.md
- Volcano Doubao Integration: docs/architecture/provider-doubao.md
- Xiaomi MiMo Integration: docs/architecture/provider-mimo.md
- MiniMax Integration: docs/architecture/provider-minimax.md
- NEW-API Admin Guide: docs/architecture/admin-new-api.md
- LibreChat Admin Guide: docs/architecture/admin-librechat.md
- Admin Panel Guide: docs/architecture/admin-panel.md
- Runbook: docs/architecture/runbook.md
- Acceptance Criteria: docs/architecture/acceptance-criteria.md
- Self-Test Report: docs/architecture/self-test-report.md
If you are new to this project, read in the following order:
- docs/architecture/requirements.md
- docs/architecture/architecture.md
- docs/architecture/implementation-plan.md
- docs/architecture/deployment-local.md or docs/architecture/deployment-cloud.md
- docs/architecture/admin-new-api.md and docs/architecture/admin-librechat.md
- docs/architecture/runbook.md
- docs/architecture/acceptance-criteria.md





