Getting Started

API Quickstart

Make your first E2X API inference call in minutes. Create an API key, estimate job pricing in micro-cents, submit an image or video generation job, and poll results in cURL, TypeScript, Python, or Go.

1. Create an API Key & Fund Your Balance

Sign in to the E2X dashboard, open API Keys to create a key with the e2x_live_ prefix, and ensure your wallet holds positive balance on Billing. Keep submit_job and check_status enabled (both are granted by default).

Model Slug Convention

Models use canonical 3-part slugs: <provider>/<model>/<capability>, such as google/nano-banana-2.1/text-to-image or google/veo-3.1-fast/text-to-video. See the Models & Catalog reference to discover every model schema.

2. Submit Your First Generation Job

Jump directly to your stack or copy the SSR-rendered request below. All four examples invoke google/nano-banana-2.1/text-to-image (base price 60000 micro-cents / $0.06 per 1K request).

cURLquickstart.sh
# 1. Export your E2X API key
export E2X_API_KEY="e2x_live_your_64_hex_character_secret"

# 2. Submit an asynchronous text-to-image job
curl -s -X POST "https://api.e2x.ai/v1/jobs/submit" \
  -H "Authorization: Bearer ${E2X_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/nano-banana-2.1/text-to-image",
    "input": {
      "prompt": "Minimalist ceramic vase on travertine plinth, soft morning studio light",
      "aspect_ratio": "16:9",
      "resolution": "1k"
    }
  }'

# 3. Poll status using the returned jobId
curl -s "https://api.e2x.ai/v1/jobs/<JOB_ID>" \
  -H "Authorization: Bearer ${E2X_API_KEY}"
TypeScriptquickstart.ts — npm install @e2x/sdk
import { E2X } from '@e2x/sdk';

const client = new E2X(); // reads E2X_API_KEY from environment

const job = await client.run('google/nano-banana-2.1/text-to-image', {
  prompt: 'Minimalist ceramic vase on travertine plinth, soft morning studio light',
  aspect_ratio: '16:9',
  resolution: '1k',
}, {
  onUpdate: (snap) => console.log(`Progress: ${snap.progress}%`),
});

console.log('Result URL:', job.output?.outputs?.[0]?.url);
console.log(`Billed: $${job.cost_usd.toFixed(4)}`);
Pythonquickstart.py — pip install e2x
from e2x import E2X

client = E2X()  # reads E2X_API_KEY from environment

job = client.run(
    "google/nano-banana-2.1/text-to-image",
    {
        "prompt": "Minimalist ceramic vase on travertine plinth, soft morning studio light",
        "aspect_ratio": "16:9",
        "resolution": "1k",
    },
    on_update=lambda snap: print(f"Progress: {snap.progress}%"),
)

print(f"URL: {job.output_urls[0]} | Cost: ${job.cost_usd:.4f}")
Gomain.go — go get github.com/e2xai/e2x-go
package main

import (
	"context"
	"fmt"
	"github.com/e2xai/e2x-go"
)

func main() {
	ctx := context.Background()
	client, err := e2x.New() // reads E2X_API_KEY from environment
	if err != nil {
		panic(err)
	}

	job, err := client.Run(ctx, e2x.RunParams{
		Model: "google/nano-banana-2.1/text-to-image",
		Input: map[string]any{
			"prompt":       "Minimalist ceramic vase on travertine plinth, soft morning studio light",
			"aspect_ratio": "16:9",
			"resolution":   "1k",
		},
	})
	if err != nil {
		panic(err)
	}

	fmt.Println("Result:", job.OutputURL())
}

3. Inspect Submission & Completion Payloads

POST /v1/jobs/submit returns HTTP 200 immediately once the job is queued in Pub/Sub. Poll GET /v1/jobs/:jobId or attach a webhookUrl until status becomes completed or failed.

JSONPOST /v1/jobs/submit — 200 OK
{
  "success": true,
  "data": {
    "jobId": "job_01JX9R8P3M2W0F7H",
    "status": "pending",
    "estimatedCompletionTime": 12,
    "costMicroCents": 60000
  },
  "requestId": "req_4b2c71f9"
}
JSONGET /v1/jobs/:jobId — Completed Output
{
  "success": true,
  "data": {
    "jobId": "job_01JX9R8P3M2W0F7H",
    "status": "completed",
    "progress": 100,
    "output": "https://assets.e2x.ai/outputs/job_01JX9R8P3M2W0F7H.png",
    "outputs": [
      {
        "url": "https://assets.e2x.ai/outputs/job_01JX9R8P3M2W0F7H.png",
        "type": "image"
      }
    ],
    "failedGenerations": 0,
    "numberOfGenerations": 1,
    "requestedCount": 1,
    "successCount": 1,
    "failedCount": 0,
    "costMicroCents": 60000,
    "refundedMicroCents": 0,
    "error": null,
    "createdAt": "2026-11-13T12:00:00.000Z",
    "completedAt": "2026-11-13T12:00:08.000Z"
  },
  "requestId": "req_8c1d40a2"
}