Gemini thinking settings
This page covers Gemini’s thinking defaults and how to adjust them. For model IDs and endpoints, see the Gemini family overview.
Key pointExcept for Flash-Lite, Gemini models think by default, and complex questions can take more than a minute. Reduce thinking when speed matters.
Gemini models think before answering. Thinking tokens count as output and are billed at the output rate; the count is in usageMetadata.thoughtsTokenCount (usage.completion_tokens_details.reasoning_tokens on the OpenAI-compatible API).
In our tests on the same math problem, thinkingLevel: "low" cut Gemini 3.5 Flash’s thinking tokens from about 6000 to about 4600, with a corresponding drop in latency. thinkingBudget: 0 turns off thinking on 3.5 Flash and 3 Flash Preview; 3.1 Pro Preview and 3.8 Flash still think when it is passed and cannot turn thinking off completely.
Python (google-genai)
gemini_thinking.py
import os
from google import genai
from google.genai import types
client = genai.Client(
api_key=os.environ["OFOX_API_KEY"],
http_options={"api_version": "v1beta", "base_url": "https://api.ofox.ai/gemini"},
)
resp = client.models.generate_content(
model="google/gemini-3.8-flash",
contents="Find all positive integers n less than 50 for which n² + n + 41 is not prime.",
config=types.GenerateContentConfig(
thinking_config=types.ThinkingConfig(thinking_level="low"),
),
)
print(resp.text)
print("Thinking tokens:", resp.usage_metadata.thoughts_token_count or 0)- With
thinkingLevel: "low", the model may skip thinking on simple questions, in which casethoughtsTokenCountdoes not appear. - To see the thinking process, add
"includeThoughts": truetothinkingConfig. Items inpartswith"thought": trueare thought summaries; the rest is the answer. - Thinking tokens count toward
maxOutputTokens. If the limit is too low, the answer is cut off midway — see Common errors. thinkingConfiggoes insidegenerationConfig.
Last updated on