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
| Capability | Description |
|---|---|
| Text-to-Image | Generate high-quality images from natural language prompts |
| Image-to-Image | Transform or refine existing images based on prompt instructions |
| High-Information-Density Image Optimization | Improved handling of images with rich details, complex layouts, and dense visual elements |
| Composition Preservation | Preserve the original composition when editing or transforming input images |
| Flexible Size Control | Supports custom output sizes such as 1024x768 |
| URL Response | Return generated image results as accessible image URLs |
| Base64 Response | Return generated image results as Base64 data when required |
| URL or Data URI Input | Image-to-image supports public image URLs or Data URI Base64 input |
Applicable Scenarios
Agnes Image 2.1 Flash is suitable for:| Scenario | Example Use Cases |
|---|---|
| Creative Design | Concept art, visual exploration, poster drafts |
| Marketing Content | Campaign images, product visuals, social media creatives |
| High-Density Visual Generation | Detailed scenes, rich compositions, complex environments |
| Image Transformation | Style transfer, scene re-lighting, background transformation |
| Content Production | App assets, thumbnails, banners, storytelling visuals |
| Product Visualization | Product photos, mockups, commercial visuals |
| Social Media Assets | Covers, banners, thumbnails, post images |
API Information
Base URL
text
Endpoint
| Item | Description |
|---|---|
| API Endpoint | https://apihub.agnes-ai.com/v1/images/generations |
| Request Method | POST |
| Content-Type | application/json |
| Authentication | Bearer Token |
| Authentication Header | Authorization: Bearer YOUR_API_KEY |
Model
Use the following model name for both text-to-image and image-to-image workflows:text
Important Notes
- Use
agnes-image-2.1-flashas the model name. - For text-to-image generation,
model,prompt, andsizeare required. - For image-to-image generation, provide the input image URL or Data URI Base64 in the top-level
imagearray. - Do not put
response_formatat the top level of the request body. - If you need URL output, put
"response_format": "url"insideextra_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"insideextra_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_KEYin all public examples.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name. Use agnes-image-2.1-flash |
| prompt | string | Yes | Text instruction for image generation or image editing |
| size | string | Yes | Output image size, such as 1024x768 |
| image | string[] | Required for image-to-image | Input image array. Supports public image URLs or Data URI Base64 |
| return_base64 | boolean | No | Used when text-to-image output should be returned as Base64 |
| extra_body | object | No | Additional parameters for advanced workflows |
| extra_body.response_format | string | No | Output 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.text
2. Text-to-Image Request with Base64 Output
Use this request when you want the generated image returned as Base64 data.text
3. Image-to-Image Request with URL Input and URL Output
Use this request to transform an existing image while preserving the original composition.text
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.text
5. Image-to-Image Request with Data URI Base64 Input
Image-to-image also supports Data URI Base64 input. Data URI format:text
Response Format
URL Output
Whenextra_body.response_format is set to url, the response format is:
text
Base64 Output
When Base64 output is enabled, the response format is:text
Recommended Prompt Structure
For better image generation results, use a clear prompt structure:text
Example
text
text
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
- 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
text
text
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
text
Common Errors and Troubleshooting
1. response_format at the Top Level Causes an Error
Do not put response_format at the top level.
Incorrect:
2. Image-to-Image Does Not Require tags
Do not pass:
image array.
Correct:
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
5. Missing image in Image-to-Image Requests
For image-to-image generation, the image array is required.
Incorrect:
Pricing
| Type | Price |
|---|---|
| Generated Images | 0 $0.003 / image |
Notes
- Use
agnes-image-2.1-flashas the model name. - Use
https://apihub.agnes-ai.com/v1/images/generationsas the API endpoint. - For text-to-image generation,
model,prompt, andsizeare required. - For image-to-image generation, provide the input image URL or Data URI Base64 under the top-level
imagearray. - Use
extra_body.response_format: "url"when you want the generated result returned as an image URL. - Use
return_base64: truefor text-to-image Base64 output. - Use
extra_body.response_format: "b64_json"for image-to-image Base64 output. - Do not put
response_formatat the top level. - Do not pass
tags: ["img2img"]. - Do not expose temporary API keys in public documentation. Use
YOUR_API_KEYin all public examples.