> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eggapi.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# EggAPI Documentation

> Use one API key to route public nano-banana image generation through EggAPI

EggAPI is an AI model gateway for production generation workloads. The current public catalog exposes nano-banana image generation. Your application calls one REST API, EggAPI authenticates the request, creates a generation task, routes it to an upstream provider, records usage, deducts balance, stores generated files when needed, and can notify your webhook when the task finishes.

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/en/quickstart">
    Create an API key, submit a generation task, and poll the result.
  </Card>

  <Card title="Authentication" icon="key" href="/en/guides/authentication">
    Send API keys with the Bearer token format used by the backend.
  </Card>

  <Card title="Model" icon="cube" href="/en/guides/models">
    Review the single model currently published for public use.
  </Card>

  <Card title="API Reference" icon="code" href="/en/api-reference/introduction">
    See response envelopes, pagination, errors, and OpenAPI-backed endpoints.
  </Card>
</CardGroup>

## How EggAPI Works

<Steps>
  <Step title="Submit">
    Call `POST /v1/generate` with `Authorization: Bearer YOUR_API_KEY`, a supported `model`, and a `prompt`.
  </Step>

  <Step title="Route">
    The Go backend validates your key, creates a task, and sends it through the configured provider route chain.
  </Step>

  <Step title="Process">
    Workers poll upstream providers, apply fallback when routes fail, upload generated files to R2 when needed, and persist task output.
  </Step>

  <Step title="Settle">
    EggAPI deducts balance, writes usage records, and sends a signed webhook if you supplied `webhook_url`.
  </Step>
</Steps>

## First Request

```bash theme={null}
curl -X POST https://api.eggapi.ai/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nanobanana",
    "prompt": "A clean product render of a ceramic espresso cup on a walnut desk",
    "aspect_ratio": "16:9",
    "num_outputs": 1,
    "webhook_url": "https://webhook.site/your-webhook-id"
  }'
```

The current public generation API returns a task object with status `pending`. Use `GET /v1/tasks/{id}` until the status becomes `completed` or `failed`.

<Note>
  The current public catalog only exposes nano-banana. Use `nanobanana` as the API `model` value.
</Note>
