APIMart
Back to all models

Gemini 3.1 Pro Preview API

GoogleModel ID gemini-3.1-pro-previewText modelReleased February 19, 2026

Use Gemini 3.1 Pro Preview to trace a bug across a whole repository in one request, compare a recorded meeting with the minutes that were sent out, or run an agent through many tool calls with fewer wrong turns.

Max input
1,048,576 tokens
Max output
65,536 tokens
Input → output
Text, Image, Video, Audio, File → Text
  • Image input
  • Streaming
  • Cached input pricing
  • OpenAI SDK compatible

Gemini 3.1 Pro Preview API use cases

Each use case comes with an illustrative example: source material, a prompt and a hand-written sample answer, not actual model output. Copy the prompt, swap in your own material and try it on Gemini 3.1 Pro Preview.

Try Gemini 3.1 Pro Preview with your own material

Debugging across a repository

Send Gemini 3.1 Pro Preview the relevant part of a codebase together with the failing test and the error, and ask where the fault starts and which files the fix touches. Have it cite file paths and line ranges so you can check each claim.

Example: Where does this rounding bug start?

Material

Failing test
test_invoice_total: expected 3.35, got 3.34 for three lines of 1.115 (prices have three decimals).
Code
invoices/total.py: total = round(sum(float(l.amount) for l in lines), 2)

PromptFind where the total stops matching the expected value, name the file and function where the bug starts, and propose the smallest fix.

Sample answer · written by hand to show the reasoning

The bug starts in invoices/total.py, where each amount is converted to float before summing. 1.115 has no exact binary value, so three of them add up to 3.3449999…, and round() takes that down to 3.34; summed as Decimal the total is 3.345, which rounds half up to 3.35. Keep amounts as Decimal end to end and round the sum once with quantize(Decimal("0.01"), ROUND_HALF_UP).

About the Gemini 3.1 Pro Preview API

  • A refined Gemini 3 Pro

    Released on February 19, 2026 and based on Gemini 3 Pro, with better thinking, improved token efficiency and more grounded, factually consistent answers, according to Google.

  • 1M-token multimodal input

    A single request can hold up to 1,048,576 tokens of text, images, video, audio and PDF, such as a large part of a codebase or a long recording. Replies are text, up to 65,536 tokens.

  • Tuned for software engineering and tools

    Google optimized it for software engineering and for agentic workflows that need precise tool use and reliable multi-step execution. Function calling, structured output and context caching are supported.

  • Gemini 3.1 Pro Preview API key and access

    You don’t need a separate Gemini 3.1 Pro Preview API key: one APIMart key works for every model. Check the Gemini 3.1 Pro API pricing on this page, then call the Gemini 3.1 Pro API through an OpenAI Chat Completions-compatible endpoint with the model ID gemini-3.1-pro-preview.

Gemini 3.1 Pro Preview official benchmark results

Selected results Google published at launch.

  • ARC-AGI-2

    77.1%

    Abstract reasoning puzzles, ARC Prize verified. Up from 31.1% for Gemini 3 Pro; Claude Opus 4.6 scores 68.8%.

  • Humanity's Last Exam (no tools)

    44.4%

    Hard questions across many disciplines, full set. Up from 37.5% for Gemini 3 Pro and ahead of Claude Opus 4.6 (40.0%).

  • SWE-Bench Verified

    80.6%

    Real GitHub issues fixed in a single attempt. Up from 76.2% for Gemini 3 Pro; Claude Opus 4.6 scores 80.8%.

  • Terminal-Bench 2.0

    68.5%

    Coding tasks in a terminal with the Terminus-2 harness. Up from 56.9% for Gemini 3 Pro and ahead of Claude Opus 4.6 (65.4%).

  • BrowseComp

    85.9%

    Finding hard-to-locate facts with search, Python and browsing. Up from 59.2% for Gemini 3 Pro and ahead of Claude Opus 4.6 (84.0%).

  • MCP Atlas

    69.2%

    Multi-step workflows using MCP tools. Up from 54.1% for Gemini 3 Pro and ahead of Claude Opus 4.6 (59.5%).

How to call the Gemini 3.1 Pro Preview API

