Quick Answer

  • Supports prompt-based image generation with multiple aspect ratios.
  • Supports reference_images for stronger style consistency.
  • Official variants expose richer generation controls for production tuning.

Key Parameters

  • model | string | required | gemini-2.5-flash-image-preview | - | Exact image model identifier from ToAPIs.
  • prompt | string | required | - | - | Primary image instruction prompt.
  • size | string | optional | 1:1 | 1:1 | 16:9 | 9:16 | 4:3 | 3:4 | 21:9 | Output aspect ratio.
  • resolution | string | optional | 1K | 1K | 2K | 4K(按模型能力) | Output resolution, varies by model variant.
  • reference_images | file[] | optional | - | max 14 | Reference image array for style/composition control.

Common Errors

  • 400 invalid_request_error: trigger=Missing or invalid request payload fields.; fix=Validate model/prompt/size/resolution fields.; retry=Retry only after fixing payload.
  • 401 authentication_error: trigger=Missing or invalid API key.; fix=Verify Authorization header and API key scope.; retry=Retry after auth fix.
  • 429 rate_limit_exceeded: trigger=Request rate, concurrency, or current quota hits upstream rate limiting.; fix=Apply exponential backoff first, then review request rate, concurrency, and quota usage.; retry=Use 1s/2s/4s backoff with jitter; if it persists, reduce submission pressure.

gemini-2.5-flash-image-preview

gemini-2.5-flash-image-preview is a Google Gemini image generation model supporting text-to-image and reference-guided image creation, aligned to ToAPIs docs.

モデルタイプ:
料金: 2.4 クレジット /request
1

画像を説明

参照画像

生成したい画像を説明してください。153 / 1200

詳細オプション

サンプルパラメータ
2

生成結果

画像結果がここに表示されます

ログインすると生成タスクを送信できます。

生成には時間がかかります。しばらくお待ちください。このページを離れても、[ タスクログ ] で生成した内容を直接確認できます。

リクエストをプレビュー

{
  "model": "gemini-2.5-flash-image-preview",
  "prompt": "Create a premium product advertising image with gemini-2.5-flash-image-preview: clear subject, natural lighting, polished social-media-ready composition.",
  "size": "16:9",
  "n": 1,
  "metadata": {
    "resolution": "1K",
    "orientation": "landscape"
  }
}

生成例

gemini-2.5-flash-image-preview の生成結果を見る

このモデルで生成
gemini-2.5-flash-image-preview guide example 1

gemini-2.5-flash-image-preview #1

透明な料金体系

gemini-2.5-flash-image-preview pricing

Image usage is billed according to the current request and resolution rules. Final billing follows the current account quote.

クレジットを追加
2.4 クレジット /request

ToAPIs を選ぶ理由

Why call gemini-2.5-flash-image-preview through ToAPIs?

Keep image generation, API keys, billing, and usage management in one workflow.

High-quality image generation

Generate high-fidelity images via a unified API.

Reference-guided consistency

Use reference_images to stabilize style and composition.

Production tuning controls

Tune resolution, aspect ratio, and sampling for quality/cost balance.

Connect in three steps

Create a key, send an image request, and review the generated result.

  1. 1

    Step 1

    Set Authorization: Bearer <YOUR_API_KEY>.

  2. 2

    Step 2

    Call image generation endpoint with model, prompt, and size.

  3. 3

    Step 3

    Optionally pass reference_images for stronger consistency.

When to use gemini-2.5-flash-image-preview

Use case 1

When generating marketing/e-commerce/creative image assets at scale.

Use case 2

When using references to stabilize style and iterate prompts quickly.

よくある質問

gemini-2.5-flash-image-preview FAQ

How should I choose Gemini image variants?

Choose by resolution needs, official vs preview variant, and control parameters; prefer official for production.

Why are reference images not taking effect?

Check reference count/format/size limits and ensure prompt explicitly uses references.

Image or video model error: invalid apitype: -1

This usually means the request was sent to the wrong endpoint. Image and video models typically do not use the chat endpoint. Instead, submit the documented HTTP task request and poll the task status endpoint for results. Check the actual request code, URL, and payload first.

An image or video task failed, but the user was still charged

Ask the user for the task log or screenshot first and check whether input or output token usage appears. If token accounting shows up, the request was likely sent through a chat endpoint instead of the proper media workflow. Image and video models usually run as async HTTP task APIs: submit the task first, then poll by task id according to the relevant docs.

gemini-2.5-flash-image-preview API

Start building with gemini-2.5-flash-image-preview

Test an image request here, then continue in the dashboard or API documentation.

Try gemini-2.5-flash-image-preview with one ToAPIs key.

Use one account and API surface for image generation workflows.

Sign up to get free credits