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" }'image = client.images.generate( model="flux.2-pro", prompt="Topographic contour map at night, thin lime lines on black", size="1536x1024",) print(image.data[0].url)const image = await client.images.generate({ model: "flux.2-pro", prompt: "Topographic contour map at night, thin lime lines on black", size: "1536x1024",}); console.log(image.data[0].url);Request body
modelstringRequiredgpt-image-2orflux.2-pro.promptstringRequiredWhat to draw. Up to 4,000 characters.
nintegerNumber of images, from
1to4. Each is billed separately.Default:
1sizestring1024x1024,1536x1024or1024x1536.Default:
1024x1024response_formatstringurlorb64_json.Default:
urlseedintegerFix 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
| Model | Kind | Price |
|---|---|---|
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.