The short version
Here is the whole job in one script. It reads a transcript file, sends it to the chat endpoint and prints a summary. Everything else in this guide improves on it.
from openai import OpenAI
client = OpenAI(base_url="https://api.voxtral.cc/v1", api_key="YOUR_KEY")
text = open("meeting.txt", encoding="utf-8").read()
resp = client.chat.completions.create(
model="uncensored",
temperature=0.2,
messages=[
{"role": "system", "content": "You summarise transcripts accurately. Do not invent facts."},
{"role": "user", "content": "Summarise in 5 bullets, then list decisions and owners.\n\n" + text},
],
)
print(resp.choices[0].message.content)
That is the entire integration. The API follows the OpenAI chat format, so any OpenAI SDK or compatible tool works once you swap the base URL and key. The model ID is uncensored, and the key travels as Authorization: Bearer, which the SDK sets for you. Install the package with pip install openai.
Get a key and check the connection
Sign up with Google, or with email and password, and open the API key page. A one-click trial gives $0.50 of credit, valid for 7 days with no card, one per person. For a summarisation test that is a lot: see the cost section below. Check the connection before you write more code:
curl https://api.voxtral.cc/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"uncensored","messages":[{"role":"user","content":"Reply with the word ready."}]}'
A normal reply means you are connected (a GET /v1/models call also lists uncensored). A 401 means the key is wrong or has a stray space in it. Keep the key in an environment variable rather than in the source file, and read it with os.environ["API_KEY"]. The quickstart covers Node and other clients if Python is only part of your stack.
Clean the transcript before you send it
Raw transcripts carry noise that costs tokens and confuses summaries: timestamps on every line, filler such as "um", repeated speaker labels, and caption artefacts. A short cleaning step helps. Where timestamps matter, keep them only at paragraph level.
import re
def clean(raw):
out = []
for line in raw.splitlines():
line = re.sub(r"^\[?\d{1,2}:\d{2}(:\d{2})?\]?\s*", "", line)
line = re.sub(r"\b(um+|uh+|erm)\b[,.]?\s*", "", line, flags=re.I)
line = line.strip()
if line:
out.append(line)
return "\n".join(out)
Do not over-clean. Speaker names and the order of lines carry the meaning of a conversation, so leave those alone. If your transcript tool exports speaker labels like "SPEAKER_01", add a line to the prompt that says which person is which, or the summary will talk about "Speaker 1" in a way readers cannot map back.
Next, estimate size. English text runs near four characters per token, so len(text) // 4 gives a rough token count. A one-hour recording at a normal speaking pace is about 9,000 words, which is around 12,000 tokens. The context window is 100,000 tokens, prompt plus completion, so recordings up to roughly seven or eight hours fit in one request by this estimate. The exact count comes back in resp.usage.
Ask for structured output
Bullet text is fine for reading. If another program consumes the summary, use JSON mode. Set response_format to a JSON object and also say "JSON" in the prompt along with the shape you want.
import json
from openai import OpenAI
client = OpenAI(base_url="https://api.voxtral.cc/v1", api_key="YOUR_KEY")
SCHEMA_HINT = (
"Return JSON only with keys: "
'"summary" (string, max 80 words), '
'"decisions" (list of strings), '
'"action_items" (list of {"owner": string, "task": string}), '
'"open_questions" (list of strings).'
)
def summarise(transcript):
resp = client.chat.completions.create(
model="uncensored",
response_format={"type": "json_object"},
temperature=0.2,
messages=[
{"role": "system", "content": "You summarise transcripts. " + SCHEMA_HINT},
{"role": "user", "content": transcript},
],
)
return json.loads(resp.choices[0].message.content), resp.usage
data, usage = summarise(open("meeting.txt", encoding="utf-8").read())
print(json.dumps(data, indent=2))
print(usage.prompt_tokens, usage.completion_tokens)
Use a low temperature for factual work. Values between 0.1 and 0.3 keep the model close to the text. If a field might legitimately be empty, say so in the prompt ("use an empty list if there are none"), otherwise models tend to invent an entry to fill it. For extra safety, wrap json.loads in a try block and retry once on failure; failed requests are not charged.
Prompts that keep a summary faithful
Summaries go wrong in predictable ways: invented details, lost numbers and a smooth tone that hides disagreement. A few lines in the system prompt prevent most of it.
- "Use only information in the transcript. If something is unclear, write 'unclear'."
- "Keep every figure, date and name exactly as spoken."
- "Report disagreements as disagreements, naming who held each view."
- "Quote at most one short sentence per topic, in quotation marks."
Spot-check by choosing three claims from the summary and finding them in the transcript with a text search. If one fails, tighten the prompt and lower the temperature rather than adding more instructions on top. Asking for evidence, for example "give the approximate position of each decision in the transcript, as a percentage", also gives you a way to verify items quickly without rereading everything.
Transcripts longer than the window: chunk, then merge
When a transcript, or a batch of them, is beyond 100,000 tokens, split it, summarise each part and then summarise the summaries. This is the classic map-reduce pattern, and it parallelises nicely. A full key allows 8 concurrent requests, so use up to 8 worker threads.
from concurrent.futures import ThreadPoolExecutor
from openai import OpenAI
client = OpenAI(base_url="https://api.voxtral.cc/v1", api_key="YOUR_KEY", max_retries=4)
def chunks(text, max_chars=48000):
parts, cur, size = [], [], 0
for line in text.splitlines():
if size + len(line) > max_chars and cur:
parts.append("\n".join(cur))
cur, size = [], 0
cur.append(line)
size += len(line) + 1
if cur:
parts.append("\n".join(cur))
return parts
def ask(system, user):
r = client.chat.completions.create(
model="uncensored",
temperature=0.2,
messages=[{"role": "system", "content": system}, {"role": "user", "content": user}],
)
return r.choices[0].message.content
def summarise_long(text):
parts = chunks(text)
with ThreadPoolExecutor(max_workers=6) as pool:
partials = list(pool.map(
lambda p: ask("Summarise this section of a transcript in 150 words. Keep names and numbers.", p),
parts,
))
merged = "\n\n".join("Section %d: %s" % (i + 1, s) for i, s in enumerate(partials))
return ask("Combine these section summaries into one 250-word summary and a list of decisions.", merged)
A 48,000-character chunk is about 12,000 tokens, so the pieces stay small and the work finishes quickly. Cutting on line boundaries avoids splitting a sentence in half. If the content has natural chapters, split on those instead. Using 6 workers rather than 8 leaves headroom for the reduce call and for other jobs on the same key. Trial keys allow only 2 concurrent requests, so set max_workers=2 while testing.
Handling errors and rate limits
Two kinds of HTTP 429 exist. A body with the code rate_limited means you exceeded requests per minute (300 on a full key, 60 on trial). The code concurrency means too many requests at once (8 on a full key, 2 on trial). Temporary overload also returns 429, with a Retry-After: 5 header. The OpenAI Python SDK retries 429 automatically and respects that header, so max_retries=4 in the examples above covers the common cases without extra code.
If you stream a summary, remember that a streamed request holds its concurrency slot until the stream ends. A script that opens many streams and reads them slowly will hit the concurrency limit sooner than one that waits for full responses. Log the X-Request-Id header with each call; if a request goes wrong and you contact support, that ID is the fastest way to find it. The request body can be up to 8 MB, far above any transcript text.
What it costs, with the arithmetic
Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit that never expires. Failed or refused requests are not charged. Three cases from this guide:
- One-hour transcript, one call. 12,000 input and 800 output tokens: 12,000 x $0.15 / 1,000,000 = $0.0018, plus 800 x $0.50 / 1,000,000 = $0.0004, total $0.0022.
- Twenty such meetings. 20 x $0.0022 = $0.044, under five cents.
- A nine-hour recording by map-reduce. About 108,000 tokens, so 9 chunks of 12,000. The map calls send 9 x 12,300 = 110,700 input tokens (12,000 plus about 300 of instructions) and return 9 x 600 = 5,400 tokens. The reduce call sends 5,700 and returns 1,000. Totals: 116,400 input and 6,400 output. Cost: 116,400 x $0.15 / 1,000,000 = $0.01746, plus 6,400 x $0.50 / 1,000,000 = $0.0032, total $0.02066, about two cents.
The $0.50 trial credit therefore pays for over 200 one-hour summaries (0.50 / 0.0022 is about 227). Top-ups run from $20 to $500, with +5% from $50, +10% from $100 and +15% from $200. See the pricing page for the full table.
This service is text only. It does not transcribe audio, so produce the transcript with a speech tool first. It is also one open-weight model run by an independent provider, not the official API of any vendor. Prompts are not used for training, which is worth knowing before you send meeting recordings that name real people.
