Documentation Index Fetch the complete documentation index at: https://assemblyai.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Generate summaries of your audio transcripts using LLM Gateway . This approach gives you full control over the summary format, length, and style by customizing your prompt.
The summarization, summary_model, and summary_type parameters on the transcription API are deprecated. Use LLM Gateway as shown below for more flexible and powerful summaries.
Quickstart
import requests
import time
base_url = "https://api.assemblyai.com"
headers = { "authorization" : "<YOUR_API_KEY>" }
# Step 1: Transcribe your audio file
audio_url = "https://assembly.ai/wildfires.mp3"
data = {
"audio_url" : audio_url,
"speech_models" : [ "universal-3-pro" , "universal-2" ],
"language_detection" : True
}
response = requests.post(base_url + "/v2/transcript" , json = data, headers = headers)
transcript_id = response.json()[ 'id' ]
polling_endpoint = base_url + "/v2/transcript/" + transcript_id
while True :
transcription_result = requests.get(polling_endpoint, headers = headers).json()
if transcription_result[ 'status' ] == 'completed' :
break
elif transcription_result[ 'status' ] == 'error' :
raise RuntimeError ( f "Transcription failed: { transcription_result[ 'error' ] } " )
else :
time.sleep( 3 )
# Step 2: Generate a summary using LLM Gateway
prompt = "Provide a brief summary of the transcript in bullet point format."
llm_gateway_data = {
"model" : "claude-sonnet-4-6" ,
"messages" : [
{ "role" : "user" , "content" : f " { prompt } \n\n Transcript: { transcription_result[ 'text' ] } " }
],
"max_tokens" : 1000
}
response = requests.post(
"https://llm-gateway.assemblyai.com/v1/chat/completions" ,
headers = headers,
json = llm_gateway_data
)
result = response.json()[ "choices" ][ 0 ][ "message" ][ "content" ]
print (result)
See all 47 lines
const baseUrl = "https://api.assemblyai.com" ;
const headers = {
authorization: "<YOUR_API_KEY>" ,
"content-type" : "application/json" ,
};
// Step 1: Transcribe your audio file
const audioUrl = "https://assembly.ai/wildfires.mp3" ;
const data = {
audio_url: audioUrl ,
speech_models: [ "universal-3-pro" , "universal-2" ],
language_detection: true ,
};
const response = await fetch ( ` ${ baseUrl } /v2/transcript` , {
method: "POST" ,
headers ,
body: JSON . stringify ( data ),
});
const { id : transcriptId } = await response . json ();
const pollingEndpoint = ` ${ baseUrl } /v2/transcript/ ${ transcriptId } ` ;
let transcriptionResult ;
while ( true ) {
const pollingResponse = await fetch ( pollingEndpoint , { headers });
transcriptionResult = await pollingResponse . json ();
if ( transcriptionResult . status === "completed" ) {
break ;
} else if ( transcriptionResult . status === "error" ) {
throw new Error ( `Transcription failed: ${ transcriptionResult . error } ` );
} else {
await new Promise (( resolve ) => setTimeout ( resolve , 3000 ));
}
}
// Step 2: Generate a summary using LLM Gateway
const prompt =
"Provide a brief summary of the transcript in bullet point format." ;
const llmGatewayData = {
model: "claude-sonnet-4-6" ,
messages: [
{
role: "user" ,
content: ` ${ prompt } \n\n Transcript: ${ transcriptionResult . text } ` ,
},
],
max_tokens: 1000 ,
};
const result = await fetch (
"https://llm-gateway.assemblyai.com/v1/chat/completions" ,
{
method: "POST" ,
headers ,
body: JSON . stringify ( llmGatewayData ),
}
);
const resultData = await result . json ();
console . log ( resultData . choices [ 0 ]. message . content );
See all 65 lines
Example output
- Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US, with skylines from Maine to Maryland to Minnesota appearing gray and smoggy.
- Air pollution levels in Baltimore are considered unhealthy, with exposure to high levels leading to various health problems.
- With climate change driving more wildfires, experts warn that wide-ranging air quality consequences may become more frequent.
Customize your summary
You can control the summary output by adjusting the prompt. Here are some examples:
Bullet point summary
prompt = """Provide a brief summary of the transcript in bullet point format.
Focus on the key points and main takeaways."""
Paragraph summary
prompt = """Provide a concise paragraph summary of the transcript.
Capture the main topics and conclusions."""
Headline summary
prompt = """Provide a single sentence headline that captures the main topic
of the transcript."""
Conversational summary
prompt = """Summarize this conversation between multiple speakers.
Include who said what and the key points each speaker made."""
You can define any format you need:
prompt = """Summarize the transcript using the following format:
- Topic: [main topic]
- Key Points: [list of 3-5 key points]
- Action Items: [any action items mentioned]
- Conclusion: [one sentence conclusion]"""
API reference
Step 1: Transcribe audio
curl https://api.assemblyai.com/v2/transcript \
--header "Authorization: <YOUR_API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"audio_url": "YOUR_AUDIO_URL"
}'
Poll for the transcript result until the status is completed, then extract the transcript text.
Step 2: Generate summary with LLM Gateway
curl https://llm-gateway.assemblyai.com/v1/chat/completions \
--header "Authorization: <YOUR_API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"model": "claude-sonnet-4-6",
"messages": [
{"role": "user", "content": "Provide a brief summary of the transcript.\n\nTranscript: YOUR_TRANSCRIPT_TEXT"}
],
"max_tokens": 1000
}'
Key Type Description modelstring The LLM model to use. See available models . messagesarray The messages to send to the model, including your summarization prompt and transcript text. max_tokensnumber Maximum number of tokens in the response. Adjust based on desired summary length.
Response
{
"choices" : [
{
"message" : {
"content" : "Your generated summary text..."
}
}
]
}
Next steps