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.
Response format: b64_json or urlNote: Different models have different support for response_format:
Gemini series: Only supports b64_json format, always returns base64-encoded image data regardless of the value passed
Doubao Seedream series: Usually returns URL links, response_format parameter may not take effect
GPT Image series: Only supports b64_json format, forces base64-encoded image data
Tongyi Qianwen series: Supports both b64_json and url, returns the corresponding format based on the parameter value (b64_json will download from URL and convert to base64)
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..." ] }'
doubao-seedream-3-0-t2i-250415 does not support this parameter for input images.
Supports URL or Base64 encoding. Among them, doubao-seedream-4.5 and doubao-seedream-4.0 support single-image or multi-image input (see the Multi-Image Fusion example), while doubao-seededit-3.0-i2i only supports single-image input.
Guidance scale, controls how closely the generated image matches the prompt. Higher values are stricter, lower values are more free. Recommended range: 1.0-10.0, default: 2.5. Only supported by doubao-seedream-3.0-t2i-250415 and doubao-seededit-3.0-i2i-250628
Image aspect ratio, supports: 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.
Generation parameters object, contains the following fields:
role (string, required): Message sender role, must be set to user.
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 elements
prompt_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 watermark
Image Input: Supports JPEG, PNG, WEBP, BMP, TIFF, GIF formats, max 10MBLimitation: Maximum input plus output 15 images, but not recommended to output too many (e.g., 15 text-to-image or 1 input image output 14 images), as more output images take longer time.Model Name: doubao-seedream-4-5-251128Core Capabilities:
✅ Text-to-image (pure text description generates images)
✅ Image-to-image (single image + text generates new image)
Supported Sizes: Same as doubao-seedream-4-0Image Input: Supports JPEG, PNG, WEBP, BMP, TIFF, GIF formats, max 10MBLimitation: Maximum input plus output 15 images, but not recommended to output too many (e.g., 15 text-to-image or 1 input image output 14 images), as more output images take longer time.Model Name: doubao-seededit-3-0-i2i-250628Core 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
Image Input: Supports JPEG, JPG, PNG, BMP, TIFF, WEBP formats, max 10MBOutput Description: Actual output count is affected by image content and editing complexity, can generate up to 6 images
Tongyi Qianwen: JPEG, JPG, PNG, BMP, TIFF, WEBP, max 10MB
How long are generated images valid?
Image URLs are valid for approximately 24 hours. It is recommended to download and save immediately after receiving the response, or upload to your own storage service.
Can I generate multiple images at once?
Tongyi Qianwen series generates 1 image per request. For multiple images, please make multiple concurrent requests.
How to maintain the same aspect ratio in conversation?
In the 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?
URLs must be publicly accessible HTTP/HTTPS addresses, supporting formats include PNG, JPEG, JPG, WEBP, max 7MB.
How many images does multi-image fusion support?
Supports 2-5 images input simultaneously, 2-3 images recommended for best results.
Does doubao-seedream-3.0 support image-to-image?
No. doubao-seedream-3-0-t2i-250415 is a pure text-to-image model, only supports generating images through text description.
What image formats does doubao-seedream-4.x support?
doubao-seedream-4.0 and 4.5 support JPEG, PNG, WEBP, BMP, TIFF, GIF formats, max 10MB.
How to use sequential image generation?
Use the 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?
doubao-seedream-4.5 supports the 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?
doubao-seededit-3-0-i2i-250628 supports image editing, including content modification, style transfer, detail enhancement, etc., requires input of one image and editing instruction.
What image formats does GPT Image support?
Supports JPEG, PNG, GIF, WEBP formats, max 10MB.
How many images can be input at most?
gpt-image-2 supports up to 10 images input.
How to choose image quality parameter?
quality parameter options: low, medium, high:
low: Fastest generation speed, lowest cost
medium: Balance between quality and speed
high: Highest quality, most detailed
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 image
high: Preserve original image features, smaller changes
auto: Automatically select appropriate fidelity
Can I generate multiple images at once?
Yes, use the n parameter to control generation count (1-10 images), each image consumes corresponding quota.
Does qwen-image-plus support image-to-image?
No. qwen-image-plus is a pure text-to-image model, only supports generating images through text description.
How to generate images with Chinese text?
Clearly specify text content in the prompt, for example: “A poster with title “Double Eleven Sale”, subtitle “All Items 50% Off""
Can prompt extension and negative prompt be used together?
Yes! They don’t conflict. Recommendation: short prompt + enable extension + add negative prompt for best results.