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 (Synchronous)

Image models like nanobanana return results immediately:
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",
    "width": 1024,
    "height": 1024
  }'
Response:
{
  "data": {
    "id": "gen_abc123def456",
    "model": "nanobanana-pro",
    "urls": ["https://cdn.eggapi.ai/outputs/abc123.png"],
    "cost": "$0.0160"
  },
  "error": null
}

Generate a Video (Asynchronous)

Video models like veo3.1 are asynchronous - you submit a request and 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": "veo3.1",
    "prompt": "A cat playing with a ball of yarn",
    "duration": 5,
    "aspect_ratio": "16:9"
  }'

# 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": "veo3.1",
      "total_units": 25,
      "total_cost": "$2.0000",
      "request_count": 5
    }
  ],
  "error": null
}

Next Steps