OpenLux

图片生成 gemini-3-pro-image 控制宽高比 +清晰度

接口: POST https://api.openlux.ai/v1beta/models/gemini-3-pro-image:generateContent

官方文档:https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn#gemini-image-editing

参数

  • key (query, string, 必填): API Key(也可使用 Authorization: Bearer)
  • Content-Type (header, string, 必填): 请求体类型,一般为 application/json

请求体 (application/json)

  • contents (array<object>, 必填): 对话内容列表;每项含 parts(文本/图片等)
  • generationConfig (object, 必填): 生成配置(模态、图片尺寸、语音等)
  • response_format (string): 填url返回url,不填默认base64

请求示例

{
  "contents": [
    {
      "parts": [
        {
          "text": "'Hi, This is a picture of me. Can you add a llama next to me"
        },
        {
          "inline_data": {
            "data": "iVBORw0KGgoAAAANSUhEUgAABAAAAAKoCAIA...",
            "mime_type": "image/jpeg"
          }
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ]
  },
  "response_format": "url"
}