Краткий вывод

  • 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.

Ключевые параметры

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

Частые ошибки

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

Разбор модели

Gemini 2.5 Flash Image Preview

Model ID: gemini-2-5-flash-image-preview

Вендор: Google (Gemini)Модальности: ImageЦена: $0.0120 /requestОбновлено: 2026-05-02

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.

Обзор модели

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.

Gemini 2.5 Flash Image Preview Возможности модели

Ключевой блок

Ключевые возможности и практическая ценность

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.

Как использовать API Gemini 2.5 Flash Image Preview

  1. Set Authorization: Bearer <YOUR_API_KEY>.
  2. Call image generation endpoint with model, prompt, and size.
  3. Optionally pass reference_images for stronger consistency.
  4. Poll task status and download result image URLs.
Gemini 2.5 Flash Image Preview sample image 1

Когда использовать

  • When generating marketing/e-commerce/creative image assets at scale.
  • When using references to stabilize style and iterate prompts quickly.

Особенности работы API

  • Uses a unified image generation endpoint with task-style responses.
  • Supports reference image inputs with count/size constraints.
  • Resolution and aspect-ratio support vary by Gemini image variant.
Gemini 2.5 Flash Image Preview sample image 2

Key Parameters

ParameterTypeRequiredDefaultRangeDescription
modelstringYesgemini-2.5-flash-image-preview-Exact image model identifier from ToAPIs.
promptstringYes--Primary image instruction prompt.
sizestringNo1:11:1 | 16:9 | 9:16 | 4:3 | 3:4 | 21:9Output aspect ratio.
resolutionstringNo1K1K | 2K | 4K(按模型能力)Output resolution, varies by model variant.
reference_imagesfile[]No-max 14Reference 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 sample image 3

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.

Ошибка у модели изображений или видео: invalid apitype: -1

Обычно это означает, что запрос отправлен не в тот endpoint. Модели изображений и видео обычно не используют chat endpoint. Вместо этого нужно отправлять HTTP-запрос на создание задачи по документации и затем опрашивать endpoint статуса задачи. Сначала проверьте фактический код запроса, URL и payload.

Задача на генерацию изображения или видео завершилась ошибкой, но списание произошло

Сначала попросите у пользователя лог задачи или скриншот и проверьте, есть ли там статистика входных или выходных токенов. Если учет токенов есть, запрос, скорее всего, был отправлен через chat endpoint, а не через правильный media workflow. Модели изображений и видео обычно работают как асинхронные HTTP task API: сначала отправляется задача, затем выполняется опрос по task id согласно документации.

Mode Notes

Text to Image with Gemini 2.5 Flash Image Preview

Generate images directly from prompt instructions.

Mode Parameters

modelpromptsizeresolution

Best Scenarios

  • Product key visuals
  • Ad creatives
  • Concept art

Reference-guided Image with Gemini 2.5 Flash Image Preview

Generate style-consistent images from references.

Mode Parameters

reference_imagespromptsizeresolution

Best Scenarios

  • Brand consistency
  • Character consistency
  • Series posters

Related APIs

Готовы начать?

Зарегистрируйтесь бесплатно и испытайте мощь корпоративного API-шлюза для ИИ

ToAPIs

Корпоративный шлюз AI API. Доступ к GPT-5, Claude, Gemini и 50+ моделям через единый API.

Компания

Правовая информация

© 2026 ToAPIs. Все права защищены.

Все системы работают