silasxbt/anti-api

Turn Antigravity / codex / github copilot into Anthropic & Openai API compatible server. Usable with Claude Code / Xcode etc.

Anti‑API – a local compatibility‑and‑routing proxy for LLM providers

What it is – Anti‑API is a self‑hosted service that sits between your code (or any OpenAI‑/Anthropic‑compatible client) and a collection of large‑language‑model providers. It translates the standard OpenAI/Anthropic request format into the native APIs of six supported back‑ends (OpenAI‑style Antigravity, OpenAI Codex, GitHub Copilot, Zed‑hosted models, Amazon Kiro, and xAI Grok) and routes each request according to a configurable policy.

Why it matters – Many developers use the OpenAI API shape in their applications, but they may have access to multiple paid accounts or alternative providers. Anti‑API lets you:

  • Consolidate those accounts behind a single endpoint (http://localhost:8964).
  • Balance load, respect quota limits, and automatically fall back on another account when a provider returns 429/404 errors.
  • Expose a public, token‑gated inference gateway (port 8966) for remote clients without leaking credentials or management UI.
  • Use the same client code for text‑only, multimodal (image) and tool‑calling requests across providers.

Key features (as described in the README)

  • Six providers – Antigravity, ChatGPT Codex, GitHub Copilot, Zed hosted models, Amazon Kiro, xAI Grok.
  • Dual API compatibility – Accepts both OpenAI‑style and Anthropic‑style request bodies.
  • Smart routing – Two routing modes:
    • Flow routing – custom model identifiers map to user‑defined “flows”.
    • Account routing – provider‑native model IDs are dispatched to specific accounts, with sticky‑cursor rotation on quota or error conditions.
  • Multimodal safety – Validates and converts image URLs or base‑64 image blocks before forwarding them to the target provider.
  • OAuth & PKCE handling – Built‑in device‑code flow for Copilot and secure PKCE flows for Antigravity/Codex, with loop‑back callbacks and optional insecure‑TLS overrides for restricted networks.
  • Dashboard – Local web UI (loopback only) shows quota usage, routing config, and account diagnostics.
  • Remote tunneling – One‑click ngrok/cloudflared/localtunnel setup for exposing the inference‑only listener.
  • Docker & package manager support – Pre‑built multi‑arch Docker images, Homebrew, WinGet, and portable Windows bundles.
  • Security boundaries – Management API and dashboard bind to 127.0.0.1; the public inference listener requires a secret token (ANTI_API_PUBLIC_TOKEN). Credential files are stored locally under ~/.anti-api and never logged.

Quick start (summary)

  • Linux/macOSbun install && bun run src/main.ts start (default port 8964).
  • Windows – double‑click start.bat (or run the installed anti-api command).
  • Docker – pull ghcr.io/silasxbt/anti-api:latest and run with a control‑plane token, e.g.
export ANTI_API_CONTROL_TOKEN=$(openssl rand -hex 32)

docker run -d \
  -p 127.0.0.1:8964:8964 \
  -e ANTI_API_CONTAINER_CONTROL_PLANE=1 \
  -e ANTI_API_CONTROL_TOKEN=$ANTI_API_CONTROL_TOKEN \
  -v anti-api-data:/app/data \
  ghcr.io/silasxbt/anti-api:latest
  • Open http://localhost:8964/quota?control_token=<your‑token> to bootstrap OAuth login for the desired providers, then point your client at http://localhost:8964.

Architecture snapshot

Anti‑API (port 8964) ──► Dashboard / Settings / Routing UI (loopback only)
                     │
                     ├─► Smart Routing Engine
                     │    • Flow routing (custom IDs)
                     │    • Account routing (provider‑native IDs)
                     │    • Cool‑down‑aware failover & sticky rotation
                     │
                     └─► Provider adapters
                          ├─ Antigravity (OpenAI‑style)
                          ├─ Codex
                          ├─ GitHub Copilot (device‑code flow)
                          ├─ Zed hosted models
                          ├─ Amazon Kiro
                          └─ xAI Grok

Upstream calls go to the respective cloud APIs (Google, OpenAI, GitHub, Zed, etc.). A separate public listener on port 8966 serves inference‑only requests when ANTI_API_PUBLIC_TOKEN is set.

Who might use it

  • Teams that hold multiple paid LLM accounts and want a single, consistent endpoint.
  • Developers building open‑source tools that expect the OpenAI/Anthropic API shape but wish to run locally against alternative back‑ends.
  • Self‑hosted services that need to expose an LLM gateway without revealing credential files.

Limitations / cautions

  • The project is unofficial; some providers may change their private endpoints, causing breakage.
  • Remote inference is token‑gated; exposing the public listener without a strong token is insecure.
  • Certain providers (e.g., Antigravity) require periodic client‑version refreshes; disabling that check may lead to incompatibilities.
  • Multimodal conversion is limited to the image formats supported by each downstream provider.

All information above is taken directly from the repository’s README; no additional features have been inferred.

Related

  • Project
  • Project
  • Project
  • Project