BazaarLinkBazaarLink
Sign in
DocsAPI ReferenceSDK ReferenceAgentic UsageAI Skills
Images

Generate an image

Generates an image from a text prompt. Returns OpenAI-compatible sync JSON by default (works with client.images.generate()); pass stream: true to get an SSE event stream instead. Image-to-image is supported via inputImages / input_references.

POST/api/v1/images/generations

Authorizations

Authorizationrequired
string · header

API key as bearer token in the Authorization header.

Body

modelrequired
string

The image generation model to use, provider-qualified, e.g. "openai/gpt-image-2".

minLength: 1
Example: "openai/gpt-image-2"
promptrequired
string

Text description of the desired image.

minLength: 1
Example: "a red cat on a sofa"
n
integer

Number of images to generate, 1–10.

1–10
Example: 1
size
string

Image size — explicit pixels ("2048x2048") or a tier ("2K", "4K"). Forwarded to the provider as-is; supported sizes vary by model.

Example: "1024x1024"
stream
boolean

Selects the response shape: omitted or false = OpenAI-compatible sync JSON (the default), true = SSE event stream.

input_references
string[]

Source images for image-to-image (data: or https: URLs), up to 8. Alias of inputImages (industry-conventional field name); both pass content moderation first. Returns 400 — not a warning — when the model's route does not support i2i.

≤ 8 images
aspect_ratio
enum<string>

Aspect ratio of the generated image. Natively supported on some model routes — check supported_parameters in the GET /api/v1/images/models response for each model; unsupported routes ignore the field and note it in the response's warnings[] (the request still succeeds).

1:11:21:41:82:12:33:23:44:14:34:55:48:19:1616:99:19.519.5:99:2020:99:2121:9auto
Example: "16:9"
resolution
enum<string>

Resolution tier; concrete pixels are derived per provider. Natively supported on some model routes — check supported_parameters in the GET /api/v1/images/models response for each model; unsupported routes ignore the field and note it in the response's warnings[] (the request still succeeds).

5121K2K4K
Example: "2K"
quality
enum<string>

Rendering quality. Natively supported on some model routes — check supported_parameters in the GET /api/v1/images/models response for each model; unsupported routes ignore the field and note it in the response's warnings[] (the request still succeeds).

autolowmediumhigh
background
enum<string>

Background treatment; transparent requires an alpha-capable output_format (png/webp). Natively supported on some model routes — check supported_parameters in the GET /api/v1/images/models response for each model; unsupported routes ignore the field and note it in the response's warnings[] (the request still succeeds).

autotransparentopaque
output_format
enum<string>

Encoding of the returned image bytes. Natively supported on some model routes — check supported_parameters in the GET /api/v1/images/models response for each model; unsupported routes ignore the field and note it in the response's warnings[] (the request still succeeds).

pngjpegwebpsvg
Example: "png"
output_compression
integer

Compression level (0–100) for webp/jpeg output; ignored for png. Natively supported on some model routes — check supported_parameters in the GET /api/v1/images/models response for each model; unsupported routes ignore the field and note it in the response's warnings[] (the request still succeeds).

0–100
Example: 100
seed
integer

Deterministic sampling seed; identical seed + parameters should reproduce the result, though not all providers guarantee it. Natively supported on some model routes — check supported_parameters in the GET /api/v1/images/models response for each model; unsupported routes ignore the field and note it in the response's warnings[] (the request still succeeds).

Deep guide →

POST /api/v1/images/generations
curl https://bazaarlink.ai/api/v1/images/generations \
  -H "Authorization: Bearer $BAZAARLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-image-2",
    "prompt": "a red cat on a sofa",
    "size": "1024x1024"
  }'
Response examples

Success. By default (or stream: false) returns the sync JSON below; with stream: true, returns an SSE event stream (see the deep guide for the event protocol). Parameters ignored by the route appear in top-level warnings[] (informational only).

{
  "created": 1753500000,
  "data": [
    {
      "url": "https://bazaarlink.ai/api/v1/images/proxy/eyJhbGciOi..."
    }
  ],
  "warnings": [
    {
      "param": "aspect_ratio",
      "action": "dropped",
      "reason": "'aspect_ratio' is not yet mapped for this model's upstream and was ignored; the image was still generated using the model's default."
    }
  ]
}
Support
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.
Generate an image — BazaarLink API