Gemini API quickstart

This quickstart shows you how to install your SDK of choice and then make your first Gemini API request.

Make your first request

Get a Gemini API key in Google AI Studio

Use the generateContent method to send a request to the Gemini API.

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=$YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "text": "Explain how AI works in a few words"
          }
        ]
      }
    ]
  }'

What's next

Now that you made your first API request, you might want to explore the following guides that show Gemini in action: