Image Generation
Generate images from a text prompt with Qubax's image generation endpoint. It mirrors the OpenAI Images API, so any client built for /v1/images/generations works unchanged when pointed at the Qubax base URL.
Endpoint
POST https://api.qubax.ai/v1/images/generationsAll requests require an API key passed as a Bearer token in the Authorization header:
Authorization: Bearer qbx_live_...
Content-Type: application/jsonRequest Body
The request body is a JSON object with the parameters below.
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | ID of the model to use (e.g. flux-1.1-pro — see /v1/models for all image models). |
| prompt | string | Yes | A text description of the desired image. Max 4,000 chars. |
| n | integer | No | Number of images to generate. Default 1. |
| size | string | No | Dimensions of the image, e.g. 1024x1024. Defaults vary by model. |
| response_format | string | No | Always b64_json — images are returned inline as base64-encoded PNG. There is no URL mode. |
Available Image Models
Qubax routes image generation through several state-of-the-art model families. The table below lists the most commonly used models (all available via /v1/models).
| Model ID | Provider / Notes |
|---|---|
| flux-1.1-pro | Black Forest Labs Flux 1.1 — fast, high quality. Recommended default. |
| flux-2-max | Black Forest Labs Flux 2 Max — highest fidelity. |
| nano-banana-2 | Google Nano Banana 2 — strong prompt adherence. |
| gpt-image-2 | OpenAI GPT Image 2 — integrated captions, edits. |
| seedream-4.5 | ByteDance Seedream V4.5 — photorealistic. |
n value. When a combination is unsupported the API returns a 400 describing the constraint.Python SDK Example
Using the OpenAI Python SDK pointed at the Qubax base URL:
from openai import OpenAI
client = OpenAI(
api_key="qbx_live_...",
base_url="https://api.qubax.ai/v1",
)
response = client.images.generate(
model="flux-1.1-pro",
prompt="a cat in space, photorealistic",
n=1,
size="1024x1024",
)
# Images are returned inline as base64 — decode and save
import base64
from pathlib import Path
Path("cat.png").write_bytes(base64.b64decode(response.data[0].b64_json))
print("Wrote cat.png")cURL Example
curl https://api.qubax.ai/v1/images/generations \
-H "Authorization: Bearer qbx_live_..." \
-H "Content-Type: application/json" \
-d '{
"model": "flux-1.1-pro",
"prompt": "a cat in space, photorealistic",
"n": 1,
"size": "1024x1024"
}'Response Format
A successful request returns a JSON object with a data array. Each entry contains a b64_json field holding the base64-encoded PNG image (there is no URL mode — images always come back inline).
{
"created": 1719792000,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}
]
}Saving the Image
Decode the base64 string and write the bytes to disk — in Python use base64.b64decode(response.data[0].b64_json), in shell pipe the JSON through jq -r '.data[0].b64_json' | base64 -d > image.png.
Ready to build?
400+ models through one OpenAI-compatible API, up to 99% below OpenRouter.