To call Gemini 3.1 Pro Preview, you only need an APIMart API key and your existing OpenAI SDK, or send plain HTTP requests.

POST /v1/chat/completions
curl https://api.apimart.ai/v1/chat/completions \
  -H "Authorization: Bearer $APIMART_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gemini-3.1-pro-preview",
  "messages": [
    {
      "role": "user",
      "content": "Describe how to design a clear API in three sentences."
    }
  ],
  "stream": false
}'

Gemini 3.1 Pro Preview access details

Model IDgemini-3.1-pro-preview
Base URLhttps://api.apimart.ai/v1
Endpoint/chat/completions

Common parameters

model
Required
messages
Required
stream
Optional
max_tokens
Optional
temperature
Optional
All request parameters, response fields and error codes

Gemini 3.1 Pro Preview API request parameters

Gemini 3.1 Pro Preview uses the general chat endpoint, POST /v1/chat/completions, with a JSON body. model and messages are required; every other parameter is optional.

ParameterTypeRequiredDescription
modelstringYesModel ID. Use gemini-3.1-pro-preview for this model.
messagesarrayYesConversation messages. Each message has a role (system, user, or assistant) and content. Include earlier messages for multi-turn conversations.
streambooleanNoWhether to stream the output. true returns chunks over SSE, false returns the full response at once. Default: true.
temperaturenumberNoOutput randomness, 0–2. Default: 1.0. Lower values give more deterministic output.
top_pnumberNoNucleus sampling, 0–1. Default: 1.0. Adjust this or temperature, not both.
max_tokensintegerNoMaximum number of tokens to generate for the reply.
frequency_penaltynumberNoFrequency penalty, -2.0 to 2.0. Default: 0. Positive values reduce repeated wording.
presence_penaltynumberNoPresence penalty, -2.0 to 2.0. Default: 0. Positive values encourage new topics.
stopstring | arrayNoUp to 4 stop sequences. Generation stops when any of them appears.
nintegerNoNumber of replies to generate. Default: 1.

Response fields

The response contains the fields below. Token usage is returned in usage, which you can use to check costs.

FieldTypeDescription
idstringUnique identifier for the request.
modelstringThe model that handled the request.
choicesarrayList of replies. Each item contains message (role and content) and finish_reason.
usageobjectToken usage: prompt_tokens, completion_tokens, and total_tokens.

Error codes

Failed requests return an error object with code, message, and type.

StatusTypeMeaning
400invalid_request_errorInvalid request parameters.
401authentication_errorThe API key is invalid or missing.
402payment_requiredInsufficient account balance.
403permission_errorNo permission to access this resource.
429rate_limit_errorToo many requests. Retry later.
500server_errorInternal server error.
502bad_gatewayGateway error. The service is temporarily unavailable.

Gemini 3.1 Pro Preview API pricing

The Gemini 3.1 Pro Preview API is billed by token usage, and prices depend on your membership tier. Prices below are per million tokens; 1 US dollar = 10 credits.

ItemGoldCurrent pricePlatinumDiamondOfficial priceYou save
Input16Credits~$1.615.2Credits~$1.5214.4Credits~$1.4420Credits~$220%
Cached input1.6Credits~$0.161.52Credits~$0.1521.44Credits~$0.1442Credits~$0.220%
Output96Credits~$9.691.2Credits~$9.1286.4Credits~$8.64120Credits~$1220%

Prices are for reference only. View full pricing

Why call Gemini 3.1 Pro Preview API through APIMart

  • 20% below official pricing

    Gemini 3.1 Pro Preview API pricing is billed by token usage. Gold to Diamond member prices are 20%–28% below Google's official prices, and cached input costs just $0.16 per 1M tokens.

    See membership prices
  • One API key for 500+ models

    Gemini 3.1 Pro Preview, the rest of its family and 500+ models from GPT, Claude, Gemini and more share one API key and one account balance. Switching models is just a change to the model parameter.

  • Change two lines of existing code

    If you already use the OpenAI SDK, point base_url at https://api.apimart.ai/v1 and swap in your APIMart API key. Requests and responses keep the same format.

  • Try it online before you code

    Try Gemini 3.1 Pro Preview with your own material in the Playground, no code or setup needed, and integrate once you like the results.

    Open Playground

