Image API
Image generation
GPT Image 2 and every other image model below — one request shape for all of them.
POSThttps://api.oxyy.ai/v1/images/generations
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | An image model id, e.g. gpt-image-2. |
| prompt | string | Required | What to draw. Up to 32,000 characters. |
| n | integer | Optional | How many images, 1–10. Each one is billed. Default 1 |
| size | string | Optional | A pixel size such as 1024x1024, a named tier, or auto. A pixel size on a tier-priced model is mapped up to the smallest tier that contains it. Accepted:0.5K1K2K4KautoWIDTHxHEIGHT |
| aspect_ratio | string | Optional | For models that take a ratio rather than a size, e.g. 16:9. |
| quality | string | Optional | One of:autohighmediumlowhdstandard |
| style | string | Optional | Forwarded to the models that accept it. One of:vividnatural |
| background | string | Optional | GPT Image models. One of:transparentopaqueauto |
| output_format | string | Optional | One of:pngjpegwebp |
| output_compression | integer | Optional | 0–100, for jpeg and webp. |
| response_format | string | Optional | How the image comes back. One of:urlb64_json |
| negative_prompt | string | Optional | What to avoid. Forwarded to the models that accept it. |
| seed | integer | Optional | Reproducibility, where the provider supports it. |
| async | boolean | Optional | Return a job immediately (202) instead of waiting. See Jobs. Default false |
| user | string | Optional | A stable id for your own end user. |
A model only offers the sizes it declares. Ask for a named tier a model does not have and the request is refused before any provider is called, with the list it does support. Pixel sizes and
auto always pass, because that is what the OpenAI SDK sends by default. The exact options per model are in GET /v1/models/{model}.Code examples
import os from openai import OpenAI client = OpenAI( api_key=os.environ["OXYY_API_KEY"], base_url="https://api.oxyy.ai/v1" ) response = client.images.generate( model="gpt-image-2", prompt="A beautiful sunset over the ocean", n=1, size="1024x1024", ) print(response.data[0].url)
import OpenAI from 'openai'; const client = new OpenAI({ apiKey: process.env.OXYY_API_KEY, baseURL: 'https://api.oxyy.ai/v1' }); const response = await client.images.generate({ model: 'gpt-image-2', prompt: 'A beautiful sunset over the ocean', n: 1, size: '1024x1024', }); console.log(response.data[0].url);
curl https://api.oxyy.ai/v1/images/generations \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OXYY_API_KEY" \ -d '{ "model": "gpt-image-2", "prompt": "A beautiful sunset over the ocean", "n": 1, "size": "1024x1024", "response_format": "url" }'
Example response
Response
{
"created": 1700000000,
"data": [
{
"url": "https://api.oxyy.ai/storage/images/2026/01/abc123.png",
"revised_prompt": "A beautiful sunset over a calm ocean..."
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 1290,
"total_tokens": 1302,
"input_tokens_details": { "text_tokens": 12, "image_tokens": 0 },
"output_tokens_details": {
"image_tokens": 1290,
"text_tokens": 0,
"image_tokens_source": "catalog"
},
"cost": 0.04,
"cost_details": { "currency": "USD", "image": 0.04 }
}
}output_tokens_details.image_tokens_source says where the image token count came from — provider, the model's own published table (catalog), or an estimate — because a charge you can question deserves to say how it was reached.
Editing & variations
POSThttps://api.oxyy.ai/v1/images/editsedit with a prompt
POSThttps://api.oxyy.ai/v1/images/variationsvary without a prompt
Both take the source image the same three ways as every other media endpoint — upload, URL or base64 — and both accept several reference images. See File inputs.
Asynchronous jobs
Send async: true and the endpoint answers 202 with a job instead of waiting. The job endpoints below behave exactly like the video ones.
GEThttps://api.oxyy.ai/v1/images/generations/{id}status
GEThttps://api.oxyy.ai/v1/images/generationsyour jobs
DELETEhttps://api.oxyy.ai/v1/images/generations/{id}cancel
Available models
15 models
Model
Model ID
