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

# Content repurposing

Transcribe a podcast or webinar, extract key phrases, then use LLM Gateway to generate a blog post draft with highlights.

**Products used:** [Pre-recorded STT](/pre-recorded-audio/getting-started/transcribe-an-audio-file) + [key phrases](/speech-understanding/key-phrases) + [LLM Gateway](/llm-gateway/quickstart)

**Model selection:** Uses `universal-3-5-pro` with `universal-2` fallback for multilingual content. If your content is English-only, `universal-3-5-pro` alone gives the best results.

<Tabs groupId="language">
  <Tab language="python" title="Python" default>
    ```python expandable theme={null}
    import requests
    import time

    # ── Config ────────────────────────────────────────────────────
    base_url = "https://api.assemblyai.com"
    headers = {"authorization": "YOUR_API_KEY"}

    audio_url = "https://assembly.ai/wildfires.mp3"

    # ── Step 1: Transcribe with key phrases enabled ──
    data = {
        "audio_url": audio_url,
        "language_detection": True,
        "auto_highlights": True,
    }

    response = requests.post(base_url + "/v2/transcript", headers=headers, json=data)
    response.raise_for_status()
    transcript_id = response.json()["id"]

    while True:
        result = requests.get(f"{base_url}/v2/transcript/{transcript_id}", headers=headers).json()
        if result["status"] == "completed":
            break
        elif result["status"] == "error":
            raise RuntimeError(f"Transcription failed: {result['error']}")
        time.sleep(3)

    # ── Step 2: Extract top key phrases ──
    highlights = result.get("auto_highlights_result", {}).get("results", [])
    top_phrases = sorted(highlights, key=lambda x: x["rank"], reverse=True)[:10]
    phrases_list = ", ".join(p["text"] for p in top_phrases)

    # ── Step 3: Generate blog post via LLM Gateway ──
    llm_response = requests.post(
        "https://llm-gateway.assemblyai.com/v1/chat/completions",
        headers=headers,
        json={
            "model": "claude-sonnet-4-5-20250929",
            "messages": [
                {
                    "role": "user",
                    "content": (
                        "You are a content writer. Transform this transcript into an engaging "
                        "blog post.\n\n"
                        "Requirements:\n"
                        "- Write a compelling title and subtitle\n"
                        "- Break the content into 3-5 sections with headers\n"
                        "- Weave in the key phrases naturally\n"
                        "- Add a TL;DR at the top\n"
                        "- End with a call-to-action\n\n"
                        f"Key phrases: {phrases_list}\n\n"
                        "Transcript:\n{{ transcript }}"
                    ),
                }
            ],
            "transcript_id": transcript_id,
            "max_tokens": 3000,
        },
    )
    llm_response.raise_for_status()

    print("=== Blog Post Draft ===\n")
    print(llm_response.json()["choices"][0]["message"]["content"])
    ```
  </Tab>

  <Tab language="javascript" title="JavaScript">
    ```javascript expandable theme={null}
    const baseUrl = "https://api.assemblyai.com";
    const headers = {
      authorization: "YOUR_API_KEY",
      "Content-Type": "application/json",
    };

    const audioUrl = "https://assembly.ai/wildfires.mp3";

    // Step 1: Transcribe with key phrases enabled
    let res = await fetch(`${baseUrl}/v2/transcript`, {
      method: "POST",
      headers,
      body: JSON.stringify({
        audio_url: audioUrl,
        language_detection: true,
        auto_highlights: true,
      }),
    });
    if (!res.ok) throw new Error(`Error: ${res.status}`);
    const { id: transcriptId } = await res.json();

    let result;
    while (true) {
      res = await fetch(`${baseUrl}/v2/transcript/${transcriptId}`, { headers });
      result = await res.json();
      if (result.status === "completed") break;
      if (result.status === "error")
        throw new Error(`Transcription failed: ${result.error}`);
      await new Promise((r) => setTimeout(r, 3000));
    }

    // Step 2: Extract top key phrases
    const highlights = result.auto_highlights_result?.results || [];
    const topPhrases = highlights
      .sort((a, b) => b.rank - a.rank)
      .slice(0, 10);
    const phrasesList = topPhrases.map((p) => p.text).join(", ");

    // Step 3: Generate blog post via LLM Gateway
    res = await fetch("https://llm-gateway.assemblyai.com/v1/chat/completions", {
      method: "POST",
      headers,
      body: JSON.stringify({
        model: "claude-sonnet-4-5-20250929",
        messages: [
          {
            role: "user",
            content:
              "You are a content writer. Transform this transcript into an engaging " +
              "blog post.\n\n" +
              "Requirements:\n" +
              "- Write a compelling title and subtitle\n" +
              "- Break the content into 3-5 sections with headers\n" +
              "- Weave in the key phrases naturally\n" +
              "- Add a TL;DR at the top\n" +
              "- End with a call-to-action\n\n" +
              `Key phrases: ${phrasesList}\n\n` +
              "Transcript:\n{{ transcript }}",
          },
        ],
        transcript_id: transcriptId,
        max_tokens: 3000,
      }),
    });
    if (!res.ok) throw new Error(`Error: ${res.status}`);
    const llmResult = await res.json();

    console.log("=== Blog Post Draft ===\n");
    console.log(llmResult.choices[0].message.content);
    ```
  </Tab>
</Tabs>

<Accordion title="Example output">
  ```text expandable theme={null}
  === Blog Post Draft ===

  # When the Sky Turns Orange: Understanding Wildfire Smoke and Air Quality

  **How Canadian wildfires are reshaping air quality across the United States**

  **TL;DR:** Wildfire smoke from Canada is triggering widespread air quality alerts
  in the US, with particulate matter levels reaching 10x normal in some cities.
  Here's what you need to know about the health risks and how to protect yourself.

  ## The smoke crosses borders

  Hundreds of wildfires burning across Canada have sent massive plumes of smoke
  southward into the United States, creating hazy skies and triggering air quality
  alerts from the Midwest to the Eastern Seaboard...

  ## Understanding particulate matter

  The real danger lies in fine particulate matter — microscopic particles that
  can penetrate deep into your lungs and even enter your bloodstream...

  ## Protecting your health

  Health experts recommend staying indoors, using air purifiers, and wearing
  N95 masks when outdoor exposure is unavoidable...

  ## Looking ahead

  As climate change intensifies wildfire seasons, these cross-border smoke events
  are likely to become more frequent...

  ---
  *Want to transcribe your own podcast or webinar? Get started with AssemblyAI's
  API at [assemblyai.com](https://assemblyai.com).*
  ```
</Accordion>

***

See the [End-to-end examples overview](/getting-started/end-to-end-examples) for all available pipelines.
