官方文档:https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cnDocumentation Index
Fetch the complete documentation index at: https://docs.agicto.com/llms.txt
Use this file to discover all available pages before exploring further.
Endpoint
POST /v1/images/generations
Headers
Authorization: 可选 示例:Bearer xxx
Request example
"{\r\n \"model\": \"gemini-2.5-flash-image-preview\",\r\n \"contents\": [\r\n {\r\n \"role\": \"user\",\r\n \"parts\": [\r\n {\r\n \"text\": \"'Hi, This is a picture of me. Can you add a llama next to me\"\r\n },\r\n {\r\n \"inline_data\": {\r\n \"mime_type\": \"image/png\",\r\n \"data\": \"iVBORw++dr59PZ9=\" //图片base64\r\n }\r\n },\r\n {\r\n \"inline_data\": {\r\n \"mime_type\": \"image/png\",\r\n \"data\": \"iVBORw++dr59PZ9=\" //图片base64\r\n }\r\n }\r\n ]\r\n }\r\n ],\r\n \"generationConfig\": {\r\n \"responseModalities\": [\r\n \"TEXT\",\r\n \"IMAGE\"\r\n ],\r\n \"imageConfig\": {\r\n \"aspectRatio\": \"1:1\",\r\n \"imageSize\": \"1K\"\r\n }\r\n }\r\n}"
Responses
200: 成功
OpenAPI specification
openapi: 3.0.1
info:
title: ''
description: ''
version: 1.0.0
paths:
/v1/images/generations:
post:
summary: 谷歌生图nano banana
deprecated: false
description: 官方文档:https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn
tags:
- 图片
parameters:
- name: Authorization
in: header
description: ''
required: false
example: Bearer xxx
schema:
type: string
requestBody:
content:
application/json:
schema:
type: object
properties:
model:
type: string
contents:
type: array
items:
type: object
properties:
role:
type: string
parts:
type: array
items:
type: object
properties:
text:
type: string
inline_data:
type: object
properties:
mime_type:
type: string
data:
description: 图片base64
type: string
required:
- mime_type
- data
x-apifox-orders:
- mime_type
- data
required:
- inline_data
x-apifox-orders:
- text
- inline_data
x-apifox-orders:
- role
- parts
generationConfig:
type: object
properties:
responseModalities:
type: array
items:
type: string
description: '["TEXT", "IMAGE"]'
imageConfig:
type: object
properties:
aspectRatio:
type: string
description: 比例,1:1、2:3、3:2、3:4、4:3、4:5、5:4、9:16、16:9、21:9
imageSize:
type: string
description: 分辨率,1K、2K、4K
x-apifox-orders:
- aspectRatio
- imageSize
required:
- aspectRatio
- imageSize
description: 分辨率、比例设置
required:
- responseModalities
- imageConfig
x-apifox-orders:
- responseModalities
- imageConfig
description: 图片配置
required:
- model
- contents
- generationConfig
x-apifox-orders:
- model
- contents
- generationConfig
example: "{\r\n \"model\": \"gemini-2.5-flash-image-preview\",\r\n \"contents\": [\r\n {\r\n \"role\": \"user\",\r\n \"parts\": [\r\n {\r\n \"text\": \"'Hi, This is a picture of me. Can you add a llama next to me\"\r\n },\r\n {\r\n \"inline_data\": {\r\n \"mime_type\": \"image/png\",\r\n \"data\": \"iVBORw++dr59PZ9=\" //图片base64\r\n }\r\n },\r\n {\r\n \"inline_data\": {\r\n \"mime_type\": \"image/png\",\r\n \"data\": \"iVBORw++dr59PZ9=\" //图片base64\r\n }\r\n }\r\n ]\r\n }\r\n ],\r\n \"generationConfig\": {\r\n \"responseModalities\": [\r\n \"TEXT\",\r\n \"IMAGE\"\r\n ],\r\n \"imageConfig\": {\r\n \"aspectRatio\": \"1:1\",\r\n \"imageSize\": \"1K\"\r\n }\r\n }\r\n}"
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties: {}
x-apifox-orders: []
headers: {}
x-apifox-name: 成功
security: []
x-apifox-folder: 图片
x-apifox-status: released
x-run-in-apifox: https://app.apifox.com/web/project/5443699/apis/api-344307289-run
components:
schemas: {}
securitySchemes: {}
servers: []
security: []
