new-api
БесплатноБез исполняемых скриптовНе проверенNew API is a self-hosted AI gateway that puts many LLM providers behind one OpenAI-compatible endpoint, with a web console for channels, API keys, quotas and…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
New API — a self-hosted gateway for your LLM providers
Overview
New API (QuantumNous, a project built on One API) is a Go service with an embedded web console. You add upstream providers as channels (OpenAI, Anthropic, Gemini, Azure OpenAI, Bedrock, Vertex AI, DeepSeek, Qwen and other compatible services), then issue API keys that clients use against a single base URL. The gateway handles model mapping, channel priority and weights, retries, per-key quotas, groups with price ratios, and usage logs.
It speaks OpenAI Chat Completions and Responses, Anthropic Messages (/v1/messages) and Gemini (/v1beta/...), plus embeddings, rerank, images and audio. What converts between protocols depends on the channel and upstream model.
It is a gateway you operate, not a library. If the user wants an in-process Python router, use the litellm skill instead. The agent's realistic jobs here are deploying the service, configuring it, and calling it. Initial setup (admin account, channels, keys) is done in the web console.
Use it only with upstream keys and accounts you are entitled to use, within each provider's terms. Offering it to the public as a resale service carries filing, licensing, tax and content-safety duties in many jurisdictions; the project README says to complete them first.
Instructions
Try it locally (SQLite)
Pin a release tag from the GitHub releases page instead of latest. v1.0.0-rc.48 was the current tag when this skill was written and started cleanly in a test run.
mkdir -p data
docker run --name new-api -d --restart unless-stopped \
-p 127.0.0.1:3000:3000 \
-e TZ=Europe/Berlin \
-v "$(pwd)/data:/data" \
calciumion/new-api:v1.0.0-rc.48
curl -s http://127.0.0.1:3000/api/setup
Right after the first start the setup endpoint answers {"data":{"status":false,"root_init":false,"database_type":"sqlite"},"success":true}. Open http://127.0.0.1:3000 and complete the wizard to create the administrator account. The SQLite file (one-api.db) lives in the mounted data directory, so keep that directory across container replacements. Without a valid key, GET /v1/models returns HTTP 401 with "Invalid token", which confirms the relay is up.
If port 3000 is taken, change only the host side, for example -p 127.0.0.1:3410:3000.
Production: Docker Compose with PostgreSQL and Redis
The repository's docker-compose.yml starts New API, PostgreSQL 15 and Redis. Its example passwords are placeholders that must be replaced.
git clone https://github.com/QuantumNous/new-api.git
cd new-api
git checkout v1.0.0-rc.48
openssl rand -hex 32 # use the output as SESSION_SECRET
Edit docker-compose.yml before the first start:
- Replace the Postgres password (
POSTGRES_PASSWORD) and the one insideSQL_DSN. - Replace the Redis
--requirepassvalue and the one insideREDIS_CONN_STRING. - Uncomment
SESSION_SECRETand set it to the generated value. - Change the image from
calciumion/new-api:latestto the pinned tag. - Behind HTTPS also set
SESSION_COOKIE_SECURE=trueandSESSION_COOKIE_TRUSTED_URLto the exact public origin, such ashttps://llm.northwind.example(no path, no wildcard).
docker compose up -d
docker compose logs -f new-api
The compose file maps port 3000 to all interfaces. Put it behind a reverse proxy with TLS, and change the mapping to 127.0.0.1:3000:3000 if the proxy runs on the same host. The proxy must allow streaming and WebSocket upgrades.
Environment variables
| Variable | Purpose |
|---|---|
SQL_DSN |
Main database. Unset means SQLite. PostgreSQL: postgresql://user:pw@host:5432/new-api; MySQL: user:pw@tcp(host:3306)/new-api |
LOG_SQL_DSN |
Separate database for logs (ClickHouse also supported) |
REDIS_CONN_STRING |
redis://:password@host:6379 |
SESSION_SECRET |
Persistent random secret; every node must share it |
CRYPTO_SECRET |
Defaults to SESSION_SECRET |
SESSION_COOKIE_SECURE, SESSION_COOKIE_TRUSTED_URL |
HTTPS console hardening |
TRUSTED_PROXIES |
Reverse-proxy IPs/CIDRs, or none |
PORT, TZ, STREAMING_TIMEOUT |
Listen port, time zone, streaming timeout in seconds (source default 300) |
Setting variables only in .env.example does nothing for the container; put them under environment: or env_file: in Compose. Several nodes must share the same database, secrets and Redis, otherwise rate limits and sessions diverge.
Configure channels, groups and keys (web console)
- Add a channel per upstream: type, the upstream key from your provider's console, the model list, and a group. Run the channel test.
- For fallback, add a second channel serving the same model name and give it a lower priority than the first (higher numbers are tried first); channels with equal priority share load by weight. A channel can also hold several upstream keys. Fallback only happens through retries: the retry count setting defaults to 0, and each retry mov
Установить new-api в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл new-api?
New API is a self-hosted AI gateway that puts many LLM providers behind one OpenAI-compatible endpoint, with a web console for channels, API keys, quotas and usage logs. Use when the user asks to "self-host an LLM gateway", "give each team its own API key and budget", "route requests across several upstream providers with failover", "deploy new-api", or "point an OpenAI client at my own gateway". Lawful use with your own upstream keys only.
Как установить скилл new-api?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл new-api запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic