快速结论

  • Supports prompt-based text-to-image workflows for marketing and creative assets.
  • Supports reference-guided generation for stronger style consistency.
  • Stabilize parameters in this guide first, then move into production API.

关键参数

  • model | string | 必填 | gemini-3.1-pro | - | Exact model identifier from ToAPIs.
  • prompt | string | 必填 | - | - | Primary image instruction prompt.
  • size | string | 可选 | 1:1 | - | Output aspect ratio, model-dependent.
  • n | integer | 可选 | 1 | - | Number of generated images per request.
  • reference_images | file[] | 可选 | - | - | Reference images for style consistency.

常见错误

  • 400 invalid_request_error: 触发=Missing or invalid payload fields.; 修复=Validate model/prompt/size payload fields.; 重试=Retry only after payload fix.
  • 401 authentication_error: 触发=Missing or invalid API key.; 修复=Verify Authorization header and key scope.; 重试=Retry after authentication fix.

gemini-3.1-pro

gemini-3.1-pro by Google (Gemini) is optimized for image generation/editing workflows. Contracts follow ToAPIs docs for production-ready API integration.

模型類型:
價格: Input 80 積分/1M, Output 480 積分/1M
输入消息开始测试模型。

生成案例

探索 gemini-3.1-pro 的生成效果

使用同款模型生成
gemini-3.1-pro guide example 1

gemini-3.1-pro #1

gemini-3.1-pro guide example 2

gemini-3.1-pro #2

gemini-3.1-pro guide example 3

gemini-3.1-pro #3

透明計價

gemini-3.1-pro pricing

Text usage is billed by actual token consumption. Final billing follows the current account quote.

儲值積分
Input 80 積分/1M, Output 480 積分/1M

為什麼選擇 ToAPIs

Why call gemini-3.1-pro through ToAPIs?

Keep model access, API keys, billing, and usage management in one workflow.

High-quality generation

Generate production-ready visual assets via a unified API.

Reference consistency

Use references to stabilize style and composition.

Parameter tuning

Tune ratio/count/sampling for quality and cost balance.

Connect in three steps

Create a key, send a compatible chat request, and monitor usage.

  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-3.1-pro

Use case 1

When generating marketing, e-commerce, and social visual assets quickly.

Use case 2

When reference-guided consistency is required.

常見問題

gemini-3.1-pro FAQ

What is gemini-3.1-pro best for?

Best for high-frequency creative generation and reference-guided consistency workflows.

图像视频模型报错:invalid apitype: -1

这类错误通常说明接口走错了。图像和视频模型一般不走 chat 接口,而是按对应文档发起 HTTP 任务请求,并通过任务状态接口轮询结果。排查时建议先看用户的实际请求代码、请求地址和请求体。

用户进行生成图片/视频的任务时出现任务失败,但是扣款

先让用户提供任务日志或截图,重点看是否出现了输入或输出 token 统计。如果有这类 token 记录,大概率是用户把图片/视频模型走成了 chat 接口;这不是正确用法。图片和视频模型通常是异步任务接口,需要通过 HTTP 请求先提交任务,再拿到任务 ID 轮询状态,详细以对应文档为准。

gemini-3.1-pro API

Start building with gemini-3.1-pro

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

Try gemini-3.1-pro with one ToAPIs key.

Use the same account and API surface across supported text models.

Sign up to get free credits