gemini-3.1-flash-lite
gemini-3.1-flash-lite
TextGoogleGemini-3.1-flash-litegemini-3.1-flash-lite
gemini-3.1-flash
Authentifizierung
- Base URL
https://api.dreamtoai.com- Authorization
Authorization: Bearer YOUR_API_KEY- Content-Type
application/json- Modellname (model)
gemini-3.1-flash-lite
Integrationsprotokoll
Warum dieses Protokoll
适合原本使用 Gemini SDK 或 generateContent 接口的用户直接迁移。
Endpunkt-URL
POST/v1beta/models/gemini-3.1-flash-lite:generateContent
Authorization: Bearer YOUR_API_KEYContent-Type: application/jsonRequest- / Response-JSON
Anfrage
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "你好,世界"
}
]
}
],
"generationConfig": {
"temperature": 0.7,
"topP": 1,
"maxOutputTokens": 4096
},
"tools": []
}Antwort
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"text": "Hello from Mix API"
}
]
}
}
],
"modelVersion": "gemini-3.1-flash-lite",
"usageMetadata": {
"promptTokenCount": 8,
"candidatesTokenCount": 16,
"totalTokenCount": 24
}
}Request- / Response-Felder
Request-Felder
| Feld | Typ | Erforderlich |
|---|---|---|
| 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 |
Response-Felder
| Feld | Typ | Erforderlich |
|---|---|---|
| candidates[].content.parts[].text | string | N |
| usageMetadata.promptTokenCount | integer | N |
| usageMetadata.candidatesTokenCount | integer | N |
| usageMetadata.totalTokenCount | integer | N |
Codebeispiele
cURLrequest.sh
curl -X POST "https://api.dreamtoai.com/v1beta/models/gemini-3.1-flash-lite: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": []
}'