Documentation Index
Fetch the complete documentation index at: https://tiktools.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Connection URL
wss://api.tik.tools/captions?uniqueId=STREAMER&apiKey=YOUR_KEY&translate=LANG&max_duration_minutes=120
Query Parameters
| Parameter | Type | Required | Description |
|---|
uniqueId | string | Yes | TikTok username to transcribe |
apiKey | string | Yes | Your API key |
translate | string | No | Target language code (e.g. en, es, ja) |
max_duration_minutes | number | No | Max transcription duration in minutes |
diarization | boolean | No | Enable speaker identification |
Message Types
caption
Transcribed speech from the streamer.
{
"type": "caption",
"text": "Hello everyone welcome to the stream",
"isFinal": true,
"speaker": "Speaker 1",
"language": "en",
"timestamp": 1234567890
}
| Field | Type | Description |
|---|
text | string | Transcribed text |
isFinal | boolean | true for final transcription, false for partial |
speaker | string | Speaker label (when diarization is enabled) |
language | string | Detected language code |
translation
Translated text (when translate parameter is set).
{
"type": "translation",
"text": "Hola a todos bienvenidos al stream",
"language": "es"
}
credits
Credit usage updates.
{
"type": "credits",
"remaining": 450,
"total": 500,
"used": 50
}
credits_low
Warning when credits are running low.
{
"type": "credits_low",
"remaining": 10,
"total": 500
}
status
Connection status updates.
{
"type": "status",
"status": "connected"
}
Client Commands
Send JSON commands to control the session:
Change Language
{"action": "setLanguage", "language": "es"}
Stop Transcription
Full Example
import WebSocket from 'ws';
const ws = new WebSocket(
'wss://api.tik.tools/captions?uniqueId=streamer&apiKey=YOUR_KEY&translate=en&max_duration_minutes=120'
);
ws.on('message', (data) => {
const msg = JSON.parse(data.toString());
switch (msg.type) {
case 'caption':
const prefix = msg.speaker ? `[${msg.speaker}] ` : '';
console.log(`${prefix}${msg.text}${msg.isFinal ? ' ✓' : '...'}`);
break;
case 'translation':
console.log(` → ${msg.text}`);
break;
case 'credits':
console.log(`Credits: ${msg.remaining}/${msg.total} min remaining`);
break;
case 'status':
console.log(`Status: ${msg.status}`);
break;
}
});