Introduction
Gemini 3.1 Pro Preview targets software engineering and precise tool use; this SpicyAPI interface accepts 1,000,000 input tokens and caps output at 32,768.
| Field | Value |
|---|---|
| Input | Text |
| Output | Text |
| Required | messages |
| Optional | Gemini 3.1 Pro Preview: |
| Input context | 1,000,000 tokens |
| Maximum output | 32,768 tokens (default 16,384) |
| Response | Gemini 3.1 Pro Preview returns a chat.completion response, or SSE chunks when streaming is requested. |
| Settlement | Measured input, cached input and output tokens |
Key features & highlights
Reads a shelf, writes a paragraph
1,000,000 tokens in and 32,768 out is about thirty to one, and the ratio is the instruction manual. Attach the bible, the character sheets and every chapter written so far, then ask for one reply that moves the scene forward. What comes back is short by design and consistent with every page you sent. Keep each Gemini 3.1 Pro Preview response within this interface’s 32,768-token output budget.
The history rides along uncompressed
Long roleplay drifts mostly because the history has to be summarised to fit. A 1,000,000-token window usually deletes that step: re-send the original text every turn and the detail planted thirty chapters ago is still in front of the model instead of buried in a paraphrase of itself.
It can change without notice
A preview model's lifecycle belongs to Google. Behaviour, availability and price can all move, and it can be withdrawn. Before it carries a production thread, decide which model that thread falls back to.
Request parameters
| Parameter | Required | Description |
|---|---|---|
messages | Yes | Build the Gemini 3.1 Pro Preview conversation in chronological messages using text and |
max_tokens | No | Gemini 3.1 Pro Preview reserves |
reasoning_effort | No | For Gemini 3.1 Pro Preview, |
stop | No | In Gemini 3.1 Pro Preview, stop accepts up to four ending sequences; matching text is omitted and billing covers the tokens actually produced before termination. at least 1 characters · at least 1 items · at most 4 items |
seed | No | Use seed to compare one changed input at a time in Gemini 3.1 Pro Preview; identical seeds do not promise identical answers or alter token rates. |
temperature | No | Gemini 3.1 Pro Preview accepts temperature from 0 to 2, default 1; test changes against your own task rather than treating lower values as a correctness guarantee. |
top_p | No | For Gemini 3.1 Pro Preview sampling comparisons, adjust |
tools | No | Up to 128 function definitions per request. at most 128 items |
tool_choice | No | With Gemini 3.1 Pro Preview, |
response_format | No | For Gemini 3.1 Pro Preview extraction, specify the expected keys alongside |
Pricing
Input $1.90 / Output $11.40 per 1 million tokens; Prompts over 200K tokens: Input $3.80 / Output $17.10
Above 200,000 input tokens, long-context rates apply to the whole request.
Use cases
Continue a scene inside 300,000 words of context
Send the bible, the relationship map and every chapter written so far, then ask for a single turn. Nothing was retrieved or sampled, so a promise made in the first act is still visible while the model writes the third.
Continuity audit across chapters
Put the world rules and the finished chapters in the same request and ask which passages contradict them. What comes back is a list of conflicts with citations rather than a rewrite - a long read with a short answer, which is exactly this ratio's home ground.
One judgement on a very large document set
Load a full specification set, a quarter's worth of tickets or an entire mailbox into one call and ask what actually changed. A 32,768-token reply is plenty for the finding and the citations behind it.
Character state as JSON for your app
Ask for each character's current position, injuries, relationships and known secrets as a JSON object: response_format set to json_object, with every key named in the system message. Your save file stays in sync with the prose without a rescue parser.
Prompt guide & pro tips
Rules in system, story in user
Put the world rules, the voice you want and the length of this turn in the system message. Put the bible, the relationship map and the history in one user message, oldest first, and finish with the instruction for this turn.
Re-send the whole history, do not summarise it
The window holds 1,000,000 tokens, usually more than a finished novel. Re-sending the original text each turn does cost input tokens, but it is the cheapest continuity you can buy: nothing is lost to a paraphrase.
Size the output limit for one turn, not one chapter
The default is 16,384 and the hard ceiling is 32,768. A scene continuation usually lands between 1,000 and 3,000 tokens; asking for a full chapter pushes the model into the shape it handles worst.
low for ordinary turns, high for audits
reasoning_effortdefaults to medium. Drop it to low for banter and routine exchanges, and raise it to high when the question becomes whether a new development contradicts something established in chapter four.
Gemini 3.1 Pro Preview targets software engineering and precise tool use; this SpicyAPI interface accepts 1,000,000 input tokens and caps output at 32,768.
Reads a shelf, writes a paragraph
1,000,000 tokens in and 32,768 out is about thirty to one, and the ratio is the instruction manual. Attach the bible, the character sheets and every chapter written so far, then ask for one reply that moves the scene forward. What comes back is short by design and consistent with every page you sent. Keep each Gemini 3.1 Pro Preview response within this interface’s 32,768-token output budget.
The history rides along uncompressed
Long roleplay drifts mostly because the history has to be summarised to fit. A 1,000,000-token window usually deletes that step: re-send the original text every turn and the detail planted thirty chapters ago is still in front of the model instead of buried in a paraphrase of itself.
It can change without notice
A preview model's lifecycle belongs to Google. Behaviour, availability and price can all move, and it can be withdrawn. Before it carries a production thread, decide which model that thread falls back to.
Continue a scene inside 300,000 words of context
Send the bible, the relationship map and every chapter written so far, then ask for a single turn. Nothing was retrieved or sampled, so a promise made in the first act is still visible while the model writes the third.
Continuity audit across chapters
Put the world rules and the finished chapters in the same request and ask which passages contradict them. What comes back is a list of conflicts with citations rather than a rewrite - a long read with a short answer, which is exactly this ratio's home ground.
One judgement on a very large document set
Load a full specification set, a quarter's worth of tickets or an entire mailbox into one call and ask what actually changed. A 32,768-token reply is plenty for the finding and the citations behind it.
Character state as JSON for your app
Ask for each character's current position, injuries, relationships and known secrets as a JSON object: response_format set to json_object, with every key named in the system message. Your save file stays in sync with the prose without a rescue parser.
Rules in system, story in user
Put the world rules, the voice you want and the length of this turn in the system message. Put the bible, the relationship map and the history in one user message, oldest first, and finish with the instruction for this turn.
Re-send the whole history, do not summarise it
The window holds 1,000,000 tokens, usually more than a finished novel. Re-sending the original text each turn does cost input tokens, but it is the cheapest continuity you can buy: nothing is lost to a paraphrase.
Size max_tokens for one turn, not one chapter
The default is 16,384 and the hard ceiling is 32,768. A scene continuation usually lands between 1,000 and 3,000 tokens; asking for a full chapter pushes the model into the shape it handles worst.
low for ordinary turns, high for audits
reasoning_effort defaults to medium. Drop it to low for banter and routine exchanges, and raise it to high when the question becomes whether a new development contradicts something established in chapter four.
Gemini 3.1 Pro Preview reserves max_tokens for both thinking and the visible answer: default 16,384, ceiling 32,768, with reasoning counted as output usage.
Gemini 3.1 Pro Preview remains subject to its own content rules even though SpicyAPI adds no filter; use authorized material and respect privacy, consent and applicable terms.
max_tokens
Gemini 3.1 Pro Preview reserves max_tokens for both thinking and the visible answer: default 16,384, ceiling 32,768, with reasoning counted as output usage.
messages
Build the Gemini 3.1 Pro Preview conversation in chronological messages using text and image_url; all messages share the 1,000,000-token input budget.
reasoning_effort
For Gemini 3.1 Pro Preview, reasoning_effort accepts minimal, low, medium, high and defaults to medium; compare measured token usage when changing how much deliberation a request needs.
response_format
For Gemini 3.1 Pro Preview extraction, specify the expected keys alongside response_format and validate the returned JSON before storing the extracted record.
seed
Use seed to compare one changed input at a time in Gemini 3.1 Pro Preview; identical seeds do not promise identical answers or alter token rates.
stop
In Gemini 3.1 Pro Preview, stop accepts up to four ending sequences; matching text is omitted and billing covers the tokens actually produced before termination.
temperature
Gemini 3.1 Pro Preview accepts temperature from 0 to 2, default 1; test changes against your own task rather than treating lower values as a correctness guarantee.
tool_choice
With Gemini 3.1 Pro Preview, tool_choice can leave selection automatic, disable tools, require a call or name the function your workflow must invoke.
tools
Up to 128 function definitions per request.
top_p
For Gemini 3.1 Pro Preview sampling comparisons, adjust top_p within 0.01–1 while keeping temperature fixed so the effect of one control remains visible.
Above 200,000 input tokens, long-context rates apply to the whole request.
Gemini 3.1 Pro Preview remains subject to its own content rules even though SpicyAPI adds no filter; use authorized material and respect privacy, consent and applicable terms. Use Gemini 3.1 Pro Preview only with lawful, consensual adult material; content involving minors is prohibited.
Gemini 3.1 Pro Preview remains subject to its own content rules even though SpicyAPI adds no filter; use authorized material and respect privacy, consent and applicable terms.
Gemini 3.1 Pro Preview remains subject to its own content rules even though SpicyAPI adds no filter; use authorized material and respect privacy, consent and applicable terms. Use Gemini 3.1 Pro Preview only with lawful, consensual adult material; content involving minors is prohibited.
Gemini 3.1 Pro Preview remains subject to its own content rules even though SpicyAPI adds no filter; use authorized material and respect privacy, consent and applicable terms.
API quick start
curl --fail-with-body -sN https://api.spicyapi.ai/v1/chat/completions \
-H "Authorization: Bearer $SPICY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "google/gemini-3.1-pro-preview/chat",
"messages": [
{
"role": "user",
"content": "Summarise the following release notes into three bullet points."
}
],
"stream": true
}' \
| jq --unbuffered -Rrj 'select(startswith("data: ")) | .[6:] | select(. != "[DONE]") | fromjson | if .error then "\n[error] \(.error.message)\n" else (.choices[0].delta.content? // empty) end'
See the API reference for authentication, the complete schema, polling, and error handling.



















