> ## Documentation Index
> Fetch the complete documentation index at: https://docs.socialvision.tisyk.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Gemini 原生与兼容接口

> Google Gemini 3.8 系列、Gemini 3 Pro 原生 v1beta 协议与 chat 兼容格式支持

## 图片编辑

`POST /v1beta/models/gemini-2.0-flash-exp-image-generation:generateContent`

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

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  对话内容列表；每项含 parts（文本/图片等）
</ParamField>

<ParamField body="generationConfig" type="object" required>
  生成配置（模态、图片尺寸、语音等）
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "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"
    ]
  }
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-2.0-flash-exp-image-generation:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "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"
    ]
  }
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## google search

`POST /v1beta/models/gemini-2.5-flash:generateContent`

官方文档：[https://ai.google.dev/gemini-api/docs/document-processing?hl=zh-cn](https://ai.google.dev/gemini-api/docs/document-processing?hl=zh-cn)

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  内容列表（多轮/多模态）
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "text": "今天重庆天气如何?"
        }
      ],
      "role": "user"
    }
  ],
  "tools": [
    {
      "googleSearch": {}
    }
  ]
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-2.5-flash:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "今天重庆天气如何?"
        }
      ],
      "role": "user"
    }
  ],
  "tools": [
    {
      "googleSearch": {}
    }
  ]
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## 图片生成 gemini-2.5-flash-image 控制宽高比

`POST /v1beta/models/gemini-2.5-flash-image:generateContent`

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

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  对话内容列表；每项含 parts（文本/图片等）
</ParamField>

<ParamField body="generationConfig" type="object" required>
  生成配置（模态、图片尺寸、语音等）
</ParamField>

<ParamField body="response_format" type="string">
  填url返回url，不填默认base64
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "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": {
    "imageConfig": {
      "aspectRatio": "16:9"
    },
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ]
  }
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-2.5-flash-image:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "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": {
    "imageConfig": {
      "aspectRatio": "16:9"
    },
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ]
  }
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## TTS 文本转语音

`POST /v1beta/models/gemini-2.5-flash-preview-tts:generateContent`

使用 Gemini 2.5 Flash Preview TTS 将文本合成为语音。请求体需在 `generationConfig.responseModalities` 中包含 `AUDIO`，并通过 `speechConfig.voiceConfig` 指定音色。

官方文档：[https://ai.google.dev/gemini-api/docs/audio?hl=zh-cn](https://ai.google.dev/gemini-api/docs/audio?hl=zh-cn)

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，固定为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  对话内容列表；TTS 通常只需一条用户消息，在 parts 中提供待朗读文本
</ParamField>

<ParamField body="generationConfig" type="object" required>
  生成配置；TTS 必须声明 AUDIO 模态，并配置音色
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "text": "说出,我是谁,谁是我"
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "AUDIO"
    ],
    "speechConfig": {
      "voiceConfig": {
        "prebuiltVoiceConfig": {
          "voiceName": "Kore"
        }
      }
    }
  },
  "model": "gemini-2.5-flash-preview-tts"
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-2.5-flash-preview-tts:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "说出,我是谁,谁是我"
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "AUDIO"
    ],
    "speechConfig": {
      "voiceConfig": {
        "prebuiltVoiceConfig": {
          "voiceName": "Kore"
        }
      }
    }
  },
  "model": "gemini-2.5-flash-preview-tts"
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## 视频理解-url \[原生格式]  开发中

`POST /v1beta/models/gemini-2.5-pro:generateContent`

官方文档：[https://ai.google.dev/gemini-api/docs/video-understanding?hl=zh-cn](https://ai.google.dev/gemini-api/docs/video-understanding?hl=zh-cn)

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  内容列表（多轮/多模态）
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "file_data": {
            "file_uri": "https://generativelanguage.googleapis.com/v1beta/files/rsmb0ggleyv0",
            "mime_type": "video/mp4"
          }
        },
        {
          "text": "Please summarize the video in 3 sentences."
        }
      ],
      "role": "user"
    }
  ]
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-2.5-pro:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "file_data": {
            "file_uri": "https://generativelanguage.googleapis.com/v1beta/files/rsmb0ggleyv0",
            "mime_type": "video/mp4"
          }
        },
        {
          "text": "Please summarize the video in 3 sentences."
        }
      ],
      "role": "user"
    }
  ]
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## gemini-tts文本转语音

