Skip to main content

Agnes Image 2.1 Flash

Model Overview

Agnes Image 2.1 Flash is an upgraded image generation model by Sapiens AI, supporting both text-to-image and image-to-image workflows. Compared with previous versions, Agnes Image 2.1 Flash provides improved performance for high-information-density images, making it more suitable for scenarios that require complex visual details, richer composition, and clearer semantic alignment. Agnes Image 2.1 Flash can be used to generate images from text prompts, transform existing images, preserve original composition during editing, and return results either as image URLs or Base64 data.

Key Capabilities

CapabilityDescription
Text-to-ImageGenerate high-quality images from natural language prompts
Image-to-ImageTransform or refine existing images based on prompt instructions
High-Information-Density Image OptimizationImproved handling of images with rich details, complex layouts, and dense visual elements
Composition PreservationPreserve the original composition when editing or transforming input images
Flexible Size ControlSupports custom output sizes such as 1024x768
URL ResponseReturn generated image results as accessible image URLs
Base64 ResponseReturn generated image results as Base64 data when required
URL or Data URI InputImage-to-image supports public image URLs or Data URI Base64 input

Applicable Scenarios

Agnes Image 2.1 Flash is suitable for:
ScenarioExample Use Cases
Creative DesignConcept art, visual exploration, poster drafts
Marketing ContentCampaign images, product visuals, social media creatives
High-Density Visual GenerationDetailed scenes, rich compositions, complex environments
Image TransformationStyle transfer, scene re-lighting, background transformation
Content ProductionApp assets, thumbnails, banners, storytelling visuals
Product VisualizationProduct photos, mockups, commercial visuals
Social Media AssetsCovers, banners, thumbnails, post images

API Information

Base URL

text
https://apihub.agnes-ai.com

Endpoint

ItemDescription
API Endpointhttps://apihub.agnes-ai.com/v1/images/generations
Request MethodPOST
Content-Typeapplication/json
AuthenticationBearer Token
Authentication HeaderAuthorization: Bearer YOUR_API_KEY

Model

Use the following model name for both text-to-image and image-to-image workflows:
text
agnes-image-2.1-flash

Important Notes

  • Use agnes-image-2.1-flash as the model name.
  • For text-to-image generation, modelprompt, and size are required.
  • For image-to-image generation, provide the input image URL or Data URI Base64 in the top-level image array.
  • Do not put response_format at the top level of the request body.
  • If you need URL output, put "response_format": "url" inside extra_body.
  • If you need Base64 output for text-to-image, you can use the top-level parameter "return_base64": true.
  • For image-to-image Base64 output, use "response_format": "b64_json" inside extra_body.
  • You do not need to pass tags: ["img2img"] for image-to-image requests.
  • Do not expose temporary API keys in public documentation. Use YOUR_API_KEY in all public examples.

Request Parameters

ParameterTypeRequiredDescription
modelstringYesModel name. Use agnes-image-2.1-flash
promptstringYesText instruction for image generation or image editing
sizestringYesOutput image size, such as 1024x768
imagestring[]Required for image-to-imageInput image array. Supports public image URLs or Data URI Base64
return_base64booleanNoUsed when text-to-image output should be returned as Base64
extra_bodyobjectNoAdditional parameters for advanced workflows
extra_body.response_formatstringNoOutput format. Common values: url, b64_json

Call Examples

1. Text-to-Image Request with URL Output

Use this request to generate an image from a text prompt and return the result as an image URL.
curl https://apihub.agnes-ai.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "agnes-image-2.1-flash",
    "prompt": "A luminous floating city above a misty canyon at sunrise, cinematic realism",
    "size": "1024x768",
    "extra_body": {
      "response_format": "url"
    }
  }'
The generated image URL is returned in:
text
data[0].url

2. Text-to-Image Request with Base64 Output

Use this request when you want the generated image returned as Base64 data.
curl https://apihub.agnes-ai.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "agnes-image-2.1-flash",
    "prompt": "A clean product photo of a glass cube on a white studio background, soft shadows, high detail",
    "size": "1024x768",
    "return_base64": true
  }'
The generated Base64 image is returned in:
text
data[0].b64_json

3. Image-to-Image Request with URL Input and URL Output

Use this request to transform an existing image while preserving the original composition.
curl https://apihub.agnes-ai.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "agnes-image-2.1-flash",
    "prompt": "Transform the scene into a rain-soaked cyberpunk night with neon reflections while preserving the original composition",
    "size": "1024x768",
    "extra_body": {
	     "image": [
      "https://example.com/input-image.png"
    ],
      "response_format": "url"
    }
  }'
The generated image URL is returned in:
text
data[0].url

4. Image-to-Image Request with URL Input and Base64 Output

Use this request when the input image is provided as a public URL and the generated result should be returned as Base64 data.
curl https://apihub.agnes-ai.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "agnes-image-2.1-flash",
    "prompt": "Make the object orange while preserving the original composition",
    "size": "1024x768",
    "extra_body": {
	    "image": [
      "https://example.com/input-image.png"
    ],
      "response_format": "b64_json"
    }
  }'
The generated Base64 image is returned in:
text
data[0].b64_json

5. Image-to-Image Request with Data URI Base64 Input

Image-to-image also supports Data URI Base64 input. Data URI format:
text
data:image/png;base64,BASE64_HERE
Request example:
curl https://apihub.agnes-ai.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "agnes-image-2.1-flash",
    "prompt": "Make the object matte black while preserving the original composition",
    "size": "1024x768",
    "extra_body": {
	     "image": [
      "data:image/png;base64,BASE64_HERE"
    ],
      "response_format": "b64_json"
    }
  }'

