EggAPI/docs
sign in

EggAPI Documentation

One API key for image and video generation models from ByteDance, Google, OpenAI, and Alibaba

EggAPI is an AI model gateway for production generation workloads. One API key and one REST endpoint give you image models (Seedream, Nano Banana, GPT Image 2) and video models (Seedance, Wan). EggAPI authenticates the request, creates an asynchronous task, routes it to an upstream provider with automatic fallback, stores the output files, bills your balance, and can notify your webhook when the task finishes.

  • Quickstart: Create an API key, submit a task, and poll the result.
  • Models: Every published model ID, its generation type, and how it is billed.
  • Connect AI Agents (MCP): Let Claude Code, Codex, or Cursor generate images and videos with your key.
  • API Reference: Base URL, response envelope, status codes, pagination, and every endpoint.

How EggAPI Works

  1. Submit. Call POST /v1/generate with Authorization: Bearer YOUR_API_KEY, a model ID such as google/nano-banana-2/text-to-image, and a prompt.
  2. Route. The Go backend validates your key, creates a task, and sends it through the model's provider route chain, falling back to the next provider when one fails.
  3. Process. Workers poll the upstream provider, store generated files on file.eggapi.ai, and persist the task output.
  4. Settle. EggAPI deducts your balance, writes a usage record, and sends a signed webhook if you supplied webhook_url.

First Request

bash
curl -X POST https://api.eggapi.ai/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/nano-banana-2/text-to-image",
    "prompt": "A clean product render of a ceramic espresso cup on a walnut desk",
    "aspect_ratio": "16:9",
    "resolution": "1k"
  }'

POST /v1/generate returns 202 Accepted with a task in status pending. Poll GET /v1/tasks/{id} until the status becomes completed or failed, or pass webhook_url to be called back.

For AI Assistants

These docs are available as plain text for LLMs:

connected
mcp https://api.eggapi.ai/mcp
models ...
Claude Code · Codex · MCP
█