Transcribe a meeting and summarize it

Turn an audio file into text, then into a short summary with action items.

In about 10 minutes, you send a recording to the speech-to-text endpoint. Then you send the transcript to a chat model. The model returns a summary and a list of action items as JSON. At the end, you add up the cost of both calls from the receipts.

Before you start

Steps

  1. Save this script as notes.py in the folder that holds meeting.mp3.

    import json, os, time
    from openai import OpenAI
    
    client = OpenAI(base_url="https://router.inference.ai.exchange/v1",
                    api_key=os.environ["LIQUID_API_KEY"])
    jobs = []
    
    with open("meeting.mp3", "rb") as audio:
        raw = client.audio.transcriptions.with_raw_response.create(
            model="whisper-1", file=audio)
    jobs.append(raw.headers["x-liquid-job-id"])
    transcript = raw.parse().text
    
    schema = {
        "type": "object",
        "properties": {
            "summary": {"type": "string"},
            "action_items": {"type": "array", "items": {"type": "string"}},
        },
        "required": ["summary", "action_items"],
        "additionalProperties": False,
    }
    raw = client.chat.completions.with_raw_response.create(
        model="gpt-oss-120b",
        messages=[{"role": "user", "content":
            "Summarize this meeting in three sentences. "
            "List each action item with its owner.\n\n" + transcript}],
        response_format={"type": "json_schema", "json_schema": {
            "name": "meeting_notes", "strict": True, "schema": schema}},
    )
    jobs.append(raw.headers["x-liquid-job-id"])
    notes = json.loads(raw.parse().choices[0].message.content)
    print(notes["summary"])
    for item in notes["action_items"]:
        print("-", item)
    
    time.sleep(3)
    total = sum(client.get(f"/jobs/{job}", cast_to=object)["buyer_charge_usd"]
                for job in jobs)
    print(f"Total cost: ${total:.6f}")
    
  2. Run the script.

    python notes.py
    
  3. Wait for the output. The first call returns the transcript. The second call returns the notes.

The script does four things. The first call sends the audio to POST /v1/audio/transcriptions. The exchange reads the length of the file and fixes a price cap before dispatch. See Speech-to-text.

The second call sends the transcript with a json_schema answer format. Only an offer that supports the format can win the job. See Structured output.

The script then reads the job id from the x-liquid-job-id header of each response. Last, it reads the two receipts and adds buyer_charge_usd from each. See Receipts.

Check it works

You see a short summary, then one line for each action item, then the total cost:

The team reviewed the launch plan and moved the date to May 12. ...
- Dana: update the launch checklist by Friday
- Sam: send the new date to the partners
Total cost: $0.004213

Your text and cost differ. The cost depends on the length of the audio and the offers that win.

To compare, open the receipt of one job in the console. The buyer_charge_usd of the two receipts must add up to the total that the script printed.

If something goes wrong

Next steps