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
- Submit. Call
POST /v1/generatewithAuthorization: Bearer YOUR_API_KEY, a model ID such asgoogle/nano-banana-2/text-to-image, and aprompt. - 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.
- Process. Workers poll the upstream provider, store generated files on
file.eggapi.ai, and persist the task output. - 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:
https://eggapi.ai/llms.txt: index of the docs and the live model catalog with current prices.https://eggapi.ai/llms-full.txt: every docs page plus the full parameters of every published model, in one file.