Quickstart
Transcribe your first recording in a few minutes.
1. Get an API key
Sign up at platform.klang.ai and create a key under API keys. Add a card during onboarding and your organization gets €5 of free credits to start with.
The key is shown once. Keep it in an environment variable on your server, never in client code. Send it as Authorization: Bearer, or as xi-api-key like the ElevenLabs SDKs do.
export KLANG_API_KEY="kp_live_..."2. Transcribe a file
Send the audio as a multipart form with the model and the language. The transcript comes back in the same response, so give your client a timeout of a few minutes for long recordings. The Python sample needs python -m pip install requests; the Node.js one needs Node.js 20 or later.
curl https://api.platform.klang.ai/v1/speech-to-text \
-H "Authorization: Bearer $KLANG_API_KEY" \
-F model_id=pianissimo \
-F language_code=sv \
-F file=@meeting.mp3import os
import requests
with open("meeting.mp3", "rb") as f:
response = requests.post(
"https://api.platform.klang.ai/v1/speech-to-text",
headers={"Authorization": f"Bearer {os.environ['KLANG_API_KEY']}"},
data={"model_id": "pianissimo", "language_code": "sv"},
files={"file": f},
timeout=600,
)
response.raise_for_status()
print(response.json()["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: { Authorization: `Bearer ${process.env.KLANG_API_KEY}` },
body: form,
});
if (!response.ok) throw new Error((await response.json()).error.message);
console.log((await response.json()).text);3. Read the response
text is the whole transcript, punctuated. words has every word with its start and end in seconds, with the gaps between words as spacing items. You are billed for audio_seconds, rounded up to a whole second.
{
"language_code": "sv",
"language_probability": 1,
"text": "Hej och välkommen.",
"words": [
{ "text": "Hej", "start": 0.32, "end": 0.61, "type": "word" },
{ "text": " ", "start": 0.61, "end": 0.66, "type": "spacing" },
{ "text": "och", "start": 0.66, "end": 0.8, "type": "word" },
{ "text": " ", "start": 0.8, "end": 0.84, "type": "spacing" },
{ "text": "välkommen.", "start": 0.84, "end": 1.42, "type": "word" }
],
"transcription_id": "6f1c2d9e-8b4a-4c1e-9f3a-2b7d5e8c1a04",
"model_id": "pianissimo",
"audio_seconds": 1.6
}Going to production
Limits
Limits apply to the whole organization, across all of its keys, and rise as you add a card and buy credits. Your current tier is shown in the console under Settings.
| tier | requests per minute | requests at once |
|---|---|---|
| No card | 10 | 1 |
| Card on file | 120 | 10 |
| Card and €10 of top-ups | 600 | 50 |
Files can be up to 250 MB with up to 1 hour of audio in every tier. Need more? Email platform@klang.ai.
Retries
429(over a limit) and503(at capacity): wait theRetry-Afterseconds, then retry.500and502: retry with exponential backoff, a few times at most.408(the upload was too slow or took too long): check the connection, then send the whole file again.- Any other
4xx: fix the request; thecodein the error body says what is wrong.
Every response carries an X-Request-Id. Log it, and include it when you contact us.
Billing
Credits are prepaid under Billing, with optional auto top-up. Only 200 responses are charged, per started second of audio. When credits run out the API answers 402 insufficient_credits; once your organization has paid for credits and has a card on file, it can go €5 below zero first so traffic doesn't stop while a top-up goes through.