`POST /v1beta/models/gemini-2.5-pro-preview-tts:generateContent`

官方文档：[https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations](https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations)

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  对话内容列表；在 parts.text 中提供待朗读文本
</ParamField>

<ParamField body="generationConfig" type="object" required>
  生成配置；须包含 AUDIO 模态与音色配置
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "text": "Say cheerfully: Have a wonderful day!"
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "AUDIO"
    ],
    "speechConfig": {
      "voiceConfig": {
        "prebuiltVoiceConfig": {
          "voiceName": "Kore"
        }
      }
    }
  }
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-2.5-pro-preview-tts:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Say cheerfully: Have a wonderful day!"
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "AUDIO"
    ],
    "speechConfig": {
      "voiceConfig": {
        "prebuiltVoiceConfig": {
          "voiceName": "Kore"
        }
      }
    }
  }
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "inlineData": {
              "data": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...",
              "mimeType": "audio/L16;codec=pcm;rate=24000"
            }
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP",
      "index": 0,
      "safetyRatings": []
    }
  ],
  "modelVersion": "gemini-2.5-pro-preview-tts",
  "promptFeedback": {
    "safetyRatings": []
  },
  "responseId": "nXxoaf7mPM6j_uMPyICzkQo",
  "usageMetadata": {
    "candidatesTokenCount": 51,
    "promptTokenCount": 9,
    "promptTokensDetails": [
      {
        "modality": "TEXT",
        "tokenCount": 9
      }
    ],
    "thoughtsTokenCount": 0,
    "totalTokenCount": 60
  }
}
```

***

## 文本生成+思考-流

`POST /v1beta/models/gemini-2.5-pro:streamGenerateContent`

官方文档：[https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations](https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations)

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField query="alt" type="string">
  响应格式，流式场景常用 sse
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  内容列表（多轮/多模态）
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "text": "1+2+3+4+5+....+999?"
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "thinkingConfig": {
      "includeThoughts": true,
      "thinkingBudget": 26240
    },
    "topP": 1
  },
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HATE_SPEECH",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_CIVIC_INTEGRITY",
      "threshold": "BLOCK_NONE"
    }
  ],
  "systemInstruction": {
    "parts": [
      {
        "text": "hi"
      }
    ],
    "role": "user"
  },
  "tools": []
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-2.5-pro:streamGenerateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "1+2+3+4+5+....+999?"
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "thinkingConfig": {
      "includeThoughts": true,
      "thinkingBudget": 26240
    },
    "topP": 1
  },
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HATE_SPEECH",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
      "threshold": "OFF"
    },
    {
      "category": "HARM_CATEGORY_CIVIC_INTEGRITY",
      "threshold": "BLOCK_NONE"
    }
  ],
  "systemInstruction": {
    "parts": [
      {
        "text": "hi"
      }
    ],
    "role": "user"
  },
  "tools": []
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## gemini-3.1-flash-lite-image

`POST /v1beta/models/gemini-3.1-flash-lite-image:generateContent`

官方文档：[https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn](https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn) — Gemini 3.1 Flash-Lite Image（Nano Banana 2 Lite）文生图、图生图、视频转图与图像编辑。

### 请求参数 (Query / Path)

<ParamField header="Authorization" type="string">
  Bearer API Key
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  对话内容列表，必填。文生图时至少包含 1 条 user 消息；图生图/编辑时在 parts 中附带 inlineData 或 fileData；多轮编辑时按时间顺序追加历史消息。上游约束：总输入 token 不超过 65536；单文件输入不超过 500MB。
</ParamField>

<ParamField body="generationConfig" type="object">
  生成配置。生图场景下 responseModalities 必须包含 IMAGE；imageConfig 控制宽高比与输出格式；thinkingConfig 可选。
</ParamField>

<ParamField body="response_format" type="string">
  填url返回url，不填默认base64
</ParamField>

<ParamField body="safetySettings" type="array">
  安全设置，可选。控制各类有害内容过滤阈值。
</ParamField>

<ParamField body="systemInstruction" type="object">
  系统指令，可选。用于约束输出风格、语言、格式等，如图生图时要求“只输出图片相关说明”或翻译场景限制输出内容。
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "text": "A cute cat sitting on a wooden table, watercolor style."
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "imageConfig": {
      "aspectRatio": "1:1"
    },
    "responseModalities": [
      "IMAGE"
    ]
  },
  "response_format": "url"
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-3.1-flash-lite-image:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "A cute cat sitting on a wooden table, watercolor style."
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "imageConfig": {
      "aspectRatio": "1:1"
    },
    "responseModalities": [
      "IMAGE"
    ]
  },
  "response_format": "url"
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "inlineData": {
              "data": "string",
              "mimeType": "string"
            },
            "thoughtSignature": "string"
          }
        ],
        "role": "string"
      },
      "finishReason": "string"
    }
  ],
  "createTime": "string",
  "modelVersion": "string",
  "responseId": "string",
  "usageMetadata": {
    "candidatesTokenCount": 0,
    "candidatesTokensDetails": [
      {
        "modality": "string",
        "tokenCount": 0
      }
    ],
    "promptTokenCount": 0,
    "promptTokensDetails": [
      {
        "modality": "string",
        "tokenCount": 0
      }
    ],
    "totalTokenCount": 0,
    "trafficType": "string"
  }
}
```

