🟨 JAVASCRIPT & NODE.JS SDK GUIDE 2026

JavaScript Speech to Text API Quickstart

📅 Published: February 2026🔄 Updated: August 1, 2026⏱️ 7 min read

Learn how to integrate YourVoic Speech to Text API in JavaScript and Node.js. This developer quickstart guide provides full code snippets for Node.js backend server uploads using axios and client-side browser streaming via native WebSockets.

Key Takeaways & Summary Answer for Developers

  • JavaScript Environment Options: Use Node.js axios + form-data for server-side audio file processing; use browser WebSockets + MediaRecorder for live frontend microphone streaming.
  • Key Features Supported: Real-time partial transcripts, speaker diarization (Speaker 1, Speaker 2), SRT/VTT subtitle export, and Hinglish code-switching.
  • Related SDK Guides: Explore our Python STT Quickstart or view our Speech to Text API Overview.
  • Free Developer Allowance: All accounts receive 2,500 free credits for API and 1,000 free credits for web interface upon signup with no credit card required.

Try JavaScript Speech to Text Transcriber

Upload an audio file or record speech to test our JavaScript STT API model live.

⚡ Free Trial: 3 of 3 Free Transcriptions Left⏱️ Max 2 Minutes Per Audio File (Trimmed if longer)

1. Audio Input

Click to upload or drag & drop audio

MP3, WAV, M4A, FLAC (Max 25MB • Up to 2 mins audio)

OR

2. Model & Settings

3. Transcription Result

Your transcribed text will appear here

Upload an audio file (up to 2 mins) or record live speech to transcribe speech to text.

What is JavaScript Speech to Text API Integration?

JavaScript Speech to Text API integration enables web applications, Next.js / React frontends, and Node.js backend servers to transmit audio files or live microphone streams to YourVoic’s cloud neural engine and receive JSON transcripts containing text, speaker labels, and word timestamps.

Read official documentation on Axios HTTP Library and MDN WebSockets API Reference .

How Do You Transcribe Audio Files in Node.js Using Axios?

To transcribe pre-recorded audio files (MP3, WAV, M4A, FLAC up to 25MB) on Node.js servers, send a multipart POST payload to https://yourvoic.com/api/v1/transcription/sync.

Node.js (Axios File Upload Example)
// Step 1: Install axios and form-data
// npm install axios form-data

const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

const API_URL = 'https://yourvoic.com/api/v1/transcription/sync';
const API_KEY = 'YOURVOIC_API_KEY'; // Replace with key from yourvoic.com dashboard

async function transcribeAudioFile(filePath) {
  try {
    const form = new FormData();
    form.append('file', fs.createReadStream(filePath));
    form.append('model', 'cipher_max');       // Options: "cipher_fast" or "cipher_max"
    form.append('language', 'hi');            // Language code: "hi", "en", "ta", "te", "auto"
    form.append('response_format', 'verbose_json'); // Speaker diarization & timestamps
    form.append('diarization', 'true');

    console.log('Sending audio payload to YourVoic Speech to Text API...');

    const response = await axios.post(API_URL, form, {
      headers: {
        ...form.getHeaders(),
        'Authorization': `Bearer ${API_KEY}`
      }
    });

    console.log('\n=== Transcription Result ===');
    console.log('Transcript Text:', response.data.text);
    console.log('\n=== Speaker Diarization Segments ===');
    response.data.segments?.forEach(seg => {
      console.log(`[${seg.start.toFixed(2)}s - ${seg.end.toFixed(2)}s] ${seg.speaker || 'Speaker'}: ${seg.text}`);
    });

    return response.data;
  } catch (error) {
    console.error('Transcription Error:', error.response?.data || error.message);
  }
}

transcribeAudioFile('./recording.mp3');

How Do You Stream Real-Time Audio Over WebSockets in the Browser?

To record and transcribe live microphone input directly in the user's browser, capture audio using HTML5 MediaRecorder and stream WebM / PCM audio blobs over WebSockets.

Browser JavaScript (Real-Time Microphone Streaming)
// Browser Real-Time WebSocket Streaming Example
const API_KEY = 'YOURVOIC_API_KEY';
const STREAM_URL = `wss://yourvoic.com/api/v1/transcription/stream?token=${API_KEY}`;

const socket = new WebSocket(STREAM_URL);

socket.onopen = () => {
  console.log('Connected to YourVoic Real-Time WebSocket Stream!');
  startMicrophoneStream();
};

socket.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.type === 'partial') {
    console.log('⚡ Partial Transcript:', data.text);
    document.getElementById('live-transcript').innerText = data.text;
  } else if (data.type === 'final') {
    console.log('✓ Final Transcript Segment:', data.text);
  }
};

async function startMicrophoneStream() {
  const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
  const mediaRecorder = new MediaRecorder(stream, { mimeType: 'audio/webm' });

  mediaRecorder.ondataavailable = (event) => {
    if (event.data.size > 0 && socket.readyState === WebSocket.OPEN) {
      socket.send(event.data); // Stream raw audio blob
    }
  };

  mediaRecorder.start(100); // 100ms chunk interval
}

What Is the Pricing and Free Developer Allowance for JavaScript SDKs?

YourVoic Speech to Text API charges $0.002 per audio minute (₹0.15/min) on Cipher Fast and $0.004 per minute on Cipher Max. All new developer accounts receive 2,500 free credits for API and 1,000 free credits for the web interface upon signup with zero credit card required.

Frequently Asked Questions (FAQs)

Start Building in JavaScript Today

Claim your 2,500 free credits for API and 1,000 free credits for the web interface. Build voice bots, audio captioning, and web dictation apps in JavaScript.