su-kaka/agy2api

将 Antigravity 转换为 OpenAI 、GEMINI 和 Claude API 接口

What it solves

This project solves the problem of using Google's Antigravity platform (which provides access to models like Claude and Gemini) with standard API client tools. Many developers are familiar with OpenAI, Gemini, and Claude APIs, but Antigravity does not natively offer these formats. AGY2API converts Antigravity into a drop-in replacement for those three API styles, so you can use your existing code and clients without rewriting them.

How it works

AGY2API runs as a local server (default port 7861) that accepts requests in OpenAI, Gemini, or Claude format, translates them to Antigravity API calls, and streams the responses back. It manages multiple Google OAuth credentials, automatically rotating them for load balancing. The system monitors for errors like HTTP 429 (rate limit) and temporarily disables problematic credentials. It also offers features like automatic model name mapping, sensitive word filtering, request logging, and IP whitelisting. A web control panel lets you authenticate with Antigravity, upload or export credentials, and configure settings. Credentials are stored in SQLite by default, or PostgreSQL if configured.

Who it’s for

Developers and users who want to leverage Antigravity's model selection (Claude, Gemini, and more) through familiar API interfaces. It suits those running self-hosted services on Windows, Linux, macOS, Termux, or Docker, especially if they want a unified gateway that supports multiple credential rotation and management.

Highlights

  • Multi-format endpoints – Supports OpenAI /v1/chat/completions, Gemini native generateContent, and Claude /v1/messages in one service.
  • Intelligent credential pool – Automatically rotates Google OAuth credentials, handles rate-limit cooldowns, and disables failing ones.
  • Streaming and anti-truncation – Real-time SSE streaming plus an optional “anti-truncation” mode (prefix model name with 抗截断-) that uses synthetic tool calls to avoid cut-off responses.
  • Web admin console – A React‑based UI for OAuth login, credential upload/export, batch operations, and system configuration.
  • Flexible deployment – One‑click installers for Termux, Windows, Linux, macOS, and Docker, with optional PostgreSQL and Redis for multi‑instance setups.

Related

  • Project
  • Project
  • Project
  • Project