Skip to content

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.

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

ItemValue
MethodPOST
Path/v1/images/generations
Base URLhttps://open.dieyuyun.com
ProtocolOpenAI Images API

Authentication

Bearer Token: Authorization: Bearer YOUR_API_KEY

Standard Request Fields

FieldTypeRequiredDefaultDescription
modelstringYesModel identifier: gemini-3.1-flash-image
promptstringYesImage description text
sizestringNo1024x1024Image size
qualitystringNostandardGeneration quality: standard, hd
nintegerNo1Number of images to generate
response_formatstringNourlResponse format: url or b64_json

Supported Sizes

SizeAspect RatioDescription
1024x10241:1Square
1536x10243:2Landscape
1024x15362:3Portrait

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"
    }
  ]
}
FieldTypeDescription
createdintegerUnix timestamp
dataarrayArray of generated results
data[].urlstringImage URL
data[].revised_promptstringThe 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 n parameter to quickly explore different creative directions.

Rate Limits

See Rate Limits for details.