Set budget on thinking models
POST
https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent
thinkingBudget
parameter gives the model guidance on the number of thinking tokens it can use when generating a response. A greater number of tokens is typically associated with more detailed thinking, which is needed for solving more complex tasks. thinkingBudget
must be an integer in the range 0 to 24576. Setting the thinking budget to 0 disables thinking.Request Request Example
Shell
JavaScript
Java
Swift
curl --location -g --request POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent?key=' \
--header 'Content-Type: application/json' \
--data-raw '{
"contents": [
{
"parts": [
{
"text": "Explain the Occam\s'
Response Response Example
{}
Request
Query Params
key
string
required
Example:
{{GEMINI_API_KEY}}
Header Params
Content-Type
string
required
Example:
application/json
Body Params text/plain