Overview
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:- Python
- JavaScript
Before you begin
To complete this tutorial, you need:- Python or Node installed.
- An AssemblyAI account with a credit card set up.
- Basic understanding of how to Transcribe an audio file.
Step 1: Install prerequisites
- Python
- JavaScript
Install the package via pip:
Step 2: Transcribe an audio file
When you passtranscript_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.
- Python
- JavaScript
Step 3: Send transcript to LLM Gateway
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.1
- Python
- JavaScript
Write a prompt with instructions on how the LLM should generate the text output.
2
- Python
- JavaScript
Send the transcript ID and prompt to LLM Gateway. The model parameter defines which LLM to use. For available models, see LLM Gateway Overview.
3
Print the result.The output will look something like this:
- Python
- JavaScript
Next steps
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.- “Provide an analysis of the transcript and offer areas to improve with exact quotes.”
- “What’s the main take-away from the transcript?”
- “Generate a set of action items from this transcript.”