Response Format

URL Output

When extra_body.response_format is set to url, the response format is:
{
  "created": 1780000000,
  "data": [
    {
      "url": "https://storage.googleapis.com/agnes-aigc/xxx.png",
      "b64_json": null,
      "revised_prompt": null
    }
  ]
}
Generated image URL:
text
data[0].url

Base64 Output

When Base64 output is enabled, the response format is:
{
  "created": 1780000000,
  "data": [
    {
      "url": null,
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
      "revised_prompt": null
    }
  ]
}
Generated Base64 image:
text
data[0].b64_json

Recommended Prompt Structure

For better image generation results, use a clear prompt structure:
text
[Subject] + [Scene / Environment] + [Style] + [Lighting] + [Composition] + [Quality Requirements]

Example

text
A luminous floating city above a misty canyon at sunrise, cinematic realism, wide-angle composition, rich architectural details, soft golden light, high visual density
For image-to-image tasks, clearly describe what should change and what should remain unchanged.
text
Transform the scene into a rain-soaked cyberpunk night with neon reflections while preserving the original composition and main subject layout.

Best Practices

For Text-to-Image

Use detailed prompts when generating complex images. Include subject, environment, style, lighting, camera angle, and desired level of detail. Good example:
text
A futuristic city marketplace filled with flying vehicles, holographic signs, dense crowds, neon lighting, cinematic realism, ultra-detailed, high-information-density composition
Recommended elements:
  • Main subject
  • Scene or environment
  • Visual style
  • Lighting
  • Camera angle
  • Composition
  • Detail level
  • Quality requirements

For Image-to-Image

When editing an existing image, clearly specify both the transformation and the preservation requirements. Good example:
text
Convert the image into a fantasy winter landscape, add snow, warm window lights, and a magical atmosphere, while preserving the original building structure and camera angle.
Recommended structure:
text
[Change requirement] + [New style / scene] + [Elements to add or remove] + [Elements to preserve]
Example:
text
Change the daytime street scene into a cinematic cyberpunk night scene, add neon signs and wet road reflections, while preserving the original street layout, camera angle, and main building shapes.

For High-Information-Density Images

Agnes Image 2.1 Flash is optimized for complex and detail-rich visuals. For best results, describe the visual hierarchy clearly. Recommended elements:
  • Main subject
  • Background environment
  • Important secondary details
  • Style and lighting
  • Composition constraints
  • What should remain unchanged, if using image-to-image
Good example:
text
A large fantasy harbor city built on cliffs, hundreds of small boats, layered stone bridges, glowing windows, distant mountains, cloudy sunset sky, cinematic fantasy realism, wide-angle composition, rich architectural details, high visual density

Common Errors and Troubleshooting

1. response_format at the Top Level Causes an Error

Do not put response_format at the top level. Incorrect:
{
  "model": "agnes-image-2.1-flash",
  "prompt": "A futuristic city",
  "size": "1024x768",
  "response_format": "url"
}
Correct:
{
  "model": "agnes-image-2.1-flash",
  "prompt": "A futuristic city",
  "size": "1024x768",
  "extra_body": {
    "response_format": "url"
  }
}

2. Image-to-Image Does Not Require tags

Do not pass:
{
  "tags": ["img2img"]
}
For image-to-image, only provide the input image in the image array. Correct:
{
  "model": "agnes-image-2.1-flash",
  "prompt": "Make the object blue while preserving the original composition",
  "size": "1024x768",
  "extra_body": {
    "image": [
    "https://example.com/input.png"
  ],
    "response_format": "url"
  }
}

3. Input Image URL Is Not Accessible

If the input image URL cannot be accessed by the server, the request may fail. Recommended solutions:
  • Use a public HTTPS image URL.
  • Make sure the image URL does not require login, cookies, or private headers.
  • Use Data URI Base64 input if the image cannot be publicly accessed.

4. Request Timeout

Image generation may take several seconds to tens of seconds depending on the prompt complexity, image size, and server load. Recommended client timeout:
text
60s to 360s

5. Missing image in Image-to-Image Requests

For image-to-image generation, the image array is required. Incorrect:
{
  "model": "agnes-image-2.1-flash",
  "prompt": "Make the image cyberpunk style",
  "size": "1024x768"
}
Correct:
{
  "model": "agnes-image-2.1-flash",
  "prompt": "Make the image cyberpunk style while preserving the original composition",
  "size": "1024x768",
  "extra_body": {
    "image": [
    "https://example.com/input.png"
  ],
    "response_format": "url"
  }
}

Pricing

TypePrice
Generated Images0 $0.003 / image

Notes

  • Use agnes-image-2.1-flash as the model name.
  • Use https://apihub.agnes-ai.com/v1/images/generations as the API endpoint.
  • For text-to-image generation, modelprompt, and size are required.
  • For image-to-image generation, provide the input image URL or Data URI Base64 under the top-level image array.
  • Use extra_body.response_format: "url" when you want the generated result returned as an image URL.
  • Use return_base64: true for text-to-image Base64 output.
  • Use extra_body.response_format: "b64_json" for image-to-image Base64 output.
  • Do not put response_format at the top level.
  • Do not pass tags: ["img2img"].
  • Do not expose temporary API keys in public documentation. Use YOUR_API_KEY in all public examples.