Developers
Documentation
A technical guide to integrating leading AI models through Oblion's unified API.
On this page
Image Generation Guide
Generate a new image from a text prompt. This is different from PHP Image Editing, which edits an existing uploaded image — this endpoint creates one from scratch.
POST https://api.oblion.io/v1/images/generations
Basic request
curl https://api.oblion.io/v1/images/generations \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"model": "gpt-image-1",
"prompt": "A watercolor painting of a fox in an autumn forest",
"n": 1,
"size": "1024x1024"
}'
from openai import OpenAI
client = OpenAI(base_url="https://api.oblion.io/v1", api_key="YOUR_API_KEY")
response = client.images.generate(
model="gpt-image-1",
prompt="A watercolor painting of a fox in an autumn forest",
n=1,
size="1024x1024",
)
print(response.data[0].url)
import OpenAI from "openai";
const openai = new OpenAI({ baseURL: "https://api.oblion.io/v1", apiKey: "YOUR_API_KEY" });
const response = await openai.images.generate({
model: "gpt-image-1",
prompt: "A watercolor painting of a fox in an autumn forest",
n: 1,
size: "1024x1024",
});
console.log(response.data[0].url);
Response format
By default the API returns a temporary url you can download the image from. Some models also support response_format: "b64_json" to get the image inline as base64 instead:
response = client.images.generate(
model="gpt-image-1",
prompt="A minimalist logo of a mountain",
response_format="b64_json",
)
import base64
image_bytes = base64.b64decode(response.data[0].b64_json)
with open("logo.png", "wb") as f:
f.write(image_bytes)
Choosing a model
See the full list under Image Generation & Editing in Supported Models. A few notable options:
| Model | Notes |
|---|---|
gpt-image-1 | General-purpose, high-quality generations |
dall-e-3 | OpenAI's DALL·E 3 — high capacity requests may take longer or return 524/429 when the upstream is under heavy load |
z-image-turbo | Fast, lightweight — good for quick iteration or previews |
mj_imagine | Midjourney-style generation (see the mj_* model family for Midjourney-specific operations like mj_upscale, mj_variation) |
Some image models are hosted with limited capacity. If a request returns
429("upstream load saturated"), wait a few seconds and retry — this is expected under peak load, not a bug in your request.