Skip to main content
POST
/
v1
/
images
/
generations
curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gemini-2.5-flash-image-preview",
    "prompt": "A bamboo forest path under moonlight",
    "size": "1:1",
    "n": 1,
    "image_urls": [
      "https://openai-documentation.vercel.app/images/cat_and_otter.png"
    ]
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
    }
  ]
}
curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gemini-2.5-flash-image-preview",
    "prompt": "A bamboo forest path under moonlight",
    "size": "1:1",
    "n": 1,
    "image_urls": [
      "https://openai-documentation.vercel.app/images/cat_and_otter.png"
    ]
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
    }
  ]
}

Authorizations

Authorization
string
required
All API endpoints require Bearer Token authenticationGet your API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:
Authorization: Bearer YOUR_API_KEY

Body

model
string
default:"gemini-2.5-flash-image-preview"
required
Image generation model nameSupported models:
  • gemini-2.5-flash-image-preview - Standard version
  • gemini-2.5-flash-image-preview-official - Official version
Example: "gemini-2.5-flash-image-preview" or "gemini-2.5-flash-image-preview-official"
prompt
string
required
Text description for image generationMaximum 1000 characters
size
string
Image generation sizeSupported formats:
  • Ratio: auto, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
For text-to-image, when size is auto, the default is 1:1 or 16:9; for image-to-image, the aspect ratio follows the upstream response. We recommend specifying an aspect ratio.
resolution
string
default:"1K"
Output image resolutionSupported values:
  • 1K - 1K resolution (default)
n
integer
Number of images to generateRange: 1-4 (minimum 1, maximum 4)Default: 1⚠️ Note: Must enter a plain number (e.g., 1), do not use quotes or it will cause an error
official_fallback
boolean
default:"false"
Whether to use the official channel fallback
  • false: Do not use (default)
  • true: Use official channel
When using the official channel (gemini-2.5-flash-image-preview-official), this parameter cannot be used.
image_urls
array
List of reference image URLs for image-to-image or image editing💡 Quick Fill (Try it area):
  1. Click ”+ Add an item” to add an image URL
  2. Enter the complete image URL address or base64 data
Limit: Maximum 14 images
mask_url
string
Mask image URL for inpainting (local repainting)
  • Must be used together with image_urls
  • Only one image can be uploaded
Before uploading the mask image, please confirm that the image’s Alpha channel is set to “Yes”.

Response

code
integer
Response status code
data
array
Response data array