curl --request POST \
--url https://api.yourapp.com/api/ai/image/generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "A futuristic city at sunset with flying cars",
"model": "dall-e-3",
"n": 1,
"stream": false
}'
const response = await fetch('https://api.yourapp.com/api/ai/image/generation', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A futuristic city at sunset with flying cars',
model: 'dall-e-3',
n: 1,
stream: false
})
});
const data = await response.json();
import requests
url = "https://api.yourapp.com/api/ai/image/generation"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"prompt": "A futuristic city at sunset with flying cars",
"model": "dall-e-3",
"n": 1,
"stream": False
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
{
"created": 1677652288,
"data": [
{
"url": "https://cdn.example.com/images/generated/abc123.png",
"b64_json": null
}
]
}
{
"created": 1677652288,
"data": [
{
"url": null,
"b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}
]
}
data: {"type":"chunk","image":"data:image/png;base64,iVBORw0KG..."}
data: {"type":"chunk","image":"data:image/png;base64,goAAAAN..."}
data: {"type":"done","image":"data:image/png;base64,SUhEUgAA..."}
{
"success": false,
"message": "Unauthorized"
}
AI
Image Generation
AI SDK compatible image generation endpoint with streaming support
POST
/
api
/
ai
/
image
/
generation
curl --request POST \
--url https://api.yourapp.com/api/ai/image/generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "A futuristic city at sunset with flying cars",
"model": "dall-e-3",
"n": 1,
"stream": false
}'
const response = await fetch('https://api.yourapp.com/api/ai/image/generation', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A futuristic city at sunset with flying cars',
model: 'dall-e-3',
n: 1,
stream: false
})
});
const data = await response.json();
import requests
url = "https://api.yourapp.com/api/ai/image/generation"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"prompt": "A futuristic city at sunset with flying cars",
"model": "dall-e-3",
"n": 1,
"stream": False
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
{
"created": 1677652288,
"data": [
{
"url": "https://cdn.example.com/images/generated/abc123.png",
"b64_json": null
}
]
}
{
"created": 1677652288,
"data": [
{
"url": null,
"b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}
]
}
data: {"type":"chunk","image":"data:image/png;base64,iVBORw0KG..."}
data: {"type":"chunk","image":"data:image/png;base64,goAAAAN..."}
data: {"type":"done","image":"data:image/png;base64,SUhEUgAA..."}
{
"success": false,
"message": "Unauthorized"
}
Request Body
string
required
Text prompt describing the image to generate
string
default:"google/gemini-2.5-flash-image"
Image model identifier
string
Provider name (e.g., OpenAI, Google)
number
default:"1"
Number of images to generate
boolean
default:"false"
Enable streaming response
Response
array
number
Unix timestamp of creation
curl --request POST \
--url https://api.yourapp.com/api/ai/image/generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "A futuristic city at sunset with flying cars",
"model": "dall-e-3",
"n": 1,
"stream": false
}'
const response = await fetch('https://api.yourapp.com/api/ai/image/generation', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A futuristic city at sunset with flying cars',
model: 'dall-e-3',
n: 1,
stream: false
})
});
const data = await response.json();
import requests
url = "https://api.yourapp.com/api/ai/image/generation"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"prompt": "A futuristic city at sunset with flying cars",
"model": "dall-e-3",
"n": 1,
"stream": False
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
{
"created": 1677652288,
"data": [
{
"url": "https://cdn.example.com/images/generated/abc123.png",
"b64_json": null
}
]
}
{
"created": 1677652288,
"data": [
{
"url": null,
"b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}
]
}
data: {"type":"chunk","image":"data:image/png;base64,iVBORw0KG..."}
data: {"type":"chunk","image":"data:image/png;base64,goAAAAN..."}
data: {"type":"done","image":"data:image/png;base64,SUhEUgAA..."}
{
"success": false,
"message": "Unauthorized"
}
⌘I

