Image Generation
Generate images from text prompts.
Endpoint: POST /api/v1/images/generations
Auth: Required
Request Body
| Field |
Type |
Required |
Default |
Description |
prompt |
string |
Yes |
— |
Text description of the image |
model |
string |
No |
— |
Model ID |
provider |
string |
No |
— |
Provider name |
size |
string |
No |
1024x1024 |
Image dimensions |
n |
integer |
No |
1 |
Number of images to generate |
quality |
string |
No |
— |
Image quality level |
style |
string |
No |
— |
Image style |
response_format |
string |
No |
— |
url or b64_json |
additional_params |
object |
No |
{} |
Provider-specific parameters |
byok_api_key |
string |
No |
— |
Your own provider API key |
Google-Specific Parameters
| Field |
Type |
Description |
negative_prompt |
string |
What to avoid in the image |
aspect_ratio |
string |
Aspect ratio (1:1, 16:9, 9:16) |
guidance_scale |
float |
Prompt adherence strength |
seed |
integer |
Reproducibility seed |
enhance_prompt |
boolean |
Let the model enhance your prompt |
add_watermark |
boolean |
Add watermark to output |
OpenAI-Specific Parameters
| Field |
Type |
Description |
background |
string |
Background style |
output_format |
string |
Output image format |
output_compression |
integer |
Compression level |
Examples
import requests
response = requests.post(
"https://api.indoxhub.com/api/v1/images/generations",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "openai/dall-e-3",
"prompt": "A serene mountain landscape at sunset, photorealistic",
"size": "1024x1024",
"n": 1
}
)
image_url = response.json()["data"][0]["url"]
print(image_url)
const response = await fetch("https://api.indoxhub.com/api/v1/images/generations", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "openai/dall-e-3",
prompt: "A serene mountain landscape at sunset, photorealistic",
size: "1024x1024",
n: 1
})
});
const data = await response.json();
console.log(data.data[0].url);
curl https://api.indoxhub.com/api/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/dall-e-3",
"prompt": "A serene mountain landscape at sunset, photorealistic",
"size": "1024x1024",
"n": 1
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.indoxhub.com/v1"
)
response = client.images.generate(
model="openai/dall-e-3",
prompt="A serene mountain landscape at sunset, photorealistic",
size="1024x1024",
n=1
)
print(response.data[0].url)
Response
{
"request_id": "550e8400-e29b-41d4-a716-446655440000",
"created_at": "2026-04-07T12:00:00Z",
"duration_ms": 5200.0,
"provider": "openai",
"model": "dall-e-3",
"success": true,
"message": "",
"data": [
{
"url": "https://cdn.example.com/images/generated-image.png",
"b64_json": null
}
],
"usage": {
"tokens_prompt": 0,
"tokens_completion": 0,
"tokens_total": 0,
"cost": 0.04,
"latency": 5200.0
}
}