AI Live Captions API
This guide takes you through AI Live Captions end to end with the API: sign in, create a stream, configure captions, go live, show the captions in your own player, and download the transcripts. For what AI Live Captions are and the language list, see AI Live Captions & translations.
Captions are configured with the nanoStream REST API, also called the bintu API — hostnames and headers keep the bintu name. The only step that is not an API call is pointing your encoder at the ingest URL.
Overview
| Step | Call |
|---|---|
| 1. Sign in | POST /user/validate |
| 2. Create or load a stream | POST /stream or GET /stream/{id} |
| 3. Configure captions | POST /stream/{id}/options |
| 4. Go live | Start your encoder; poll GET /stream/{id} or use webhooks |
| 5. Show captions | Caption player embed or nanoStream Messenger library |
| 6. Download replay and transcripts | Static files on the VOD CDN, no API call |
Base URL: https://bintu.nanostream.cloud. Authenticate with your API key in the X-BINTU-APIKEY header. See APIs & SDKs overview for API keys and tokens.
Permissions
| Operation | nanoAdmin | nanoUser | nanoReadOnly |
|---|---|---|---|
| Sign in, stream info | ✓ | ✓ | ✓ |
| Create stream | ✓ | ✓ | ✗ |
| Create, read, change, delete caption options | ✓ | ✓ | ✗ |
Since November 2026, AI Live Captions is enabled for all organisations. If a caption option call returns 403 with LiveCaptioningNotEnabled, AI Live Captions isn't available for your organisation: contact support. See Availability and billing.
1. Sign in
Validate the user's credentials. The response contains a token and, for nanoAdmin users, the organisation's API key.
curl -X POST https://bintu.nanostream.cloud/user/validate \
-H "content-type: application/json" \
-d '{
"email": "user@example.com",
"password": "<YOUR_PASSWORD>"
}'
Call GET /organisation afterwards to check the key and load the organisation profile.
Building a sign-in UI? POST /user/password resets a password. It always returns 200 and never reveals whether the email exists, so show a generic confirmation message.
2. Create or load a stream
Create a new stream:
curl -X POST https://bintu.nanostream.cloud/stream \
-H "X-BINTU-APIKEY: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"type": "low-latency",
"tags": ["live-event"]
}'
To continue with an existing stream, load it with GET /stream/{id}. To check whether a stream name is already taken, use POST /stream/validate.
Both responses contain ingest.rtmp. Put url into your encoder as the server and streamname as the stream key:
ingest:
rtmp:
url: rtmp://bintu-vtrans.nanocosmos.de/live
streamname: XXXXX-12345
The same response has a playout object with ready-made playback URLs.
Transcripts are created for every language in targetLanguages. To watch the stream with its captions afterwards, add the replay job in Live Processing when you create the stream, or later with PUT /stream/{id}/processing. See Live Processing.
3. Configure captions
Captions are a stream option group named captions.
| Call | What it does |
|---|---|
POST /stream/{id}/options | Turns captions on |
GET /stream/{id}/options | Reads the current setup, for example to show the active languages in your UI |
PUT /stream/{id}/options | Changes the languages of a stream that already has captions. Send name, group and options. |
DELETE /stream/{id}/options?group=captions-1 | Turns captions off |
group is the optionGroup from the create or read response, usually captions-1. It is not the option name captions.
Request body
| Field | Type | Description |
|---|---|---|
name | string | Always captions |
options.engine | string | ASR engine. deepgram is the standard engine. |
options.sourceLanguage | string | Language spoken in the stream, e.g. en. See the language list. |
options.targetLanguages | string | Optional. Comma-separated language codes, e.g. "en,de". The source language gives the transcript, every other code a translation. Default: en. |
Transcript plus German translation:
curl -X POST https://bintu.nanostream.cloud/stream/YOUR_STREAM_ID/options \
-H "X-BINTU-APIKEY: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"name": "captions",
"options": {
"engine": "deepgram",
"sourceLanguage": "en",
"targetLanguages": "en,de"
}
}'
Transcript only:
curl -X POST https://bintu.nanostream.cloud/stream/YOUR_STREAM_ID/options \
-H "X-BINTU-APIKEY: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{"name":"captions","options":{"engine":"deepgram","sourceLanguage":"en","targetLanguages":"en"}}'
targetLanguages is one string, not a JSON array. Put the source language in it to get the transcript: sourceLanguage en with targetLanguages "en,de" gives the English transcript and a German translation; "de" alone gives only the translation.
Changes take effect on the next ingest session. Change captions before the stream starts, or restart the stream afterwards.
4. Go live
Start your encoder with the ingest URL and stream name from step 2. There is no separate "go live" call, and captions start automatically.
To follow the stream state, poll GET /stream/{id} and watch state: it becomes live when ingest starts, and ended when it stops. Authenticate every poll with your API key or token (anonymous requests can be rejected with 403), and back off on repeated failures.
Prefer push over polling: organisation webhooks fire on_publish when a stream starts ingesting and on_publish_done when it stops. A webhook covers every stream of the organisation, so filter on the stream name in the payload. See Webhooks.
To end the broadcast, stop the encoder. The stream is immediately ready for the next ingest session.
5. Show captions in your own player
The quickest way is the caption player embed, described in Show captions to viewers. For your own player or UI, use the nanoStream Messenger library. It opens a WebSocket connection to the caption service and writes each caption into an HTML element you choose.
Each language pair is a caption channel named STREAMNAME-SOURCE-TARGET, e.g. XXXXX-YYYYY-en-de. The source-language transcript is XXXXX-YYYYY-en-en.
Load the library
<script src="https://nmessenger.nanostream.cloud/client/nmessenger.js"></script>
Add a caption overlay
<div id="caption-text" class="overlay-text"></div>
<style>
.overlay-text {
position: absolute;
left: 0; right: 0; bottom: 5%;
margin: 0 auto;
padding: 0.5rem 0.75rem;
max-width: 80%;
font-family: system-ui, sans-serif;
font-size: 1rem;
line-height: 1.4;
text-align: center;
background: rgba(0, 0, 0, 0.55);
color: #fff;
border-radius: 6px;
pointer-events: none; /* captions never block the player controls */
z-index: 9999; /* captions stay above the player UI */
}
</style>
Place the overlay inside the element that holds your player, so position: absolute places it over the video.
Connect to the caption channel
document.addEventListener("DOMContentLoaded", function () {
const messenger = new NanoMessenger(
"nmessenger.nanostream.cloud", // caption server
443, // secure WebSocket port
{ overlayDiv: "caption-text" } // ID of your overlay element
);
const captionToken = null; // "<YOUR_JWT>" for secure streams, null otherwise
messenger.connect(
captionToken,
null, // user: not needed for captions
"XXXXX-YYYYY-en-de", // caption channel
() => console.log("Captions connected"),
(error) => console.error("Caption connection failed:", error)
);
});
| Parameter | Where | Description |
|---|---|---|
| server | new NanoMessenger(server, port, options) | Caption server host: nmessenger.nanostream.cloud |
| port | new NanoMessenger(...) | 443 (always secure WebSocket) |
overlayDiv | options | ID of the element that receives the captions. It must exist in the DOM before you create the client. |
| token | messenger.connect(token, ...) | Playback token for secure streams, null for non-secure streams |
| user | messenger.connect(token, user, ...) | Optional, null for captions |
| channel | messenger.connect(..., channel, ...) | Caption channel STREAMNAME-SOURCE-TARGET |
Once connected, each caption replaces the content of the overlay element, and the library reconnects on its own when the connection drops. To offer several languages, connect to the channel the viewer picks.
For secure streams, the caption token is the same playback token you use for the video. See Playback tokens.
6. Download replay and transcripts
When the stream was recorded (step 2), the replay and the caption files are static files on the VOD CDN. They need no API key, so role permissions don't apply.
https://bintu-vod.nanocosmos.de/vod/replay/{streamName}.m3u8
https://bintu-vod-eu-02-ak.nanocosmos.de/transcript/{orgHash}/{streamName}/{streamName}.{langPair}.{format}
| Placeholder | Meaning | Example |
|---|---|---|
{streamName} | Full stream name | XXXXX-12345 |
{orgHash} | The part of the stream name before the first - | XXXXX |
{langPair} | {sourceLanguage}-{targetLanguage} | en-en (transcript), en-de (translation) |
{format} | vtt, srt or txt. All three exist for every language pair. | vtt |
For a stream XXXXX-12345 with source en and target de:
https://bintu-vod-eu-02-ak.nanocosmos.de/transcript/XXXXX/XXXXX-12345/XXXXX-12345.en-en.vtt
https://bintu-vod-eu-02-ak.nanocosmos.de/transcript/XXXXX/XXXXX-12345/XXXXX-12345.en-de.srt
https://bintu-vod-eu-02-ak.nanocosmos.de/transcript/XXXXX/XXXXX-12345/XXXXX-12345.en-de.txt
A bare language code (XXXXX-12345.de.vtt) does not exist: always use the pair.
Files appear about one to two minutes after the stream ends. A 404 means the files are not ready yet, or the stream name or language pair doesn't match. This URL layout applies to current recordings; older recordings may use a different layout.
To play the replay with captions, use the Live replay player or any HLS player with the VTT file.
Errors
| Status | Meaning | What to do |
|---|---|---|
400 | Invalid language setup, e.g. an unsupported language code | Fix the request body |
401 | Missing or invalid API key or token | Check the X-BINTU-APIKEY header |
403 LiveCaptioningNotEnabled | AI Live Captions isn't available for the organisation | Contact support |
403 | Your role is nanoReadOnly | Use a nanoAdmin or nanoUser account |
404 on a transcript URL | Files not ready, or wrong name or language pair | Wait a minute, then check the URL parts |
NanoMessenger is not defined | The library isn't loaded yet | Create the client inside DOMContentLoaded |
| Captions received but not shown | overlayDiv doesn't match an existing element ID | Match the IDs |
Next steps
- AI Live Captions & translations: languages, Builder Hub and Dashboard setup
- nanoStream REST API: streams, states and the full API reference
- Webhooks: get notified when streams start and stop
- Live Processing: recording for replay and transcripts
Try it in the Builder Hub: the AI Live Captions tool runs this exact flow on your own stream; see AI Live Captions & translations. Start for Free