Agent2API README

README проекта с github.com/aimod-cc/Agent2API. Одним файлом markdown: README.md.

Agent2API

An AI routing gateway with Agent client takeover, unifying model APIs and local client configuration

English | 简体中文 | 繁體中文 | 日本語 | 한국어 | Português (BR)

license release docker pulls stars platform

✨ Key Features • 💬 Community & Support • 🚀 Quick Start • 📦 Installation & deployment • 📸 Screenshots • 🔧 Development & Build • 📜 Usage Notice


Agent2API is an AI routing gateway with Agent client takeover. It exposes a unified model API for custom AI providers and centralizes account routing, model mapping, gateway keys and request reports. It also manages local Agent clients' connection profiles, including importing, switching and previewing configuration changes.

✨ Key Features

❤️ Sponsors

Thanks to Beichen API, IPWO and ProxyLane for sponsoring this project.

Beichen API
Beichen API
One API for multiple leading model providers.
Beichen offers an OpenAI-compatible AI API relay with streaming responses and connection support for long-reasoning models. Select the first card in Agent2API's Add account → API templates, then enter your own API key alongside the prefilled endpoint.

Register / Get an API key ↗
IPWO
IPWO Residential IPs
Rotating, static and unlimited residential proxy plans.
IPWO offers residential IPs across multiple regions, with country- and city-level targeting and HTTP(S) / SOCKS5 support. Add the proxy address in Agent2API's Network proxy page for use by accounts and service routes.

Explore plans / Get residential IPs ↗
ProxyLane
ProxyLane Static ISP
Dedicated native static residential ISP proxies for AI accounts.
IPs come from real home broadband operators with low Scamalytics fraud scores, and each IP is dedicated to you with unlimited traffic starting from $3.90. Add one exit per account on Agent2API's Network proxy page. Use code AGENT2API25 for 25% off your first purchase.

Explore plans / Get static IPs ↗

💬 Community & Support

🚀 Quick start

Three forms — pick the one that matches your setup; the complete install, upgrade, uninstall and troubleshooting guide is in Installation & deployment.

Form Artifact Interface
Desktop (Windows / macOS / Linux) Agent2API_<version>_x64-setup.exe, _universal.dmg, _amd64.deb, _amd64.AppImage App window
Server (Windows Server / Linux, headless) agent2api-server-windows-amd64.zip, agent2api-server-linux-<arch>.tar.gz Browser panel
Docker aimodcc/agent2api:latest (amd64 / arm64) Browser panel

Desktop: add a custom provider and account, create a gateway key, then apply a connection profile on the Agent page or configure your client with http://127.0.0.1:3065/v1 and that key. Additional provider capabilities require the corresponding plugin.

Server (no GUI; registered as a system service and started at boot):

# Linux
tar -xzf agent2api-server-linux-amd64.tar.gz && cd agent2api-server-linux-amd64 && sudo bash install.sh
# Windows Server (administrator PowerShell)
Expand-Archive agent2api-server-windows-amd64.zip -DestinationPath C:\agent2api-pkg
cd C:\agent2api-pkg; .\install-service.ps1

Docker:

docker run -d --name agent2api --restart unless-stopped -p 3065:3065 -v ./data:/data aimodcc/agent2api:latest

