average-jordan-45543
11/18/2025, 7:43 AMtall-airline-16756
11/18/2025, 7:43 AMtall-airline-16756
11/18/2025, 7:43 AMgoogle.TTS plugin. You have a few friendly options to choose from:
1. Passing credentials directly via `credentials_info`:
Here, you provide a dictionary with your Google Cloud service account credentials when you create the TTS object. This dictionary should include keys like project_id, private_key, client_email, and others from your service account JSON key file.
from livekit.plugins import google
tts = google.TTS(
credentials_info={
"type": "service_account",
"project_id": "your-project-id",
"private_key_id": "your-private-key-id",
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_email": "your-service-account@your-project.iam.gserviceaccount.com",
"client_id": "your-client-id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/..."
}
)
2. Using a credentials JSON file with `credentials_file`:
Simply save your Google Cloud service account key as a JSON file and pass its path using the credentials_file parameter.
tts = google.TTS(credentials_file="path/to/your-service-account-key.json")
3. Setting the GOOGLE_APPLICATION_CREDENTIALS environment variable:
You can point the GOOGLE_APPLICATION_CREDENTIALS environment variable to your service account key file’s path. The plugin will then automatically use Application Default Credentials (ADC).
# In shell
export GOOGLE_APPLICATION_CREDENTIALS="path/to/your-service-account-key.json"
# In Python
tts = google.TTS() # No need to pass credentials explicitly
Just a quick reminder: please make sure the Cloud Text-to-Speech API is enabled in your Google Cloud project. If you have any questions or need a hand with any step, feel free to reach out—I'm here to help!
Sources: Google Cloud TTS integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-fishaudio/README.md