Get API key
Verify your API key using the curl command
curl
command to verify your setup. You can pass the API key through either of the following URLs:API_KEY="YOUR_API_KEY"
curl -H 'Content-Type: application/json' \
-d '{"contents":[
{"role": "user",
"parts":[{"text": "Give me five subcategories of jazz?"}]}]}' \
"https://generativelanguage.googleapis.com/v1/models/gemini-pro:generateContent?key=${API_KEY}"
x-goog-api-key
header:API_KEY="YOUR_API_KEY"
curl -H 'Content-Type: application/json' \
-H "x-goog-api-key: ${API_KEY}" \
-d '{"contents":[
{"role": "user",
"parts":[{"text": "Give me five subcategories of jazz?"}]}]}' \
"https://generativelanguage.googleapis.com/v1/models/gemini-pro:generateContent"