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

Text
POST https://api.qubax.ai/v1/images/generations

All requests require an API key passed as a Bearer token in the Authorization header:

Text
Authorization: Bearer qbx_live_...
Content-Type: application/json

Request Body

The request body is a JSON object with the parameters below.

ParameterTypeRequiredDescription
modelstringYesID of the model to use (e.g. flux-1.1-pro).
promptstringYesA text description of the desired image. Max 4,000 chars.
nintegerNoNumber of images to generate. Default 1.
sizestringNoDimensions of the image, e.g. 1024x1024. Defaults vary by model.
response_formatstringNoEither url or b64_json. Default url.

Available Image Models

Qubax routes image generation through several state-of-the-art model families. The table below lists the most commonly used models.

Model IDProvider / Notes
flux-1.1-proBlack Forest Labs — high quality, fast. Recommended default.
dall-e-3OpenAI — strong prompt adherence, integrated captions.
flux-1.1-pro-ultraBlack Forest Labs — up to 4K resolution.
flux-1-schnellBlack Forest Labs — fastest variant, lower fidelity.
ℹ️
Not every model supports every size or 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:

Python
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",
)

# Default response_format is "url" — print the generated image URL
print(response.data[0].url)

cURL Example

Shell
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 either a url or, when response_format is b64_json, a base64-encoded PNG string under b64_json.

JSON
{
  "created": 1719792000,
  "data": [
    {
      "url": "https://cdn.qubax.ai/images/abc123-generated.png"
    }
  ]
}

With response_format: "b64_json" the same shape returns the image inline:

JSON
{
  "created": 1719792000,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
    }
  ]
}

Downloading the Image

URLs returned in response_format: "url" mode are temporary. If you need to keep the image, download it promptly or request b64_json and persist the bytes yourself.