#!/usr/bin/env bash
set -euo pipefail

: "${GEMINI_API_KEY:?Set GEMINI_API_KEY}"

# NOTE: Response includes base64 audio bytes; you must decode and wrap to WAV/PCM as needed.
curl -sS -X POST   "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-tts:generateContent"   -H "x-goog-api-key: ${GEMINI_API_KEY}"   -H "Content-Type: application/json"   -d '{
    "contents":[{"parts":[{"text":"Say cheerfully: Have a wonderful day!"}]}],
    "generationConfig": {},
    "config":{
      "response_modalities":["AUDIO"],
      "speech_config":{
        "voice_config":{
          "prebuilt_voice_config":{"voice_name":"Kore"}
        }
      }
    }
  }' | jq .
