[API reference]

Images

Generate images from a text prompt with GPT Image 2 or FLUX.2 [pro]. Images are priced per image and returned as URLs or base64.

POST/v1/images/generations

Generate an image

curl https://api.topolabs.ai/v1/images/generations \  -H "Authorization: Bearer $TOPO_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "flux.2-pro",    "prompt": "Topographic contour map at night, thin lime lines on black",    "size": "1536x1024"  }'

Request body

  • modelstringRequired

    gpt-image-2 or flux.2-pro.

  • promptstringRequired

    What to draw. Up to 4,000 characters.

  • ninteger

    Number of images, from 1 to 4. Each is billed separately.

    Default: 1

  • sizestring

    1024x1024, 1536x1024 or 1024x1536.

    Default: 1024x1024

  • response_formatstring

    url or b64_json.

    Default: url

  • seedinteger

    Fix the seed for repeatable output. FLUX models only.

Response

response.json
json
{  "created": 1792142596,  "data": [{ "url": "https://cdn.topolabs.ai/img/7Hq2kf91.png" }],  "topo": { "node": "us-west-2", "gpu": "H100", "receipt": { "amount": "0.0300", "currency": "USDT" } }}

Image models

ModelKindPrice
GPT Image 2
gpt-image-2· OpenAI
Image
Per image
$0.053 / image
FLUX.2 [pro]
flux.2-pro· Black Forest Labs
Image
Per image
$0.03 / image
Veo 3.1
veo-3.1· Google
Video
Per second
$0.40 / second

Video

Video models such as veo-3.1 are billed per second of output ($0.40 per second) and run as async jobs on POST /v1/videos/generations. Poll the job, or pass a webhook_url to be called when it finishes.