Skip to main content

Authenticate

Get your API key by contacting us at [email protected]. We’ll provide you with the necessary credentials to access our API.
export LOKUTOR_API_KEY="your-api-key"

Your First Request

Since we’re still growing, we currently offer our API via WebSocket for real-time streaming. Here’s how to connect and synthesize your first audio.
const WebSocket = require('ws');

const ws = new WebSocket(`wss://api.lokutor.com/ws?api_key=${process.env.LOKUTOR_API_KEY}`);

ws.on('open', function open() {
  console.log('Connected to Lokutor');
  
  // Send synthesis request
  ws.send(JSON.stringify({
    text: "Hello, this is Lokutor!",
    voice: "M1",
    lang: "en",
    speed: 1.05,
    steps: 5,
    version: "versa-1.0",
    visemes: false  // Optional: Enable for lipsync data
  }));
});

ws.on('message', function message(data) {
  if (typeof data === 'string') {
    if (data === 'EOS') {
      console.log('Synthesis complete');
      ws.close();
    } else if (data.startsWith('ERR:')) {
      console.error('Error:', data);
    }
  } else {
    // Binary audio data
    console.log('Received audio chunk:', data.length, 'bytes');
    // Process audio (e.g., play or save)
  }
});

Next Steps