Qubittron Bastion
API reference

Image generation

POST /v1/images/generations — generate images from a text prompt.

POST https://api.qubittron.ai/v1/images/generations

OpenAI-compatible image generation.

Authentication

Authorization: Bearer qbt_<key>

Request body

FieldTypeRequiredNotes
modelstringyesImage model id
promptstringyesText description
nnumbernoHow many images (default 1)
sizestringnoe.g. "1024x1024"
output_formatstringnoe.g. "png", "jpeg"
qualitystringnoModel-dependent
response_format"b64_json" | "url"noDefault depends on model

Supported models

ModelNotes
stable-diffusion-xl-base-v10SDXL 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

StatusCodeWhen
400invalid_requestBody failed validation
400model_not_foundModel unknown or doesn't support image generation
401invalid_api_keyMissing/invalid Bearer token
402insufficient_fundsAccount credit exhausted
429rate_limit_exceededRate limit hit
502upstream_errorUpstream returned 5xx or unparseable JSON

Pricing

Metered per image generated (data[].length).

On this page