***

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

`POST /v1beta/models/gemini-3-pro-image-preview:generateContent`

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

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  对话内容列表；每项含 parts（文本/图片等）
</ParamField>

<ParamField body="generationConfig" type="object" required>
  生成配置（模态、图片尺寸、语音等）
</ParamField>

<ParamField body="response_format" type="string">
  填url返回url，不填默认base64
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "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"
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-3-pro-image-preview:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "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"
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## 文本生成 gemini-3-pro-preview:generateContent

`POST /v1beta/models/gemini-3-pro-preview:generateContent`

官方文档：[https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations](https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations)

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  内容列表（多轮/多模态）
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "text": "你是谁?"
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "thinkingConfig": {
      "includeThoughts": true,
      "thinkingBudget": 26240
    },
    "topP": 1
  },
  "systemInstruction": {
    "parts": [
      {
        "text": "你是一直小猪.你会在回复开始的时候 加一个'哼哼'"
      }
    ]
  }
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-3-pro-preview:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "你是谁?"
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "thinkingConfig": {
      "includeThoughts": true,
      "thinkingBudget": 26240
    },
    "topP": 1
  },
  "systemInstruction": {
    "parts": [
      {
        "text": "你是一直小猪.你会在回复开始的时候 加一个'哼哼'"
      }
    ]
  }
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## 文本生成-流

`POST /v1beta/models/gemini-3-pro-preview:streamGenerateContent`

官方文档：[https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations](https://ai.google.dev/gemini-api/docs/text-generation?hl=zh-cn#multi-turn-conversations)

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField query="alt" type="string">
  响应格式，流式场景常用 sse
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  内容列表（多轮/多模态）
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "text": "Hello there"
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "thinkingConfig": {
      "includeThoughts": true,
      "thinkingBudget": 26240
    },
    "topP": 1
  },
  "systemInstruction": {
    "parts": [
      {
        "text": "You are a cat. Your name is Neko."
      }
    ]
  }
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-3-pro-preview:streamGenerateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Hello there"
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "thinkingConfig": {
      "includeThoughts": true,
      "thinkingBudget": 26240
    },
    "topP": 1
  },
  "systemInstruction": {
    "parts": [
      {
        "text": "You are a cat. Your name is Neko."
      }
    ]
  }
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## 文本嵌入

`POST /v1beta/models/gemini-embedding-001:embedContent`

