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 是一个本地反向代理,把各种 AI 桌面编程客户端(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 镜像,以无头方式运行同一个网关和可选的网页管理面板。
怎么让它跑起来?从 Releases 下载 NSIS 安装程序并运行(它会在 3065 端口启动本地网关),通过登录弹窗为某个提供商添加账号,然后把你的 OpenAI 风格客户端的 base_url 指向本地网关地址。
只是使用它需要安装 Node.js 或 Rust 吗?不需要——打包好的桌面版不需要 Node 或其他运行时;只有当你想自己从源码构建时,才需要 Node 和 Rust/Tauri 工具链。
在 Docker 里登录每个提供商的方式都一样吗?不一样——基于网页的登录(WorkBuddy、Qoder、Cline)在 Docker 镜像里没问题,但登录需要本地桌面回调的提供商(AutoClaw、CatPaw、Accio、CodeArts、Trae)在那里行不通;你只能改为手动粘贴凭证。
我能在 Linux 或 macOS 上运行它,还是只有 Windows 能用?现成的安装程序只有 Windows 版;在 Linux(或任何 amd64/arm64 的 Docker 主机)上,你可以改用项目提供的 Docker Compose 配置自行托管同一个网关。
这个网关暴露哪些 API 端点?它暴露 OpenAI/Anthropic 风格的端点:/v1/chat/completions、/v1/responses、/v1/messages(包括 count_tokens)和 /v1/models,在所有支持的提供商上处理方式一致。
为什么要用它,而不是直接花钱买 API 密钥?它让你复用提供商桌面客户端账号里已有的模型额度,而不是另外购买上游 API 密钥,方式是通过本地网关重放该客户端自己的登录会话。
我网络里的其他设备能用我的网关吗?可以——启用局域网访问后它会监听所有接口,但你必须先注册一个面板管理员并设置网关 API 密钥,因为代理在没有密钥时会拒绝转发请求。
为什么浏览器页面不能直接调用网关?网关默认不响应 CORS 预检请求,所以浏览器直接的 fetch 调用会被拒绝;你要么在设置中启用跨域访问,要么让你的页面与网关同源,并把 /v1 反向代理到网关。
作者
aimod-cc
大小
52.1 MB
星标
2.5K
时长
2个月
提交 · 90 天