Gemini 3.1 Pro Preview Chat API
google/gemini-3.1-pro-previewGemini 3.1 Pro Preview Chat turns text and multimodal context into detailed analysis, code, and answers for complex tasks, with a 1M-token context window and adjustable reasoning depth. Provide the task, source material, and success criteria so each response stays grounded in the evidence.
Gemini 3.1 Pro Preview
Google · chat-completions
Quick start
Send a POST request to /v1/chat/completions with google/gemini-3.1-pro-preview. Choose JSON or SSE with stream, and receive generated content and usage.
- Endpoint
- POST /v1/chat/completions
- Model ID
- google/gemini-3.1-pro-preview
- Protocol
- Chat Completions
Request fields
| Field | Requirement | Description |
|---|---|---|
| model | Required | google/gemini-3.1-pro-preview |
| messages | Required | A non-empty array of conversation messages. |
| max_tokens | Optional | Limits output tokens for this response. |
| temperature | Optional | Sampling temperature; the playground allows 0–2. |
| top_p | Optional | Nucleus sampling probability; the playground allows 0–1. |
| stream | Optional | Returns an SSE event stream when true. |
Response and usage
Successful responses include generated content and usage. Billing settles from actual input, output, and cache tokens.
Streaming
Set stream: true to read SSE. Finalize usage accounting from the terminal usage event.
curl --request POST \
--url https://api.vidgo.ai/v1/chat/completions \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "google/gemini-3.1-pro-preview",
"messages": [
{
"role": "user",
"content": "Explain why deterministic retries matter in distributed systems."
}
],
"max_tokens": 1024,
"temperature": 1,
"top_p": 1,
"stream": false
}'Keep API keys on the server. Never expose them in browser code or public repositories.
Continue with
Related Models
Gemini 3.1 Pro Preview Chat API frequently asked questions
What is the Gemini 3.1 Pro Preview Chat API?
Gemini 3.1 Pro Preview is Google's Gemini 3 model for complex reasoning, coding, and multimodal analysis. It turns text and media context into detailed answers, code, and structured findings with a 1M-token context window. Set reasoning depth for the task, call the model through Chat Completions or Gemini Native, or try it in the playground above.
How can Gemini 3.1 Pro Preview help with coding?
Send the goal, relevant source files, constraints, and test results. Ask the model to connect the evidence, plan the change, and review the result against the requirements.
How much context can Gemini 3.1 Pro Preview analyze?
It has a 1M-token context window. Group the documents, code, and conversation history needed to answer one focused question.
How do I send multimodal input to Gemini 3.1 Pro Preview?
Use Gemini Native contents with text and inlineData parts. Include mimeType and Base64 data for inline media, then state the details to analyze in text.
How do I stream Gemini 3.1 Pro Preview responses?
Set stream to true in Chat Completions, or call streamGenerateContent?alt=sse through Gemini Native. Read the SSE events in order and inspect usageMetadata for token counts.
What does Gemini 3.1 Pro Preview cost on Vidgo AI?
Input costs 160 credits ($0.80) and output costs 960 credits ($4.80) per 1M tokens. Check response usage and the Pricing table above for the rate applied to each token direction.