Back to APIs

Unified Agent API

Image Generation

Image Generation

Generate images from text prompts with OpenAI's GPT Image models, at the size you choose.

POST/v1/images/generateUp to 4K

Overview

Generate images from text prompts

Credits

512px: 1, 1K: 2, 2K: 3, 4K: 5

Providers

Google GenAI

SDK Method

client.generate_image(...)

Modes

The mode parameter is a preset that configures optimal provider routing for common use cases. You can also set individual parameters directly for fine-grained control.

512px

1 credit

About 512 pixels on the longer side.

The default. Fastest and cheapest.

1K

2 credits

About 1024 pixels on the longer side.

Web and social images.

2K

3 credits

About 2048 pixels on the longer side.

Hero images and print at small sizes.

4K

5 credits

About 3840 pixels on the longer side.

Print and large displays.

Parameters

promptRequired

string

Image description.

aspect_ratio

select (default: 1:1)

Aspect ratio.

Square
Landscape
Portrait
image_size

select (default: 512px)

Image size: the longer side, about 512, 1024, 2048 or 3840 pixels. The price depends on it.

512px
1K
2K
4K

Example Response

{
  "success": true,
  "data": {
    "b64_json": "/9j/4AAQSkZJRgABAQAAAQABAAD...(base64 image data)",
    "content_type": "image/png",
    "prompt": "A minimal blue circle on white background",
    "aspect_ratio": "1:1",
    "image_size": "512px"
  },
  "metadata": {
    "provider_used": "openai",
    "providers_tried": [
      "openai"
    ],
    "mode_used": null,
    "response_time_ms": 9498,
    "request_id": "req_2f408e4c"
  },
  "credits_used": 1
}

Get Started

Create a Suprsonic API key in your dashboard, then call the endpoint with your key in the Authorization header.

Confirm your email and 25 free credits are added, no card needed. After them, your API calls continue with a free 7-day trial of Pro: a card is needed, and nothing is charged until the trial ends. When you need more, subscribe to a plan: Pro is $29 a month for 2,000 credits, Max $99 for 8,000 and Team $249 for 24,000.

Try Image Generation

Test Image Generation in the interactive playground. No setup required.

Open Playground