A Large Language Model (LLM) is a machine learning model that uses natural language processing (NLP) to generate text. LLM Gateway is a unified API that provides access to 25+ models from Claude, GPT, Gemini, and more through a single interface. You can use LLM Gateway to analyze audio transcripts, for example to ask questions about a call, or to summarize a meeting.
By the end of this tutorial, you’ll be able to use LLM Gateway to summarize an audio file.
Here’s the full sample code for what you’ll build in this tutorial:
If you run the code above, you’ll see the following output:
To complete this tutorial, you need:
Install the package via pip:
When you pass transcript_id to LLM Gateway and include the {{ transcript }} tag in a message, the API substitutes the tag with the transcript’s text field before running the completion. It does not include other fields such as utterances or speaker labels. If you need speaker-separated context, format the utterances yourself and include them in your prompt.
In this step, you’ll transcribe an audio file that you can later use with LLM Gateway.
For more information about transcribing audio, see Transcribe an audio file.
If you’ve already transcribed an audio file you want to use, you can get an existing transcript using its ID. You can find the ID for previously transcribed audio files in the Processing queue.
In this step, you’ll send the transcript ID to LLM Gateway along with a prompt to generate text output.
The prompt is a text string that provides the LLM with instructions on how to generate the text output. You’ll write a prompt that references the transcript with a {{ transcript }} tag and send it to LLM Gateway using the chat completions API. Pass the transcript ID as the top-level transcript_id field — the API substitutes the tag with the transcript’s text before running the completion.
Only the first occurrence of {{ transcript }} in the first message that contains it is substituted — additional tags or tags in later messages are left as-is. The tag must be exactly {{ transcript }} (with the spaces); variants like {{transcript}} or {{ TRANSCRIPT }} are not substituted. The endpoint returns 404 if the transcript ID does not exist or belongs to a different account.
Send the transcript ID and prompt to LLM Gateway. The model parameter defines which LLM to use. For available models, see LLM Gateway Overview.
Want to make your LLM requests more resilient? Use fallback models to automatically switch to a backup model if your primary model is unavailable.
In this tutorial, you’ve learned how to generate LLM output based on your audio transcripts using LLM Gateway. The type of output depends on your prompt, so try exploring different prompts to see how they affect the output. Here’s a few more prompts to try.
To learn more about LLM Gateway and working with different models, see the following resources:
If you get stuck, or have any other questions, we’d love to help you out. Contact our support team at support@assemblyai.com or create a support ticket.