curl --request POST \
--url https://api.gravitex.ai/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"response_format": "<string>",
"contents": [
{}
]
}
'Image Generation
curl --request POST \
--url https://api.gravitex.ai/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"response_format": "<string>",
"contents": [
{}
]
}
'Documentation Index
Fetch the complete documentation index at: https://docs.gravitex.ai/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
The image generation API supports text-to-image, image-to-image, image editing, and more. Through a unified API interface, you can call multiple mainstream image generation models including Gemini, Doubao Seedream, GPT Image, and Tongyi Qianwen.Authentication
Bearer sk-xxxxxxxxxxRequest Parameters
- Gemini series:
gemini-2.5-flash-image(Nano Banana),gemini-3-pro-image-preview(Nano Banana Pro), etc. - Doubao Seedream series:
doubao-seedream-3-0-t2i-250415,doubao-seedream-4-0-250828,doubao-seedream-4-5-251128,doubao-seededit-3-0-i2i-250628, etc. - GPT Image series:
gpt-image-2, etc. - Tongyi Qianwen series:
qwen-image-plus,qwen-image-edit-plus, etc.
b64_json or urlNote: Different models have different support for response_format:- Gemini series: Only supports
b64_jsonformat, always returns base64-encoded image data regardless of the value passed - Doubao Seedream series: Usually returns URL links,
response_formatparameter may not take effect - GPT Image series: Only supports
b64_jsonformat, forces base64-encoded image data - Tongyi Qianwen series: Supports both
b64_jsonandurl, returns the corresponding format based on the parameter value (b64_jsonwill download from URL and convert to base64)
Basic Examples
- Gemini
- Doubao Seedream
- GPT Image
- Tongyi Qianwen
- Text-to-Image
- Image-to-Image
- Multi-Image Fusion
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-flash-image",
"prompt": "A cute orange kitten sitting in a garden, sunny day, high quality photography",
"size": "16:9",
"quality": "high",
"n": 1,
"temperature":1.1,
"top_p":0.95,
"response_format": "b64_json",
"image_size": "2K",
"mime_type": "image/png",
"response_modalities": "image"
}'
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-flash-image",
"size": "16:9",
"quality": "high",
"image_size": "3K",
"temperature":1.1,
"top_p":0.95,
"response_format": "b64_json",
"contents": [
{
"role": "user",
"parts": [
{"text": "Generate an aerial view of Canton Tower based on this image"},
{"image": "data:image/png;base64,iVBORw0KGgoAAxxxx..."}
]
}
]
}'
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-flash-image",
"size": "16:9",
"image_size": "3K",
"temperature":1.1,
"top_p":0.95,
"response_format": "b64_json",
"contents": [
{
"role": "user",
"parts": [
{"text": "Apply the oil painting style from the first image to the content of the second image"},
{"image": "https://example.com/style.jpg"},
{"image": "https://example.com/content.jpg"}
]
}
]
}'
- Text-to-Image
- Image-to-Image
- Sequential Image Generation
- Image Editing
- 3.0 Model (Guidance Scale)
- 4.5 Model (Standard/Fast Mode)
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-4-0-250828",
"prompt": "A cute orange kitten sitting in a garden, sunny day, high quality photography",
"size": "2048x2048",
"watermark": false,
"seed": 12345,
"optimize_prompt_options": {
"mode": "standard"
}
}'
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-4-0-250828",
"prompt": "Change this image to oil painting style",
"size": "2048x2048",
"watermark": false,
"seed": 12345,
"contents": [
{
"role": "user",
"parts": [
{"image": "data:image/png;base64,iVBORw0KGgoAAxxxx..."},
{"text": "Change this image to oil painting style"}
]
}
]
}'
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-4-0-250828",
"prompt": "A cute orange kitten sitting in a garden, sunny day, high quality photography",
"size": "2048x2048",
"watermark": false,
"sequential_image_generation": "auto",
"sequential_image_generation_options": {
"max_images": 4
},
"optimize_prompt_options": {
"mode": "standard"
}
}'
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seededit-3-0-i2i-250628",
"prompt": "Change this image to oil painting style",
"watermark": false,
"guidance_scale": 2.5,
"seed": 12345,
"contents": [
{
"role": "user",
"parts": [
{"image": "data:image/png;base64,iVBORw0KGgoAAxxxx..."},
{"text": "Change this image to oil painting style"}
]
}
]
}'
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-3-0-t2i-250415",
"prompt": "A cute orange kitten sitting in a garden, sunny day, high quality photography",
"size": "1024x1024",
"watermark": false,
"guidance_scale": 7.5,
"seed": 12345
}'
# Standard mode
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-4-5-251128",
"prompt": "A cute kitten",
"size": "2048x2048",
"watermark": false,
"optimize_prompt_options": {
"mode": "standard"
}
}'
# fast mode
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-4-0-250828",
"prompt": "A cute kitten",
"size": "2048x2048",
"watermark": false,
"optimize_prompt_options": {
"mode": "fast"
}
}'
- Text-to-Image
- Image-to-Image
- Multi-Image Fusion
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A cute orange kitten sitting in a garden, sunny day, high quality photography",
"size": "1024x1024",
"quality": "high",
"n": 1
}'
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "Change this image to oil painting style",
"size": "1024x1024",
"quality": "high",
"input_fidelity": "medium",
"n": 1,
"image": "data:image/png;base64,iVBORw0KGgoAAxxxx..."
}'
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "Apply the style from the first image to the content of the second image",
"size": "1024x1024",
"quality": "high",
"input_fidelity": "high",
"n": 2,
"images": [
"data:image/png;base64,iVBORw0KGgoAAxxxx...",
"data:image/png;base64,iVBORw0KGgoAAyyyy..."
]
}'
- Text-to-Image
- Image Editing
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-plus",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "一副典雅庄重的对联悬挂于厅堂之中,房间是个安静古典的中式布置,桌子上放着一些青花瓷,对联上左书“义本生知人机同道善思新”,右书“通云赋智乾坤启数高志远”, 横批“智启通义”,字体飘逸,在中间挂着一幅中国风的画作,内容是岳阳楼。"
}
]
}
]
},
"parameters": {
"negative_prompt": "1",
"prompt_extend": true,
"seed": "4",
"watermark": true
}
}'
curl -X POST "https://api.gravitex.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-edit-plus",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/fpakfo/image36.webp"
},
{
"text": "Generate an image that matches the depth map. Description: a red, worn-out bicycle parked on a muddy path, with a dense primeval forest in the background."
}
]
}
]
},
"parameters": {
"n": 2,
"negative_prompt": "low quality",
"watermark": true,
"size": "2048*2048",
"seed": 1
}
}'
Model-Specific Parameters
Different models support different parameters. Below are detailed parameter descriptions for each model:- Doubao Seedream
- GPT Image
- Gemini
- Tongyi Qianwen
- doubao-seedream-3.0:
1024x1024,1152x864,864x1152,1280x720,720x1280,1248x832,832x1248,1512x648 - doubao-seedream-4.0/4.5:
2048x2048,2304x1728,1728x2304,2560x1440,1440x2560,2496x1664,1664x2496,3024x1296(2K) or4096x4096,4704x3520,3520x4704,5504x3040,3040x5504,4992x3328,3328x4992,6240x2656(4K)
0 to 21474836471.0-10.0, default: 2.5. Only supported by doubao-seedream-3.0-t2i-250415 and doubao-seededit-3.0-i2i-250628doubao-seedream-4.0 and doubao-seedream-4.5:"auto": Enable sequential image generation"disabled": Disable sequential image generation (default)
sequential_image_generation is "auto":max_images(integer): Maximum number of images, range1-4, default4
mode(string): Optimization mode"standard": Standard mode, higher quality but longer time (default, supported by both 4.0 and 4.5)"fast": Fast mode, shorter time but average quality (only 4.0)
1024x1024, 1024x1536, 1536x1024. Default: 1024x1024"low": Fastest generation speed, lowest cost"medium": Balance between quality and speed"high": Highest quality, most detailed (gpt-image-2 default)
1-10. Each generation consumes corresponding quota"low": More creative freedom, larger differences from original image"medium": Balance between fidelity and creativity"high": Preserve original image features, smaller changes"auto": Automatically select appropriate fidelity
data:image/...;base64,...)1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9. Can also use pixel dimensions (e.g., 1024x1024), and the system will automatically convert them to the corresponding ratio.imageSize parameter:"hd","high","2K": Maps to2Kresolution"standard","medium","low","auto","1K": Maps to1Kresolution (default)
sample_count parameter)size parameter"allow_adult"327680.0-1.0, default: 0.951K (default), 2K, 4Kimage/png (default), image/jpegimage (default), image-textrole(string, required): Message sender role, must be set touser.image(string): Only for qwen-image-edit-plus models. URL or Base64-encoded image data. Supports 1-3 input images. When multiple images are provided, image order is defined by array order, and the output aspect ratio is based on the last image.n(integer, required): Number of output images, default is 1. For qwen-image-edit-plus series models, you can choose to output 1-6 images. For qwen-image-edit, only 1 image is supported.negative_prompt(string): Negative prompt, used to exclude unwanted elementsprompt_extend(boolean, default: true): Whether to enable prompt extension. Recommended for short prompts, and recommended to disable for detailed prompts. Only supported by qwen-image-edit-plus series models.watermark(boolean, default: true): Whether to add watermarkseed(integer): Random seed, range0-2147483647
Response Format
{
"code": 200,
"msg": "Success",
"data": {
"data": [
{
"url": "",
"b64_json": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQA...",
"revised_prompt": ""
}
],
"created": 1757320007
}
}
Supported Models
Gemini Series
Model Name:gemini-2.5-flash-image (Nano Banana)
Core Capabilities:
- ✅ Text-to-image (pure text description generates images)
- ✅ Image-to-image (single image + text generates new image)
- ✅ Multi-image-to-one (2-5 images fusion generation)
- ✅ Multi-turn conversational image generation (contextual continuous modification)
gemini-3-pro-image-preview (Nano Banana Pro)
Core Capabilities:
- ✅ Text-to-image (pure text description generates images)
- ✅ Image-to-image (single image + text generates new image)
- ✅ Multi-image-to-one (2-5 images fusion generation)
- ✅ Multi-turn conversational image generation (contextual continuous modification)
- ✅ Higher quality output
Doubao Seedream Series
Model Name:doubao-seedream-3-0-t2i-250415
Core Capabilities:
- ✅ Text-to-image (pure text description generates images)
- ✅ Supports guidance scale adjustment
- ✅ Supports random seed control
- ❌ Does not support image-to-image
doubao-seedream-4-0-250828
Core Capabilities:
- ✅ Text-to-image (pure text description generates images)
- ✅ Image-to-image (single image + text generates new image)
- ✅ Multi-image fusion (2-5 images fusion generation)
- ✅ Sequential image generation
- ✅ Supports 2K/4K resolution
- ✅ Supports multiple image formats
- 2K: 2048×2048, 2304×1728, 1728×2304, 2560×1440, 1440×2560, 2496×1664, 1664×2496, 3024×1296
- 4K: 4096×4096, 4704×3520, 3520×4704, 5504×3040, 3040×5504, 4992×3328, 3328×4992, 6240×2656
doubao-seedream-4-5-251128
Core Capabilities:
- ✅ Text-to-image (pure text description generates images)
- ✅ Image-to-image (single image + text generates new image)
- ✅ Multi-image fusion (2-5 images fusion generation)
- ✅ Sequential image generation
- ✅ Supports 2K/4K resolution
- ✅ Supports prompt optimization options
- ✅ Supports multiple image formats
doubao-seededit-3-0-i2i-250628
Core Capabilities:
- ✅ Image editing (single image + text editing)
- ✅ Supports guidance scale adjustment
- ✅ Supports random seed control
- ✅ Image editing (content modification, style transfer, etc.)
- ❌ Does not support pure text-to-image
GPT Image Generation Series
Model Name:gpt-image-2
Core Capabilities:
- ✅ Text-to-image (pure text description generates images)
- ✅ Image-to-image (up to 10 images + text)
- ✅ Supports image quality selection
- ✅ Supports input fidelity adjustment
- ✅ Multi-image fusion generation
low, medium, high
Generation Count: Can generate 1-10 images per request
Image Input: Supports JPEG, PNG, GIF, WEBP formats, max 10MB, up to 10 images
Tongyi Qianwen Series
Model Name:qwen-image-plus
Core Capabilities:
- ✅ Text-to-image (pure text description generates images)
- ✅ Chinese and English text rendering (excels at generating complex text in images)
- ✅ Multiple artistic styles
- ✅ Intelligent prompt extension
- ❌ Does not support image-to-image
qwen-image-edit-plus
Core Capabilities:
- ✅ Image editing (input one image, output up to 6 images)
- ✅ Modify text in images
- ✅ Add/remove/move objects
- ✅ Transfer image styles
- ✅ Enhance image details
Best Practices
Prompt Optimization Tips
- Gemini (Nano Banana)
- Doubao Seedream
- GPT Image
- Tongyi Qianwen
-
Specify aspect ratio needs: Describe composition direction in the prompt
- Landscape: Use “horizontal composition”, “widescreen view”
- Portrait: Use “vertical composition”, “vertical view”
-
High-quality keywords:
- “high quality”, “HD”, “professional photography”
- “8k resolution”, “rich details”
-
Multi-image fusion techniques:
- Clearly describe the role of each image
- Specify fusion method (style transfer, element combination, etc.)
-
Specify style needs:
- Realistic style: Add “photorealistic”, “ultra-realistic”
- Artistic style: Add “oil painting style”, “watercolor”, “sketch”
- Anime style: Add “anime style”, “2D”, “cartoon”
-
High-quality keywords:
- “4K resolution”, “8K quality”, “ultra-high details”
- “professional photography”, “cinematic lighting”
-
Sequential image generation techniques (doubao-seedream-4.x):
- Maintain prompt style consistency
- Use
sequential_image_generationparameter to enable sequential mode - Control
max_imagesparameter to set number of images (1-4 images)
-
Prompt optimization (doubao-seedream-4.5):
- Use
optimize_prompt_optionsparameter to optimize prompts - Optional modes:
standard(standard),creative(creative),precise(precise)
- Use
-
Specify image quality:
- Use
qualityparameter to control quality:low,medium,high - For high-quality images, add descriptive words: “professional photography”, “high detail”, “8K”
- Use
-
Multi-image input techniques:
- Supports up to 10 images input
- Use
input_fidelityparameter to control input image fidelity:low,medium,high,auto - Clearly describe the role of each reference image
-
Prompt optimization:
- Describe desired image content in detail
- Specify artistic style, lighting conditions, composition method
- Add negative descriptions to exclude unwanted content
-
Image count control:
- Use
nparameter to control generation count (1-10 images) - For complex scenes, recommend generating multiple images to select the best result
- Use
-
Text rendering techniques:
- Clearly mark text content in quotes in the prompt
- Example: “A poster with title “Summer Sale""
-
Prompt extension:
- Short prompts: Enable
prompt_extend: true - Detailed prompts: Disable
prompt_extend: false
- Short prompts: Enable
-
Negative prompts:
- Exclude unwanted elements: “blurry, low quality, watermark”
- Text rendering: “blurry text, typos”
Size Selection Tips
- Social Media
- Design Purposes
- WeChat Moments: 1328×1328 (1:1) or 1140×1472 (3:4)
- Weibo Header: 1664×928 (16:9)
- TikTok Cover: 928×1664 (9:16)
- Xiaohongshu: 1140×1472 (3:4)
- Website Banner: 1664×928 (16:9) or 21:9
- Poster: 1140×1472 (3:4) or 928×1664 (9:16)
- Product Image: 1328×1328 (1:1)
- Mobile Wallpaper: 928×1664 (9:16)
FAQ
- General Questions
- Gemini (Nano Banana)
- Doubao Seedream
- GPT Image
- Tongyi Qianwen
What image formats are supported?
What image formats are supported?
- Gemini: PNG, JPEG, JPG, WEBP, max 7MB
- Doubao Seedream 3.0/4.0: JPEG, PNG, max 10MB
- Doubao Seedream 4.5: JPEG, PNG, WEBP, BMP, TIFF, GIF, max 10MB
- GPT Image: JPEG, PNG, GIF, WEBP, max 10MB
- Tongyi Qianwen: JPEG, JPG, PNG, BMP, TIFF, WEBP, max 10MB
How long are generated images valid?
How long are generated images valid?
Can I generate multiple images at once?
Can I generate multiple images at once?
How to maintain the same aspect ratio in conversation?
How to maintain the same aspect ratio in conversation?
contents conversation array, each request must include the size parameter, and the system will apply the specified aspect ratio to the current request.What are the requirements for using URL images?
What are the requirements for using URL images?
How many images does multi-image fusion support?
How many images does multi-image fusion support?
Does doubao-seedream-3.0 support image-to-image?
Does doubao-seedream-3.0 support image-to-image?
What image formats does doubao-seedream-4.x support?
What image formats does doubao-seedream-4.x support?
How to use sequential image generation?
How to use sequential image generation?
sequential_image_generation parameter to enable sequential mode, set to auto. You can control the number of images (1-4 images) through max_images.What does prompt optimization option do?
What does prompt optimization option do?
optimize_prompt_options parameter, with optional modes: standard (standard), creative (creative), precise (precise), used to optimize prompt effects.What editing features does doubao-seededit support?
What editing features does doubao-seededit support?
What image formats does GPT Image support?
What image formats does GPT Image support?
How many images can be input at most?
How many images can be input at most?
How to choose image quality parameter?
How to choose image quality parameter?
quality parameter options: low, medium, high:low: Fastest generation speed, lowest costmedium: Balance between quality and speedhigh: Highest quality, most detailed
What does input fidelity do?
What does input fidelity do?
input_fidelity parameter controls the fidelity of input images, options: low, medium, high, auto:low: More creative freedom, larger differences from original imagehigh: Preserve original image features, smaller changesauto: Automatically select appropriate fidelity
Can I generate multiple images at once?
Can I generate multiple images at once?
n parameter to control generation count (1-10 images), each image consumes corresponding quota.Does qwen-image-plus support image-to-image?
Does qwen-image-plus support image-to-image?
How to generate images with Chinese text?
How to generate images with Chinese text?
Can prompt extension and negative prompt be used together?
Can prompt extension and negative prompt be used together?