Skip to main content

Connection URL

wss://api.tik.tools/captions?uniqueId=STREAMER&apiKey=YOUR_KEY&translate=LANG&max_duration_minutes=120

Query Parameters

ParameterTypeRequiredDescription
uniqueIdstringYesTikTok username to transcribe
apiKeystringYesYour API key
translatestringNoTarget language code (e.g. en, es, ja)
max_duration_minutesnumberNoMax transcription duration in minutes
diarizationbooleanNoEnable 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
}
FieldTypeDescription
textstringTranscribed text
isFinalbooleantrue for final transcription, false for partial
speakerstringSpeaker label (when diarization is enabled)
languagestringDetected 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

{"action": "stop"}

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;
  }
});