Migration guides / Google Cloud Text-to-Speech
Google Cloud TTS pricing and migration to Cartesia
Leaving the Google text to speech API swaps an OAuth token and base64 JSON for one API key and raw audio bytes.
Migrate from Google Cloud Text-to-Speech with your coding agent
Paste this into Claude Code, Cursor or Codex in the repo that calls Google Cloud Text-to-Speech. It carries the field mapping, the Cartesia request and a rollout that keeps Google Cloud Text-to-Speech behind a flag until you switch.
Prompt
Move this codebase from Google Cloud Text-to-Speech to Cartesia for text to speech. Keep Google Cloud Text-to-Speech working behind a flag until I switch over.
## 1. Find the calls
Search for `texttospeech.googleapis.com` or `google.auth`. The request to replace is `POST texttospeech.googleapis.com/v1/text:synthesize`. List every call site before you edit anything.
## 2. Target
- Request: `POST https://api.cartesia.ai/tts/bytes`
- Model: `model_id: "sonic-3.6"`
- Headers: `X-API-Key` read from the `CARTESIA_API_KEY` environment variable, and `Cartesia-Version: 2026-08-14`
- Auth swap: Google Cloud Text-to-Speech sends the key in `Authorization: Bearer` with an OAuth access token. Replace it with `X-API-Key` from `CARTESIA_API_KEY` on the Cartesia path only, and keep Google Cloud Text-to-Speech's key for the Google Cloud Text-to-Speech path. Google's authentication page covers Application Default Credentials, user credentials and service account impersonation. It lists no API key option for Text-to-Speech.
- Add `CARTESIA_API_KEY` wherever the project documents its environment (`.env.example`, README, deploy config). Never hardcode the key.
- Request size: Google Cloud Text-to-Speech caps a request at 5,000 bytes of text or SSML per request, so multi-byte scripts such as Japanese fit fewer characters. Cartesia publishes no per-request maximum, so keep any chunking the code already does and split at sentence boundaries; for long text, stream over the Cartesia TTS WebSocket.
- Concurrency: Google Cloud Text-to-Speech allows Requests per minute per project: 1,000 on Neural2 and most voices, 500 on Studio, 200 on Chirp 3 HD, plus 100 concurrent streaming sessions. Look up the Cartesia plan's concurrent request limit at https://www.cartesia.ai/pricing, cap parallel requests at it, and retry rate-limit errors with backoff.
- Voice IDs don't carry over. Keep each voice ID in one named constant or config value, put a placeholder where each Google Cloud Text-to-Speech voice was, and list them for me so I can pick replacements at https://www.cartesia.ai/voices.
- Suggested starting points to put in those placeholders, for me to confirm by ear: `en-US-Neural2-F` (female), the voice in the code above → `db6b0ed5-d5d3-463d-ae85-518a07d3c2b4` (Skylar - Friendly Guide); `en-US-Chirp3-HD-Charon` (male) for reminders → `1df0b2fe-acb0-4484-8f32-9e231d9e7a90` (Harvey - Precise Liaison); `es-US-Neural2-A` (female) → `b4b8e2af-6139-466e-a93a-30c20d2e1fc5` (Fernanda - Friendly Guide); `hi-IN-Chirp3-HD-Kore` (female) → `e6b71342-48f1-4c70-a13a-d197b176ff24` (Sana - Friendly Concierge).
## 3. Field mapping, Google Cloud Text-to-Speech → Cartesia
- `POST texttospeech.googleapis.com/v1/text:synthesize` → `POST api.cartesia.ai/tts/bytes`
- Google Cloud credential (OAuth bearer token) → `X-API-Key` and `Cartesia-Version: 2026-08-14`. No cloud project or service account.
- `input.text` or `input.ssml` → `transcript`. Cartesia reads `<break>`, `<spell>`, `<emotion>`, `<speed>` and `<volume>` tags. Move other SSML into `generation_config` or a pronunciation dictionary.
- `voice.name`, such as `en-US-Neural2-F` → `voice`: `{"id": "<voice id>"}`. Google's pricing page files Neural2 and WaveNet under legacy models. Its current voices are Chirp 3 HD, which streams, and Gemini-TTS.
- `voice.languageCode` → `language`. Accepts a bare code such as `en` or a regional one such as `en-GB`.
- `audioConfig.audioEncoding` and `sampleRateHertz` → `output_format.encoding` and `sample_rate`. `MULAW` and `ALAW` map to `pcm_mulaw` and `pcm_alaw`. `OGG_OPUS` has no Cartesia container, so request `mp3` or raw PCM and transcode.
- `audioConfig.speakingRate` → `generation_config.speed` (0.6 to 1.5)
- `audioConfig.volumeGainDb` → `generation_config.volume` (0.5 to 2.0). Google takes decibels and Cartesia a 0.5 to 2.0 multiplier. Set it by ear.
- `enableTimePointing` with SSML `<mark>` (v1beta1) → TTS WebSocket with `add_timestamps`. Cartesia returns word timestamps and has no mark events.
- Response `audioContent` (base64) → Response body is the audio bytes
## 4. Google Cloud Text-to-Speech fields with no Cartesia equivalent
- `audioConfig.pitch`. What to do: Choose a voice whose natural pitch fits.
## 5. Reference request
Match the language and HTTP client the codebase already uses. This is the same request in Python:
```python
import os
import requests
text = "Your appointment is confirmed for Tuesday at 3 p.m."
VOICE_ID = "6ccbfb76-1fc6-48f7-b71d-91ac6298247b" # from /voices
response = requests.post(
"https://api.cartesia.ai/tts/bytes",
headers={
"X-API-Key": os.environ["CARTESIA_API_KEY"],
"Cartesia-Version": "2026-08-14",
},
json={
"model_id": "sonic-3.6",
"transcript": text,
"voice": {"id": VOICE_ID},
"language": "en",
"output_format": {
"container": "wav",
"encoding": "pcm_s16le",
"sample_rate": 24000,
},
},
)
response.raise_for_status()
open("out.wav", "wb").write(response.content)
```
## 6. Roll out
1. Choose Google Cloud Text-to-Speech or Cartesia per request from one config flag, defaulting to Google Cloud Text-to-Speech.
2. Run the same scripts through both and save the clips side by side for me to listen to. Check that the container, encoding and sample rate match what downstream code expects.
3. Leave the Google Cloud Text-to-Speech client, call and key in place so rollback is flipping the flag. Don't delete them in this change.
4. Run the existing tests, and add one that checks the Cartesia request body.
## Docs
- Google Cloud text:synthesize reference: https://docs.cloud.google.com/text-to-speech/docs/reference/rest/v1/text/synthesize
- Google Cloud Text-to-Speech authentication: https://docs.cloud.google.com/text-to-speech/docs/authentication
- Google Cloud Text-to-Speech pricing: https://cloud.google.com/text-to-speech/pricing
- Google Cloud Text-to-Speech voice types: https://docs.cloud.google.com/text-to-speech/docs/list-voices-and-types
- Cartesia TTS bytes API reference: https://docs.cartesia.ai/api-reference/tts/bytes
- Cartesia SSML tags: https://docs.cartesia.ai/build-with-cartesia/capability-guides/ssml-tags
When you're done, tell me which files changed, which fields you couldn't map, and how to flip the flag.Every Google Cloud Text-to-Speech field, mapped to Cartesia
The prompt carries this table. Each row is a field in your Google Cloud Text-to-Speech request and the Cartesia field that replaces it.
- Google Cloud Text-to-Speech
POST texttospeech.googleapis.com/v1/ text:synthesize CartesiaPOST api.cartesia.ai/tts/ bytes - Google Cloud Text-to-Speech
Google Cloud credential (OAuth bearer token)
CartesiaX-API-KeyandCartesia-Version: 2026-08-14NoteNo cloud project or service account. - Google Cloud Text-to-Speech
input.textorinput.ssmlCartesiatranscriptNoteCartesia reads<break>,<spell>,<emotion>,<speed>and<volume>tags. Move other SSML intogeneration_configor a pronunciation dictionary. - Google Cloud Text-to-Speech
voice.name, such asen-US-Neural2-FCartesiavoice:{"id": "<voice id>"}NoteGoogle's pricing page files Neural2 and WaveNet under legacy models. Its current voices are Chirp 3 HD, which streams, and Gemini-TTS. - Google Cloud Text-to-Speech
voice.languageCodeCartesialanguageNoteAccepts a bare code such asenor a regional one such asen-GB. - Google Cloud Text-to-Speech
audioConfig.audioEncodingandsampleRateHertzCartesiaoutput_format.encodingandsample_rateNoteMULAWandALAWmap topcm_mulawandpcm_alaw.OGG_OPUShas no Cartesia container, so requestmp3or raw PCM and transcode. - Google Cloud Text-to-Speech
audioConfig.speakingRateCartesiageneration_config.speed(0.6 to 1.5) - Google Cloud Text-to-Speech
audioConfig.volumeGainDbCartesiageneration_config.volume(0.5 to 2.0)NoteGoogle takes decibels and Cartesia a 0.5 to 2.0 multiplier. Set it by ear. - Google Cloud Text-to-Speech
enableTimePointingwith SSML<mark>(v1beta1)CartesiaTTS WebSocket withadd_timestampsNoteCartesia returns word timestamps and has no mark events. - Google Cloud Text-to-Speech
Response
audioContent(base64)CartesiaResponse body is the audio bytes
Google Cloud Text-to-Speech API key and auth, mapped to Cartesia
Cartesia reads the key from the X-API-Key header and pins the API version with Cartesia-Version on every request.
- Google Cloud Text-to-Speech
Authorization: Bearerwith an OAuth access tokenCartesiaX-API-KeyplusCartesia-Version: 2026-08-14NoteGoogle's authentication page covers Application Default Credentials, user credentials and service account impersonation. It lists no API key option for Text-to-Speech.
Google Cloud Text-to-Speech API pricing per 1,000 characters
List prices per 1,000 characters from the vendor's own pricing page. Plans, regions and volume discounts change what you pay.
- Model or plan
Chirp 3 HD voices
Google Cloud Text-to-Speech$0.03Note$30 per million characters; first 1 million a month free - Model or plan
Neural2 voices (legacy)
Google Cloud Text-to-Speech$0.016Note$16 per million characters; first 1 million a month free - Model or plan
Standard and WaveNet voices (legacy)
Google Cloud Text-to-Speech$0.004Note$4 per million characters; first 4 million a month free - Model or plan
Instant custom voice
Google Cloud Text-to-Speech$0.06Note$60 per million characters; no free allowance - Model or plan
Gemini-TTS
Google Cloud Text-to-SpeechNot publishedNoteBilled per token. Gemini 3.8 Flash TTS lists $0.50 per million text tokens in and $9 per million audio tokens out through December 31, 2026, with no per-character rate.
On Cartesia, usage draws from your plan's credits: 20,000 credits a month on the Free plan (about 20,000 characters). Enterprise pricing is custom.
Cartesia plans and pricingSources
Prices read from each company's pricing page in November 2026.
Google Cloud Text-to-Speech limits compared with Cartesia
Published limits from both companies. Plans change them, so check both pages before you size a rollout.
- Limit
Free tier
Cartesia20,000 credits a month on the Free plan (about 20,000 characters)Google Cloud Text-to-SpeechFree characters each month by voice family: 4 million on Standard and WaveNet, 1 million on Chirp 3 HD, Neural2 and Studio, none on Instant custom voice - Limit
Request limit
CartesiaNo published maximum; stream long text over the TTS WebSocketGoogle Cloud Text-to-Speech5,000 bytes of text or SSML per request, so multi-byte scripts such as Japanese fit fewer characters
Cartesia's figures come from its pricing page and voice library.
Cartesia pricing and plan limitsSources
- Google Cloud Text-to-Speech quotas and limitsdocs.cloud.google.com
- Google Cloud Text-to-Speech pricingcloud.google.com
Limits read from each company's documentation in November 2026.
Google Cloud Text-to-Speech voices and where to start on Cartesia
Voice names built from locale, model and voice, such as en-US-Neural2-F or en-US-Chirp3-HD-Charon. Google's voice list tags each one MALE or FEMALE.
Each card is a starting point for a common Google Cloud Text-to-Speech pick, matched by language and use. Listen before you choose.
What you get on Cartesia
What changes once the Google Cloud Text-to-Speech call is gone.
No base64 step
/tts/bytes returns the audio itself, so the audioContent decode goes.
A static API key
Cartesia authenticates with one X-API-Key header. You can delete the service account, OAuth scope and token refresh code you wrote for Google.
How to migrate from Google Cloud Text-to-Speech to Cartesia
The same changes the prompt makes, if you'd rather make them yourself.
Create a Cartesia API key. The service account and token refresh code that existed only for Google can be retired.
Shortlist voices in the voice library for each language you serve, and render your current test scripts on each.
Swap the request and delete the base64 decode. Keep
<break>tags, and move the rest of your SSML intogeneration_configand a pronunciation dictionary.Set
output_formatto the encoding and rate your player or telephony stack already expects.
Sources
Request shapes checked against vendor documentation in November 2026.
Compare and read next
Frequently asked questions
How does Google Cloud TTS pricing count characters?
Google Cloud Text-to-Speech pricing counts every character you send in a month, SSML tags included except <mark>. Billing starts once you pass a voice family's free monthly allowance, and Gemini-TTS voices bill in tokens. Cartesia bills 1 credit per character of transcript.
Does Google Cloud TTS have a free tier?
Up to a point each month, and the point depends on the voice. Standard and WaveNet voices include 4 million free characters, Chirp 3 HD, Neural2 and Studio include 1 million, and Instant custom voice has no free allowance. Past that, Google bills at the rates in the table.
Does Cartesia accept Google Cloud TTS SSML?
Some of it. Cartesia reads SSML-style <break>, <spell>, <emotion>, <speed> and <volume> tags inside the transcript (SSML tags). Request-wide speed, volume and emotion go in generation_config, and pronunciation fixes go in a pronunciation dictionary. Google's own Chirp 3 HD voices take no SSML input at all.
What is happening to Google WaveNet voices?
Google's pricing page now files WaveNet, Neural2, Standard and Studio voices under legacy TTS models, without giving an end date. WaveNet still costs $4 per million characters after 4 million free a month.
Do I still need a Google Cloud project?
Not for speech. Cartesia authenticates with an API key.
Which languages can I move?
Cartesia speaks 44 languages from one model. Check the language list against the locales you serve.
What doesn't carry over from Google Cloud TTS?
Pitch control, Ogg Opus output, SSML <mark> timepoints and every SSML tag outside the five Cartesia reads, such as <prosody pitch> or <say-as>. Volume moves from decibels to a 0.5 to 2.0 scale.
Can I keep Google as a fallback during the move?
Yes. Leave the Google credential in place and pick the vendor per request from a flag, starting with one language or one product surface. If a locale sounds worse, flip it back to Google while you try other voices. Retire the service account once no traffic reaches it.
Get started today
Talk to an expert.
Connect with a member of our team and learn how Cartesia can help you build world-class voice experiences.
Start building.
Create an API key, then hand your coding agent the migration prompt and a few of your own scripts.