接口提示
gemini-3.5-flash 的输入 token 上限为 1,048,576, 输出 token 上限为 65,536
gemini-3.5-flash 支持文本、图像、视频、音频和 PDF 输入, 并返回文本输出
gemini-3.5-flash 支持 function calling、structured outputs、search grounding、Google Maps grounding、code execution、file search、URL context、caching、Batch API、Flex inference、Priority inference 和 thinking
认证
authorization string 必填
所有 API 均使用 Bearer Token 鉴权
获取 API Key:
访问 API Key 管理页面 获取 API Key
用法:
将以下 Header 添加到请求中:
Authorization: Bearer YOUR_API_KEY
参数
model string 必填
请求使用的模型 ID
值: gemini-3.5-flash
messages array 必填
表示对话历史的消息对象数组
role
string必填消息角色
可选值:
user,assistant,system,developer
content
string | array必填文本字符串或多模态数组
max_tokens integer
生成的最大 token 数量
范围:1 - 65536
temperature number
采样温度
默认值:1.0
范围:0.0 - 2.0
top_p number
核采样参数
默认值:1.0
范围:0.0 - 1.0
stream boolean
是否增量流式返回响应
默认值:false
响应格式
error object
错误信息, 仅在状态为 failed 时存在
code
string错误码
message
string详细错误信息
output array
生成结果, 仅在状态为 completed 时存在
content
array生成的资源内容列表
type
string资源类型
值:
image|videourl
string处理后的资源 URL
jobId
string远端任务 ID
usage object
使用统计, 仅在状态为 completed 时存在
cost
string总费用(美元)
discount
number折扣金额
metadata object
元数据信息