gemini-3.1-pro-preview
gemini-3.1-pro-preview
文本GoogleGemini 3.1 Progemini-3.1-pro
谷歌最强推理模型
鑑權
- Base URL
https://api.dreamtoai.com- Authorization
Authorization: Bearer YOUR_API_KEY- Content-Type
application/json- 模型名稱 (model)
gemini-3.1-pro-preview
接入協議
為什麼選這個協議
适合原本使用 Gemini SDK 或 generateContent 接口的用户直接迁移。
介面位址
POST/v1beta/models/gemini-3.1-pro-preview:generateContent
Authorization: Bearer YOUR_API_KEYContent-Type: application/json請求 / 回應 JSON
請求
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "你好,世界"
}
]
}
],
"generationConfig": {
"temperature": 0.7,
"topP": 1,
"maxOutputTokens": 4096
},
"tools": []
}回應
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"text": "Hello from Mix API"
}
]
}
}
],
"modelVersion": "gemini-3.1-pro-preview",
"usageMetadata": {
"promptTokenCount": 8,
"candidatesTokenCount": 16,
"totalTokenCount": 24
}
}請求欄位 / 回應欄位
請求欄位
| 欄位 | 類型 | 必填 |
|---|---|---|
| contents | array | Y |
| contents[] | object | Y |
| contents[].role | string | Y |
| contents[].parts | array | Y |
| contents[].parts[] | object | Y |
| contents[].parts[].text | string | Y |
| generationConfig | object | Y |
| generationConfig.temperature | number | Y |
| generationConfig.topP | integer | Y |
| generationConfig.maxOutputTokens | integer | Y |
| tools | array | Y |
回應欄位
| 欄位 | 類型 | 必填 |
|---|---|---|
| output.text | string | N |
程式碼範例
cURLrequest.sh
curl -X POST "https://api.dreamtoai.com/v1beta/models/gemini-3.1-pro-preview:generateContent" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "你好,世界"
}
]
}
],
"generationConfig": {
"temperature": 0.7,
"topP": 1,
"maxOutputTokens": 4096
},
"tools": []
}'