Platform docs
Get API key
Documentation

Switching from ElevenLabs

The speech-to-text endpoint takes ElevenLabs' request and returns its response, so your code keeps working with a few changes.

What to change

Four things: point the client at https://api.platform.klang.ai, use a Klang API key, set model_id to pianissimo or pianissimo_pro, and set language_code. The path is the same, /v1/speech-to-text, and the key is read from xi-api-key just like ElevenLabs.

The Python SDK works with its retries turned off, as below: a retry resends the file without model_id and language_code. Retry 429 and 503 yourself after Retry-After seconds, with the file opened again. The Node.js SDK (@elevenlabs/elevenlabs-js) rejects the response, because it requires a logprob on every word, which Klang doesn't return yet; call the endpoint with fetch instead (Node.js 20 or later).

transcribe.py
import os
from elevenlabs.client import ElevenLabs

client = ElevenLabs(
    api_key=os.environ["KLANG_API_KEY"],
    base_url="https://api.platform.klang.ai",
)

with open("meeting.mp3", "rb") as f:
    transcript = client.speech_to_text.convert(
        file=f,
        model_id="pianissimo",
        language_code="sv",
        # The SDK's retries resend the file without the form fields.
        request_options={"max_retries": 0},
    )
print(transcript.text)
import { openAsBlob } from "node:fs";

const form = new FormData();
form.append("model_id", "pianissimo");
form.append("language_code", "sv");
form.append("file", await openAsBlob("meeting.mp3"), "meeting.mp3");

const response = await fetch("https://api.platform.klang.ai/v1/speech-to-text", {
  method: "POST",
  headers: { "xi-api-key": process.env.KLANG_API_KEY },
  body: form,
});
if (!response.ok) throw new Error((await response.json()).error.message);
console.log((await response.json()).text);

Klang does not detect the language, which is why language_code is required. Swedish and Danish run on Pianissimo, our fine-tunes; the other 23 languages run on NVIDIA's Parakeet (parakeet-tdt-0.6b-v3) as released, under the same model ids.

Parameters

Klang refuses an option it can't honour with 400 unsupported_parameter instead of ignoring it, so you never think you got a feature you didn't. Sending one at its off value (diarize=false, an empty webhook field) is fine.

parameteron Klang
file, model_idSupported. model_id takes Klang's models.
language_codeRequired: one of 25 languages, as a two-letter ISO 639-1 code (sv, not swe). See the reference for the list.
keytermsSupported with pianissimo_pro: up to 1000 terms, each at most 50 characters and 5 words, without < > { } [ ] \ or control characters, and at most 64 KB together. See the reference.
file_formatSupported: other or pcm_s16le_16.
enable_loggingAccepted as a form field or query parameter, no effect: audio and transcripts are never stored, and request metadata is always kept for billing.
diarize, num_speakers, diarization_thresholdNot yet.
tag_audio_eventsNot yet.
timestamps_granularity=character or noneNot yet. Word timestamps are always included.
webhook, webhook_id, webhook_metadataNot yet. Every request is answered synchronously.
cloud_storage_url, source_urlNot yet. Upload the file.
use_multi_channel, additional_formatsNot yet.
temperature, seed, entity detection and redaction, no_verbatimNot yet.

Response differences

The response has ElevenLabs' fields, filled where Klang has the data:

  • words has word and spacing items with start and end times. There is no speaker_id, logprob or audio_event yet.
  • language_probability is always 1, since you name the language.
  • Two extra fields: model_id, and audio_seconds, the length you are billed for.