Gemini 3.1 Flash Image
Google's Gemini 3.1 Flash image generation model, combining fast generation speed with excellent image quality for efficient creation.
Try it Online
Quick Start
python
from openai import OpenAI
client = OpenAI(
base_url="https://open.dieyuyun.com/v1",
api_key="YOUR_API_KEY"
)
response = client.images.generate(
model="gemini-3.1-flash-image",
prompt="A cozy coffee shop interior with warm lighting and bookshelves",
size="1024x1024",
n=1
)
print(response.data[0].url)Endpoint
| Item | Value |
|---|---|
| Method | POST |
| Path | /v1/images/generations |
| Base URL | https://open.dieyuyun.com |
| Protocol | OpenAI Images API |
Authentication
Bearer Token: Authorization: Bearer YOUR_API_KEY
Standard Request Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | Yes | — | Model identifier: gemini-3.1-flash-image |
| prompt | string | Yes | — | Image description text |
| size | string | No | 1024x1024 | Image size |
| quality | string | No | standard | Generation quality: standard, hd |
| n | integer | No | 1 | Number of images to generate |
| response_format | string | No | url | Response format: url or b64_json |
Supported Sizes
| Size | Aspect Ratio | Description |
|---|---|---|
1024x1024 | 1:1 | Square |
1536x1024 | 3:2 | Landscape |
1024x1536 | 2:3 | Portrait |
Request Examples
bash
curl https://open.dieyuyun.com/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"prompt": "A cozy coffee shop interior with warm lighting and bookshelves",
"size": "1024x1024",
"n": 1
}'python
from openai import OpenAI
client = OpenAI(
base_url="https://open.dieyuyun.com/v1",
api_key="YOUR_API_KEY"
)
response = client.images.generate(
model="gemini-3.1-flash-image",
prompt="A cozy coffee shop interior with warm lighting and bookshelves",
size="1024x1024",
n=1
)
print(response.data[0].url)javascript
import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://open.dieyuyun.com/v1',
apiKey: 'YOUR_API_KEY',
})
const response = await client.images.generate({
model: 'gemini-3.1-flash-image',
prompt: 'A cozy coffee shop interior with warm lighting and bookshelves',
size: '1024x1024',
n: 1,
})
console.log(response.data[0].url)Response Format
Success Response
json
{
"created": 1717000000,
"data": [
{
"url": "https://...",
"revised_prompt": "A warm and inviting coffee shop interior with exposed brick walls, wooden bookshelves filled with books, pendant lighting casting a golden glow, comfortable seating areas with leather armchairs"
}
]
}| Field | Type | Description |
|---|---|---|
| created | integer | Unix timestamp |
| data | array | Array of generated results |
| data[].url | string | Image URL |
| data[].revised_prompt | string | The revised/optimized prompt used for generation |
Error Response
See Error Codes for details.
Best Practices
- Speed-first: The Gemini Flash series is known for fast generation speed, making it ideal for rapid iteration and high-volume image generation scenarios.
- Detailed descriptions: Gemini models have strong scene comprehension. Provide detailed descriptions of the environment, lighting, and atmosphere for better results.
- Multilingual prompts: Supports Chinese, English, and other languages. Choose the language that best fits your needs.
- Cost-effective: Strikes a good balance between image quality and generation speed, suitable for everyday image creation needs.
- Batch creation: Leverage the fast generation advantage by using the
nparameter to quickly explore different creative directions.
Rate Limits
See Rate Limits for details.
Related Documentation
- GPT Image 2 - OpenAI image generation model
- Grok Imagine - xAI image generation model
- Model List & Pricing - Browse available models and pricing
- Playground - Test image generation interactively