---
title: "Google Cloud TTS vs AI Studio TTS — Two Separate Services"
description: "generativelanguage.googleapis.com (AI Studio, 10 RPM preview) vs texttospeech.googleapis.com (Cloud TTS, production) — different clients, IAM, SDK"
tags: [google-cloud, tts, ai-studio, python, gcp]
source: daily/2026-05-08.md
created: 2026-05-08
updated: 2026-05-08
---

# Google Cloud TTS vs AI Studio TTS — Two Separate Services

## Two Different Products

| | AI Studio TTS | Google Cloud TTS |
|---|---|---|
| Endpoint | `generativelanguage.googleapis.com` | `texttospeech.googleapis.com` |
| Client (Python) | `google.generativeai` (`genai`) | `google.cloud.texttospeech` |
| Auth | API Key | Service Account / ADC |
| Quota | ~10 RPM (preview) | Production quota |
| Output format | PCM (requires lameenc for MP3) | MP3 directly |
| Style prompts | Not supported natively | `SynthesisInput.prompt` field |
| Speed control | Limited | `AudioConfig.speaking_rate` (float) |
| IAM role needed | None (API key) | `roles/aiplatform.user` (non-obvious) |

## Why They Get Confused

Both services use Gemini model names (e.g., `gemini-2.5-flash`). The AI Studio SDK accepts the same model name for TTS but operates on a separate quota and returns PCM instead of MP3. Projects that start with AI Studio TTS hit quota limits quickly in production.

## Migration: AI Studio → Cloud TTS

```python
# BEFORE (AI Studio)
import google.generativeai as genai
genai.configure(api_key=GOOGLE_API_KEY)
client = genai.GenerativeModel("gemini-2.5-flash")
response = client.generate_content(...)
# PCM → need lameenc to encode to MP3

# AFTER (Cloud TTS)
from google.cloud import texttospeech

client = texttospeech.TextToSpeechClient()
synthesis_input = texttospeech.SynthesisInput(
    prompt=style_prompt,   # style goes in prompt field
    text=text_to_speak,
)
voice = texttospeech.VoiceSelectionParams(
    language_code="en-US",
    model_name="en-US-Journey-F",   # requires lib ≥ 2.28.0
)
audio_config = texttospeech.AudioConfig(
    audio_encoding=texttospeech.AudioEncoding.MP3,
    speaking_rate=1.0,   # float, 0.25–4.0
)
response = client.synthesize_speech(
    input=synthesis_input, voice=voice, audio_config=audio_config
)
mp3_bytes = response.audio_content  # already MP3, no encoding needed
```

## IAM Non-Obvious Requirement

Cloud TTS using Gemini voices requires `roles/aiplatform.user` on the GCP project — even though this is not a Vertex AI service. Without it, you get:

```
google.api_core.exceptions.PermissionDenied: 403 Permission 'aiplatform.endpoints.predict' denied
```

Grant via:
```bash
gcloud projects add-iam-policy-binding PROJECT_ID \
  --member="serviceAccount:SA_EMAIL" \
  --role="roles/aiplatform.user"
```

## See Also

- [[wiki/concepts/google-cloud-texttospeech-version-gate]] — `model_name` field silently ignored below v2.28.0
- [[wiki/tech-patterns/redis-celery-worker-queue]] — pipeline this TTS runs inside