[https://ai.google.dev/gemini-api/docs/embeddings?hl=zh-cn#rest\_3](https://ai.google.dev/gemini-api/docs/embeddings?hl=zh-cn#rest_3)   官方文档

### 请求参数 (Query / Path)

<ParamField header="Content-Type" type="string">
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="content" type="object" required>
  要嵌入的内容。
</ParamField>

<ParamField body="output_dimensionality" type="integer">
  输出嵌入的可选降维。
</ParamField>

<ParamField body="taskType" type="string">
  嵌入将用于的可选任务类型。
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "content": {
    "parts": [
      {
        "text": "What is the meaning of life?"
      }
    ]
  },
  "output_dimensionality": 768,
  "taskType": "SEMANTIC_SIMILARITY"
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/gemini-embedding-001:embedContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "content": {
    "parts": [
      {
        "text": "What is the meaning of life?"
      }
    ]
  },
  "output_dimensionality": 768,
  "taskType": "SEMANTIC_SIMILARITY"
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "embedding": {
    "values": [
      -0.0296398,
      -0.010636787,
      0.012426536,
      -0.043735605,
      -0.012861362
    ]
  }
}
```

***

## Imagen 4 开发中

`POST /v1beta/models/imagen-4.0-generate-001:predict`

官方文档：[https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn](https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn)

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="instances" type="array" required>
  Imagen 预测实例列表
</ParamField>

<ParamField body="parameters" type="object" required>
  Imagen 生成参数
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "instances": [
    {
      "prompt": "小女孩"
    }
  ],
  "parameters": {
    "sampleCount": 4
  }
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/imagen-4.0-generate-001:predict" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "instances": [
    {
      "prompt": "小女孩"
    }
  ],
  "parameters": {
    "sampleCount": 4
  }
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## Imagen 生成图片

`POST /v1beta/models/imagen-4.0-ultra-generate-001:predict`

官方文档：[https://ai.google.dev/gemini-api/docs/document-processing?hl=zh-cn](https://ai.google.dev/gemini-api/docs/document-processing?hl=zh-cn)

### 请求参数 (Query / Path)

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="instances" type="array" required>
  Imagen 预测实例列表
</ParamField>

<ParamField body="parameters" type="object" required>
  Imagen 生成参数
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "instances": [
    {
      "prompt": "Robot holding a red skateboard"
    }
  ],
  "parameters": {
    "sampleCount": 4
  }
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/imagen-4.0-ultra-generate-001:predict" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "instances": [
    {
      "prompt": "Robot holding a red skateboard"
    }
  ],
  "parameters": {
    "sampleCount": 4
  }
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## 图片生成

`POST /v1beta/models/{modeName}:generateContent`

官方文档：[https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn](https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn)

### 请求参数 (Query / Path)

<ParamField path="modeName" type="string" required>
  模型名称：
  gemini-2.5-flash-image
  gemini-2.5-flash-image-preview
  gemini-3-pro-image-preview
  gemini-3.1-flash-image-preview
</ParamField>

<ParamField query="key" type="string" required>
  API Key（也可使用 Authorization: Bearer）
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体类型，一般为 application/json
</ParamField>

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  对话内容列表；每项含 parts（文本/图片等）
</ParamField>

<ParamField body="generationConfig" type="object">
  生成配置
</ParamField>

<ParamField body="response_format" type="string">
  填url返回url，不填默认base64
</ParamField>

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/{modeName}:generateContent" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## POST /v1beta/models/\*path

`POST /v1beta/models/*path`

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1beta/models/*path" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## 列出模型

`GET /v1alpha/models`

返回可用 Gemini 模型列表。

### 请求示例 (cURL)

```bash theme={null}
curl "https://socialvision.tisyk.xyz/v1alpha/models" \
  -H "Authorization: Bearer sk-YOUR_API_KEY"
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***

## Generate Content

`POST /v1alpha/models/*path`

Gemini generateContent 调用，path 为 ``{`model`}`:`{`action`}``，如 `gemini-2.0-flash:generateContent`。

### 请求体参数 (Body)

<ParamField body="contents" type="array" required>
  内容列表（多轮/多模态）
</ParamField>

<ParamField body="generationConfig" type="object">
  生成配置
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "contents": [
    {
      "parts": [
        {
          "text": "Hello"
        }
      ],
      "role": "user"
    }
  ]
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1alpha/models/*path" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Hello"
        }
      ],
      "role": "user"
    }
  ]
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "id": "resp_example",
  "object": "response",
  "status": "completed"
}
```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.