Google Gemini API
  1. Gemini thinking
Google Gemini API
  • Get API key
  • Release notes
  • Libraries
  • Run Gemini on Google Cloud
  • Model Capabilities
    • Overview
    • Long context
    • Structured output
    • Document understanding
    • Image understanding
    • Video understanding
    • Audio understanding
    • Text generation
      • Text input
      • Image input
      • Streaming output
      • Multi-turn conversations
      • Multi-turn conversations (Streaming)
      • Configuration parameters
    • Generate images
      • Generate images using Gemini
      • Image editing with Gemini
      • Generate images using Imagen 3
    • Gemini thinking
      • Use thinking models
        POST
      • Set budget on thinking models
        POST
    • Function calling
      • Function Calling with the Gemini API
  • models
    • All Model
    • Pricing
    • Rate limits
    • Billing info
  • Safety
    • Safety settings
    • Safety guidance
  1. Gemini thinking

Use thinking models

POST
https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent
Models with thinking capabilities are available in Google AI Studio and through the Gemini API. Thinking is on by default in both the API and AI Studio because the 2.5 series models have the ability to automatically decide when and how much to think based on the prompt. For most use cases, it's beneficial to leave thinking on. But if you want to to turn thinking off, you can do so by setting the thinkingBudget parameter to 0.
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 concept of 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
Examples

Responses

🟢200成功
application/json
Body
object {0}
Previous
Generate images using Imagen 3
Next
Set budget on thinking models
Built with