API reference
Image generation
POST /v1/images/generations — generate images from a text prompt.
POST https://api.qubittron.ai/v1/images/generationsOpenAI-compatible image generation.
Authentication
Authorization: Bearer qbt_<key>
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | yes | Image model id |
prompt | string | yes | Text description |
n | number | no | How many images (default 1) |
size | string | no | e.g. "1024x1024" |
output_format | string | no | e.g. "png", "jpeg" |
quality | string | no | Model-dependent |
response_format | "b64_json" | "url" | no | Default depends on model |
Supported models
| Model | Notes |
|---|---|
stable-diffusion-xl-base-v10 | SDXL base, 3.5B params |
Examples
curl https://api.qubittron.ai/v1/images/generations \
-H "Authorization: Bearer $QUBITTRON_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "stable-diffusion-xl-base-v10",
"prompt": "a small red apple on a white background"
}'import OpenAI from "openai";
import { writeFileSync } from "node:fs";
const client = new OpenAI({
baseURL: "https://api.qubittron.ai/v1",
apiKey: process.env.QUBITTRON_API_KEY,
});
const res = await client.images.generate({
model: "stable-diffusion-xl-base-v10",
prompt: "a small red apple on a white background",
});
const b64 = res.data?.[0]?.b64_json;
if (b64) writeFileSync("/tmp/apple.png", Buffer.from(b64, "base64"));import { writeFileSync } from "node:fs";
const res = await fetch("https://api.qubittron.ai/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.QUBITTRON_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "stable-diffusion-xl-base-v10",
prompt: "a small red apple on a white background",
}),
});
const json = (await res.json()) as {
created: number;
data: { b64_json?: string; url?: string }[];
};
const b64 = json.data[0]?.b64_json;
if (b64) writeFileSync("/tmp/apple.png", Buffer.from(b64, "base64"));Response
{
"created": 1735689600,
"data": [
{
"b64_json": "iVBORw0KGgo...",
"url": null
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | Body failed validation |
| 400 | model_not_found | Model unknown or doesn't support image generation |
| 401 | invalid_api_key | Missing/invalid Bearer token |
| 402 | insufficient_funds | Account credit exhausted |
| 429 | rate_limit_exceeded | Rate limit hit |
| 502 | upstream_error | Upstream returned 5xx or unparseable JSON |
Pricing
Metered per image generated (data[].length).