Skip to main content
POST
Gemini 原生格式

接口

原生接口支持 Authorization: Bearer <TOKEN> 鉴权,也支持 x-goog-api-key: <TOKEN>。

快速开始

流式输出

多模态输入

原生接口通过 contents[].parts[] 承载多模态内容:文本用 text,媒体用 inline_data(mime_type + Base64 data)。

音频理解

图片同理使用 inline_data,mime_type 为 image/png、image/jpeg 等。gemini-3-pro-preview-file 模型支持通过 URL 直接分析视频文件,详细用法请参阅视频分析文档。

思考模式(Reasoning)

Gemini 2.5 和 3 系列支持思考推理能力,通过 generationConfig.thinkingConfig 配置。 Gemini 3 系列使用 thinkingLevel:
Gemini 2.5 系列使用 thinkingBudget:

生成参数

Gemini 3 建议保持 temperature 为 1.0,过低可能导致推理性能下降。

SDK 示例(Python · Google SDK)

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

路径参数

model
string
必填

模型名称

示例:

"gemini-2.5-flash"

请求体

application/json
contents
object[]
必填

对话内容数组

generationConfig
object

生成配置,如 temperature、thinkingConfig

响应

200

成功返回生成结果