Skip to content
OpenAI logo

GPT Image 1.5

Text-to-ImageOpenAIProxied

OpenAI's image generation model that creates and edits images from text prompts, supporting multiple quality levels and output sizes.

Model Info
Terms and Licenselink
More informationlink

Usage

TypeScript
const response = await env.AI.run(
'openai/gpt-image-1.5',
{
prompt: 'A golden retriever puppy playing in autumn leaves',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 Simple Generation

Examples

High Quality — Generate a high-quality detailed image
TypeScript
const response = await env.AI.run(
'openai/gpt-image-1.5',
{
prompt:
'A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures',
quality: 'high',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 High Quality
Custom Size — Generate a widescreen image
TypeScript
const response = await env.AI.run(
'openai/gpt-image-1.5',
{
prompt:
'A panoramic view of the northern lights over a snowy mountain range, vivid greens and purples dancing across the sky',
size: '1792x1024',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 Custom Size
Vivid Style — Hyper-real, dramatic image style
TypeScript
const response = await env.AI.run(
'openai/gpt-image-1.5',
{
prompt:
'A neon-lit cyberpunk cityscape at night with rain-slicked streets and holographic billboards',
style: 'vivid',
quality: 'high',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 Vivid Style
Natural Style — More natural, less hyper-real image style
TypeScript
const response = await env.AI.run(
'openai/gpt-image-1.5',
{
prompt:
'A quiet Japanese garden in morning mist with a stone lantern and koi pond',
style: 'natural',
size: '1024x1024',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 Natural Style

Parameters

prompt
stringrequiredText prompt describing the image to generate or edit
image
stringBase64-encoded input image for image editing
quality
stringenum: low, medium, high, autoQuality of the generated image
size
stringenum: 256x256, 512x512, 1024x1024, 1792x1024, 1024x1792Size of the generated image
style
stringenum: vivid, naturalStyle of the generated image

API Schemas

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"prompt": {
"description": "Text prompt describing the image to generate or edit",
"type": "string"
},
"image": {
"description": "Base64-encoded input image for image editing",
"type": "string"
},
"quality": {
"description": "Quality of the generated image",
"type": "string",
"enum": [
"low",
"medium",
"high",
"auto"
]
},
"size": {
"description": "Size of the generated image",
"type": "string",
"enum": [
"256x256",
"512x512",
"1024x1024",
"1792x1024",
"1024x1792"
]
},
"style": {
"description": "Style of the generated image",
"type": "string",
"enum": [
"vivid",
"natural"
]
}
},
"required": [
"prompt"
],
"additionalProperties": false
}