Skip to main content

Prerequisites

Before you begin, you’ll need:
  1. An Egg API account - Sign up here
  2. An API key from your dashboard

Step 1: Get Your API Key

1

Sign up or log in

Go to eggapi.ai and create an account or log in.
2

Navigate to API Keys

In your dashboard, go to the API Keys section.
3

Create a new key

Click “Create API Key” and give it a name. Copy and save your key securely - you won’t be able to see it again.
Keep your API key secure. Never expose it in client-side code or public repositories.

Step 2: Make Your First Request

Generate an Image (Asynchronous)

All current models are asynchronous. The API returns a task ID that you poll for results. You can also pass webhook_url and use https://webhook.site/ to get a test callback URL.
curl -X POST https://api.eggapi.ai/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nanobanana-pro",
    "prompt": "A cute robot holding a coffee cup, digital art style",
    "aspect_ratio": "16:9",
    "webhook_url": "https://webhook.site/your-webhook-id"
  }'
Response:
{
  "data": {
    "id": "gen_abc123def456",
    "status": "pending",
    "model": "nanobanana-pro",
    "type": "image_generate",
    "cost": "$0.00",
    "created_at": "2025-12-25T21:03:47.879577+08:00"
  },
  "error": null
}

Poll for Results

Use the task ID from any model (image or video) to poll for results:
# Step 1: Submit the task
curl -X POST https://api.eggapi.ai/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nanobanana-pro",
    "prompt": "A cat playing with a ball of yarn",
    "aspect_ratio": "16:9",
    "webhook_url": "https://webhook.site/your-webhook-id"
  }'

# Response: {"data": {"id": "gen_xyz789", "status": "pending", ...}}

# Step 2: Poll for results
curl https://api.eggapi.ai/v1/tasks/gen_xyz789 \
  -H "Authorization: Bearer YOUR_API_KEY"

Step 3: Check Your Usage

View your API usage and costs:
curl https://api.eggapi.ai/v1/usage/summary \
  -H "Authorization: Bearer YOUR_API_KEY"
Response:
{
  "data": [
    {
      "model": "nanobanana-pro",
      "total_units": 10,
      "total_cost": "$0.1600",
      "request_count": 10
    },
    {
      "model": "nanobanana",
      "total_units": 20,
      "total_cost": "$0.2000",
      "request_count": 20
    }
  ],
  "error": null
}

Next Steps