aimod-cc/Agent2API

本地反向代理 + OpenAI 兼容 AI 网关:复用桌面客户端登录态,一个 base_url 调用十余家模型额度 · Local OpenAI-compatible gateway for AI coding clients — WorkBuddy, Raccoon, CatPaw, AutoClaw, Qoder, Cline, Accio, ZCode, CodeArts, Trae and more.

What it solves

Agent2API turns the login sessions of multiple AI desktop clients into one local OpenAI-compatible API gateway. Instead of paying for separate API keys, you reuse the model quotas already available in your own AI desktop apps (WorkBuddy, Trae, Qoder, etc.) through a single standard endpoint. Any client that supports a custom base_url can point to http://127.0.0.1:3065/v1 and start calling these accounts' models — no upstream API key needed, no client modifications.

How it works

You install Agent2API (as a desktop tray app or via Docker). On first run, it starts a local gateway on port 3065 and opens a management panel. You add AI desktop accounts through the panel — login via web, phone verification, pasting credentials, or importing local session data (depending on the provider). The gateway then authenticates as those accounts, forwards requests to the official upstream services, and exposes everything as a single OpenAI-compatible API (/v1/chat/completions, /v1/responses, /v1/messages, /v1/models). It handles automatic token refresh, rotates between multiple accounts when rate-limited (429), applies per-account proxy settings, and reports request statistics. Security is enforced by optional gateway keys (fail-closed by default) and human-verification on login. The Docker version offers the same functionality via a web panel, and can run in pure headless mode.

Who it’s for

People who already subscribe to AI desktop clients and want to use those subscriptions through programmatic API calls without buying separate API credits. It’s also for developers who want a unified interface across many providers or who want to learn about reverse proxying and multi-provider protocol adaptation. Note the README explicitly states this is for personal learning and research only — not for commercial use, reselling, or bypassing billing.

Highlights

  • OpenAI-compatible out of the box — supports Chat, Responses, and Messages endpoints; just set your base_url and a dummy API key.
  • 17 built‑in providers — including WorkBuddy, 小浣熊 (Raccoon), CatPaw, Qoder, Trae, and more; custom providers are also supported.
  • Automatic credential renewal — tokens refresh automatically and batch refresh is possible for expiring credentials.
  • Multi‑account rotation — requests are queued by priority, switch accounts on 429, and respect cooldown periods.
  • Per‑account outbound proxy — each account can have its own exit IP, and the gateway fingerprints outbound traffic to mimic official clients.
  • Comprehensive reports — request counts, success rates, token consumption, cache hit rates, and a 365‑day heatmap.
  • Scheduled tasks — auto check‑in, credential maintenance, and model list refresh can be managed from one page.
  • Balance and usage tracking — view per‑account balance and usage inline, with concurrent queries across accounts.
  • Two deployment modes — a desktop tray app (no Node needed) and a Docker container with the same port for panel and gateway, UI in six languages.

Related

  • Project
  • Project
  • Project
  • Project