Generate images from text prompts using the OpenAI-compatible images API.WhollyAPI supports the OpenAI-compatible image generation API. The default model is FLUX Schnell. The endpoint is:
More APIs
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Generate images from text prompts using the OpenAI-compatible images API.WhollyAPI supports the OpenAI-compatible image generation API. The default model is FLUX Schnell. The endpoint is:
POST https://whollyapi.com/v1/openai/images/generations
import io
import base64
from PIL import Image
from openai import OpenAI
client = OpenAI(
api_key="$WHOLLYAPI_TOKEN",
base_url="https://whollyapi.com/v1/openai"
)
response = client.images.generate(
prompt="A photo of an astronaut riding a horse on Mars.",
size="1024x1024",
n=1,
)
b64_json = response.data[0].b64_json
image_bytes = base64.b64decode(b64_json)
image = Image.open(io.BytesIO(image_bytes))
image.save("output.png")
import * as fs from "fs";
import OpenAI from "openai";
const openai = new OpenAI({
baseURL: "https://whollyapi.com/v1/openai",
apiKey: "$WHOLLYAPI_TOKEN",
});
const response = await openai.images.generate({
prompt: "A photo of an astronaut riding a horse on Mars.",
size: "1024x1024",
n: 1,
});
const b64Json = response.data[0].b64_json;
const imageBuffer = Buffer.from(b64Json, "base64");
fs.writeFileSync("output.png", imageBuffer);
curl "https://whollyapi.com/v1/openai/images/generations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $WHOLLYAPI_TOKEN" \
-d '{
"prompt": "A photo of an astronaut riding a horse on Mars.",
"size": "1024x1024",
"n": 1
}'
| Parameter | Notes |
|---|---|
prompt | Text description of the image |
model | Defaults to FLUX Schnell |
size | Image dimensions (e.g., "1024x1024") |
n | Number of images to generate |
response_format | Only b64_json supported |
quality, style | Available for compatibility only |