Whichever form you pick, open the panel afterwards (http://127.0.0.1:3065/; use the host IP for the server and Docker forms), register the admin account, then create a key on the "Gateway Keys" page. Connectivity check: curl http://127.0.0.1:3065/health

Mobile: open http://<gateway IP>:3065/m in a browser (you can "Add to Home Screen" for a full-screen PWA). For a standalone icon, install Agent2API-<version>.apk (Android) or Agent2API-<version>.ipa (iOS, unsigned — re-sign it yourself) from the Release. Details: Install & deploy → Mobile.

📸 Screenshots

Accounts

Accounts page: global queue, per-model rate-limit cooldown, expiry and balance

Add account:

Add account: choose provider and edition, then sign in on the web

Model management

Model management: per-provider model catalog with rate, context and mappings

Report

Overview: requests / success rate / tokens / top model, with account and provider rankings, usage donuts and a 365-day activity heatmap:

Report overview: stat cards, top accounts / providers, model and provider usage donuts

Trends: 24-hour cache hit rate (line) and token consumption (area) on twin axes, with a per-day token bar chart below:

Report trends: dual-axis cache hit rate and token consumption, per-day token bars

🔧 Development & Build

Requirements

Common scripts

npm run tauri:install      # Install desktop dependencies (same as npm --prefix desktop-tauri install)
npm run tauri:dev          # Launch the desktop app in dev mode (with hot reload)
npm run tauri:build        # Build the desktop installer

npm run build:icon         # Generate the icon source image (run after changing the icon design, then run tauri icon)

The build artifact is target/release/bundle/nsis/Agent2API_<version>_x64-setup.exe (about 8.6 MB as of 3.0; src-tauri/.cargo/config.toml points cargo's target-dir at the project root's target/).

The macOS .dmg can only be built on macOS (npm --prefix desktop-tauri run build -- --target universal-apple-darwin) — it cannot be cross-compiled from Windows, so the official artifact comes from the CI build workflow (macos-latest, two targets merged). Docker images and the server archives used for in-container updates come from the same workflow's linux-server job, which reuses the Dockerfile's compile path so the executable inside is built from the same toolchain as the image.

📜 Usage Notice

Credential and data security

Account credentials are encrypted in the local database, but exports, backups and key files may still contain sensitive data. Keep them private; do not upload them to public repositories or cloud storage, or share them with others.

No warranty

The project is provided "as is", without guarantees of availability, stability, security or suitability for a particular purpose. Trademarks and services belong to their respective owners. The complete license and warranty terms are in LICENSE.

📄 License

This project uses the same GNU Affero General Public License v3.0 (AGPL-3.0) as the provider plugin repository. Use, modification and distribution, including commercial use, are permitted under the license. Preserve copyright and license notices and fulfill applicable source-code obligations. If you offer a modified version over a network, you must offer its Corresponding Source to those users.

⭐ Star History

Star History Chart

Download the latest release • Report an issue

If this project helps you, a ⭐️ Star is appreciated!

Agent2API (aimod-cc/Agent2API)

Ищем в базе…

Что это?Agent2API — локальный обратный прокси, который превращает логин-сессии разных настольных ИИ-кодинг-клиентов (WorkBuddy, Raccoon/CatPaw, AutoClaw, Qoder, Cline, Accio, ZCode, CodeArts, Trae, Loomy, KukuAI, MonkeyCode, Antigravity и других) в единый OpenAI-совместимый API-шлюз, так что любой клиент, принимающий кастомный base_url, может расходовать квоты моделей этих клиентов через один эндпоинт, без апстримного API-ключа.
Это десктоп-приложение, CLI или просто бэкенд-сервис?Он поставляется как десктоп-приложение на Tauri (бэкенд на Rust + простой фронтенд на HTML/CSS/JS) с системным треем, плюс Docker-образ, который запускает тот же шлюз и опциональную веб-админку в headless-режиме.
Как его запустить?Скачайте NSIS-установщик из Releases и запустите его (он поднимает локальный шлюз на порту 3065), добавьте аккаунт провайдера через всплывающее окно входа, затем направьте base_url вашего клиента в стиле OpenAI на адрес локального шлюза.
Нужны ли установленные Node.js или Rust, чтобы просто им пользоваться?Нет — готовой десктоп-сборке не нужны Node или другой рантайм; Node и тулчейн Rust/Tauri требуются, только если хотите собрать его сами из исходников.
Вход во всех провайдеров работает одинаково в Docker?Нет — веб-входы (WorkBuddy, Qoder, Cline) в Docker-образе работают нормально, но провайдеры, чей вход требует локального колбэка на десктопе (AutoClaw, CatPaw, Accio, CodeArts, Trae), там не работают; вместо этого придётся вставить учётные данные вручную.
Можно ли запустить это на Linux или macOS, или это только Windows?Готовый установщик только для Windows; на Linux (или любом Docker-хосте, amd64/arm64) можно самостоятельно развернуть тот же шлюз через прилагаемую конфигурацию Docker Compose.
Какие API-эндпоинты открывает шлюз?Он открывает эндпоинты в стиле OpenAI/Anthropic: /v1/chat/completions, /v1/responses, /v1/messages (включая count_tokens) и /v1/models, обрабатываемые одинаково для всех поддерживаемых провайдеров.
Зачем это использовать вместо простой покупки API-ключа?Он позволяет переиспользовать квоту модели, которая уже есть у вас в аккаунте настольного клиента провайдера, вместо покупки отдельного апстримного API-ключа, проигрывая собственную логин-сессию этого клиента через локальный шлюз.
Могут ли другие устройства в моей сети использовать мой шлюз?Да — включение доступа по LAN заставляет его слушать все интерфейсы, но сначала нужно зарегистрировать админа панели и задать API-ключ шлюза, ведь прокси отказывается пересылать запросы без него.
Почему страница в браузере не может обращаться к шлюзу напрямую?По умолчанию шлюз не отвечает на CORS preflight-запросы, поэтому прямые fetch-вызовы из браузера отклоняются: либо включите доступ с других источников в настройках, либо раздавайте страницу с того же источника и проксируйте /v1 на шлюз через реверс-прокси.
Какие есть похожие проекты?ccx, Persona-Forge, ThinkWatch-Lite, openfang, workbuddy2api-panel, grok2api, gpt-load, openclaw-zero-token
Автор
aimod-cc
Размер
52.1 MB
Звёзды
2.5K
Возраст
2 мес
Коммиты · 90 дней