Generate Image
Generate images with GPT Image 2.5 and other models, with complete request parameters, response fields, and streaming examples.
Creates an image from a text prompt. The endpoint definition follows the OpenAI Create image API.
Endpoint
| Item | Value |
|---|---|
| Method | POST |
| URL | https://api.tokenhub.belivestudios.com/v1/images/generations |
| Authentication | Authorization: Bearer sk-your-belive-studios-key |
| Content-Type | application/json |
Model Selection
Model categories
The platform provides per-use models and official models, with different values for the model parameter.
| Per-use model | Official model |
|---|---|
gpt-image-2 | gpt-image-2-2026-04-21 |
gpt-image-2.5-sunburst | gpt-image-2.5-sunburst-2026-09-08 |
gpt-image-2.5-flare | gpt-image-2.5-flare-2026-09-08 |
The examples below use per-use models. To use an official model, replace the request's model value.
Examples
Standard Generation
GPT Image models always return base64-encoded images, so do not include response_format in the request.
curl https://api.tokenhub.belivestudios.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-belive-studios-key" \
-d '{
"model": "gpt-image-2.5-sunburst",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024"
}'Response
{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}Request Parameters
Core Parameters
prompt
Type: string, required
A text description of the desired image. The maximum length is 32,000 characters for GPT Image models, 1,000 for dall-e-2, and 4,000 for dall-e-3.
background
Type: "transparent" | "opaque" | "auto" | null, optional
Sets the background of the generated image. Supported only by GPT Image models. auto is the default and lets the model choose the best background.
gpt-image-2.5-sunburst, gpt-image-2.5-flare, and their 2026-09-08 snapshots support opaque and transparent backgrounds. Transparent backgrounds are also available for other supported GPT Image models. Support for gpt-image-2 and gpt-image-2-2026-04-21 is in preview. When using transparent, set output_format to png or webp.
model
Type: string | ImageModel | null, optional
The image-generation model. Platform model names are grouped as follows:
- Per-use models:
gpt-image-2,gpt-image-2.5-sunburst, andgpt-image-2.5-flare - Official models:
gpt-image-2-2026-04-21,gpt-image-2.5-sunburst-2026-09-08, andgpt-image-2.5-flare-2026-09-08
moderation
Type: "low" | "auto" | null, optional
Controls content moderation for GPT Image models. low applies less restrictive filtering; auto is the default.
n
Type: number | null, optional
The number of images to generate, from 1 to 10. dall-e-3 supports only n=1.
Output Controls
output_compression
Type: number | null, optional
Compression level from 0 to 100 percent, defaulting to 100. Supported only by GPT Image models when output_format is webp or jpeg.
output_format
Type: "png" | "jpeg" | "webp" | null, optional
The generated image format. Supported only by GPT Image models.
partial_images
Type: number | null, optional
The number of partial images to generate in a streaming response, from 0 to 3. When set to 0, the response sends only the final image in a single streaming event. The final image may arrive before all requested partial images if it is generated sooner.
quality
Type: "standard" | "hd" | "low" | "medium" | "high" | "xhigh" | "max" | "auto" | null, optional
auto: automatically selects the best quality and is the defaulthigh,medium, andlow: supported by GPT Image modelsxhighandmax: supported bygpt-image-2.5-sunburst,gpt-image-2.5-flare, and their2026-09-08snapshotshdandstandard: supported bydall-e-3standard: the only option supported bydall-e-2
Streaming and Compatibility
response_format
Type: "url" | "b64_json" | null, optional
Sets the response format for dall-e-2 and dall-e-3. URLs are valid for 60 minutes. GPT Image models do not support this parameter and always return base64-encoded images.
size
Type: string | "auto" | null, optional
- GPT Image models support
1024x1024,1536x1024, and1024x1536; models with automatic sizing also supportauto gpt-image-2,gpt-image-2-2026-04-21, both GPT Image 2.5 models, and their2026-09-08snapshots support arbitraryWIDTHxHEIGHTresolutions, such as1536x864dall-e-2supports256x256,512x512, and1024x1024dall-e-3supports1024x1024,1792x1024, and1024x1792
For the models listed above that support arbitrary resolutions, both dimensions must be divisible by 16, the aspect ratio must be between 1:3 and 3:1, and the request must meet the model's current pixel and edge limits. Resolutions above 2560x1440 are experimental; the maximum is 3840x2160.
stream
Type: boolean | null, optional
Generates the image in streaming mode. Defaults to false and is supported only by GPT Image models.
style
Type: "vivid" | "natural" | null, optional
Sets the generated image style. Supported only by dall-e-3. vivid favors hyper-real, dramatic images; natural produces a more natural appearance.
user
Type: string, optional
A unique identifier for the end user that can help monitor and detect abuse.
Response
The endpoint returns an ImagesResponse object.
| Field | Type | Description |
|---|---|---|
created | number | Unix timestamp, in seconds, when the image was created |
background | transparent | opaque | Background used for generation, if present |
data | Image[] | Generated images, if present |
output_format | png | webp | jpeg | Output image format, if present |
quality | low | medium | high | xhigh | max | Generated image quality, if present |
size | string | Image dimensions in WIDTHxHEIGHT format, for example 1536x864, if present |
usage | object | Token usage; the official reference identifies this field for gpt-image-1, if present |
data Fields
| Field | Type | Description |
|---|---|---|
b64_json | string | Base64-encoded image; returned by default for GPT Image models and for DALL·E when response_format=b64_json |
revised_prompt | string | Revised prompt used for generation; returned only by dall-e-3 |
url | string | Image URL returned by DALL·E when response_format=url; unsupported by GPT Image models |
usage Fields
| Field | Type | Description |
|---|---|---|
input_tokens | number | Image and text tokens in the input |
input_tokens_details.image_tokens | number | Image tokens in the input |
input_tokens_details.text_tokens | number | Text tokens in the input |
output_tokens | number | Output tokens generated by the model |
total_tokens | number | Total image and text tokens used |
output_tokens_details.image_tokens | number | Image tokens in the output, if present |
output_tokens_details.text_tokens | number | Text tokens in the output, if present |