Question · Speech recognition
How do you get a Google Speech-to-Text API key?
You create an API key on the Credentials page of a Google Cloud project that has Speech-to-Text enabled and billing turned on. Google's Speech-to-Text authentication docs describe gcloud and Application Default Credentials and do not list API keys, so send one short test request with the new key before you build on it.
Updated October 17, 20263 min read9 cited facts, each traced to its source
To get a Google Speech-to-Text API key, create one in a Google Cloud project that has the Speech-to-Text API enabled and billing turned on. The key is made on the Credentials page of the Google Cloud console. Read the next section before you start, though. Google's own Speech-to-Text documentation describes a different way to sign in, with your gcloud credentials or Application Default Credentials, so a key is not guaranteed to work with every call. Make the key, restrict it, and test it on one short file. If it is rejected, use the route Google documents, which is set out in the step-by-step Google setup. Speech-to-Text is Google's automatic speech recognition service, and the speech-to-text API guide compares it with the other providers.
Google's documented sign-in uses gcloud or Application Default Credentials
Google's authentication page says that the REST interface can be called with your gcloud CLI credentials or with Application Default Credentials 1. The client libraries find credentials through Application Default Credentials, so a Python script on your own machine needs no key in its code. That is the route Google's quickstart takes.
The page lists the methods Google supports for Speech-to-Text, and an API key is not one of them. That does not prove a key fails. It means a key is outside the documented path, so treat it as something to test rather than a supported setup.
Create the key in the Google Cloud console
- Check billing and enable the API. Google's quickstart asks you to verify that billing is enabled for your project 2. It then says to enable the Speech-to-Text APIs, if any are not already enabled 3.
- Open the Credentials page. Google's API key page says to go to the Credentials page in the Google Cloud console 4. Then click Create credentials and select API key from the menu.
- Add a restriction. Google's page says to add at least one API key restriction 5. Limit the key to the Speech-to-Text API, so that a copied key cannot be used for other Google services.
- Store the key outside your code. Put it in an environment variable or a secrets manager, and keep it out of shared files and repositories.
Test the key before you build on it
Google's introduction to API keys says that not all Google Cloud APIs accept API keys to authorize usage 6. So the test is practical. Send one short recognition request with the new key and read the response. If Google answers with a message asking for other credentials, the key is not accepted for this call, and you should switch to the gcloud route. If the request returns a transcript, note the date and the project, because keys can be restricted or revoked later.
We did not run this test against a live project, so we cannot say what error Google returns for a rejected key.
Free use and billing after the key works
Billing being on does not mean every call is charged. Google's V1 price table makes the first 60 minutes of standard recognition free each month, per account 7, and charges only after that. Past the allowance, the V1 rate is $0.024 per minute without data logging and $0.016 with it 8. The question on whether Google Speech-to-Text is free explains the trade-off in full.
Do not confuse it with the Gemini API
Google also transcribes audio through its Gemini API. Google describes Gemini 3.5 Transcribe as its speech-to-text model 9. That is a separate product from Speech-to-Text, with its own pricing page. Check which one your code calls before you create a key, and see whether Gemini has a speech-to-text API for the comparison.
What to do
- Get your first call working with the gcloud route, which Google documents.
- If you still want a key, create one, restrict it to Speech-to-Text, and test it once with a short file.
- Keep the key out of code, and replace it if it is ever shared.
- Before you ship, compare Google with two other providers on your own audio. Price and accuracy vary, so the guide's test steps are a better guide than the key steps alone. For speaker labels, see which speech-to-text APIs can identify speakers.
Evidence
Every number on this page, with where it comes from. Open a fact to see the exact words in its source.
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
Go deeper
Related questions
- Does Gemini have a speech-to-text API?
- How do you use the Azure Speech-to-Text API?
- How do you use the Google Speech-to-Text API?
- How much does the ElevenLabs speech-to-text API cost, and how do you use it?
- How much does the OpenAI speech-to-text API cost?
- Is ElevenLabs speech to text better than Whisper?
- Is Google Speech-to-Text free?
- Is there a free speech-to-text API?