Skip to main content
US & EU
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\nTranscript: {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)

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."""

Custom format

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
}'
KeyTypeDescription
modelstringThe LLM model to use. See available models.
messagesarrayThe messages to send to the model, including your summarization prompt and transcript text.
max_tokensnumberMaximum number of tokens in the response. Adjust based on desired summary length.

Response

{
  "choices": [
    {
      "message": {
        "content": "Your generated summary text..."
      }
    }
  ]
}

Next steps