Which Google model should you choose?

Base prices per 1M tokens (USD). Your Gemini 3.1 Pro Preview API key works for every model in the table; just change the model parameter.

Differences between Google models
ComparisonGemini 3.1 Pro Preview CurrentGemini 3 Flash PreviewGemini 3.5 Flash-LiteGemini 3.6 FlashGemini 3.8 FlashGemini 4 HydrogenGemini 4 ArgonGemini 4 CarbonGemini 4 Neon
Best forAgentic coding, Long multimodal inputs, Three thinking levelsFast multimodal tasks, Agentic coding, Four thinking levelsHigh-volume tasks, Data extraction, SubagentsAgentic tasks, Chart and screen reading, Long documentsLong-horizon coding, Video, audio & PDF input, Enterprise workflowsEveryday coding, Agentic tasks, Chat & questionsSoftware engineering, Knowledge work, Long video and documentsLong-horizon agents, Software engineering, Scientific reasoningComplex coding, Long-running agents, Analytical reasoning
Input typesText, Image, Video, Audio, FileText, Image, Video, Audio, FileText, Image, Video, Audio, FileText, Image, Video, Audio, FileText, Image, Video, Audio, FileText, Image, Audio, VideoText, Image, Audio, VideoText, Image, Audio, VideoText, Image, Audio, Video
Knowledge cutoff——March 2026March 2026March 2026March 2026March 2026March 2026March 2026
Input price$1.6$0.4$0.24$0.6$0.6$1.2$1.6$1.6$2.4
Output price$9.6$2.4$2$3$3$6$8$8$12

Gemini 3.1 Pro Preview FAQ

Should I move from Gemini 3.1 Pro Preview to Gemini 4 Neon?

Google’s model-selection guide maps gemini-3.1-pro-preview to gemini-4-neon, or to gemini-4-carbon for the hardest problems, so compare them for new work. Gemini 3.1 Pro Preview has no shutdown date announced, and workloads already tuned on it can stay while you test. On APIMart both use the same API key; change only the model parameter and rerun your own prompts.

What happened to gemini-3-pro-preview?

Google shut down Gemini 3 Pro Preview on March 9, 2026, and the gemini-3-pro-preview ID now points to gemini-3.1-pro-preview. If you still call the old ID, switch the model parameter to gemini-3.1-pro-preview so you know which model answers.

How do I set the thinking level on Gemini 3.1 Pro Preview?

Gemini 3.1 Pro Preview supports low, medium and high thinking levels, with high as the default. Use low or medium for simpler requests to cut latency and output tokens; Google bills thinking tokens as output.

How can I try this model online?

Click Start chatting or Open Playground to visit the existing APIMart Playground. Select Gemini 3.1 Pro Preview in the text category to start exploring.

Which model ID does the Gemini 3.1 Pro Preview API use?

Set model to gemini-3.1-pro-preview. Copy the exact ID from the page heading or the integration details panel.

Is it compatible with the OpenAI SDK?

You can keep the OpenAI SDK. Set base_url to https://api.apimart.ai/v1, provide your APIMart API key, and use the model ID on this page.

What is the context window of Gemini 3.1 Pro Preview?

On APIMart, Gemini 3.1 Pro Preview accepts up to 1,048,576 input tokens per request. Your prompt, earlier messages, and file content all count toward it.

How many tokens can it output at once?

Gemini 3.1 Pro Preview can output up to 65,536 tokens in a single reply. Use the max_tokens parameter to set a lower limit.

How much does the Gemini 3.1 Pro Preview API cost?

The Gemini 3.1 Pro Preview API on APIMart is billed by token, and prices depend on your membership tier. Gold: $1.6 per million input tokens and $9.6 per million output tokens. Diamond: $1.44 per million input tokens and $8.64 per million output tokens. Prices may change; the pricing page has the current rates.

Does it support streaming?

Yes. The general chat endpoint streams over SSE by default. Set stream to false to receive the complete response at once.

How do I get an API key?

Sign in to APIMart and create a key on the API Keys page, then send it in the Authorization: Bearer header. The same key also works for other models on the platform.