Quickstarts
Transcribe a file
Send a complete recording to the Sync API with curl or Python.
This is the fastest way to see the Sync API working: one HTTP request in, one transcript out. There is no session to manage: one request carries one audio file, and you get its transcript back.
Prerequisites
- An API key, sent to you by Blynt. Export it as
BLYNT_API_KEY. - Your deployment id, sent to you by Blynt. Export it as
BLYNT_DEPLOYMENT_ID. - An audio file for one turn, as WAV or raw PCM. Any sample rate and channel count works; the deployment resamples and down-mixes for you.
export BLYNT_API_KEY=<your-api-key>
export BLYNT_DEPLOYMENT_ID=<your-deployment-id>curl
curl -X POST "https://api.blynt.ai/api/v1/deployments/$BLYNT_DEPLOYMENT_ID/transcribe" \
-H "Authorization: Bearer $BLYNT_API_KEY" \
-F 'config={"language":"fr"};type=application/json' \
-F "audio=@turn.wav;type=audio/wav"Python
The config part carries the language and, optionally, contextual biasing toward the values you expect to hear.
# /// script
# dependencies = ["requests"]
# ///
"""Send one WAV turn to the Blynt Sync API and print the transcript.
Usage:
uv run blynt_transcribe_example.py path/to/turn.wav
"""
import json
import os
import sys
import requests
API_KEY = os.environ["BLYNT_API_KEY"]
DEPLOYMENT_ID = os.environ["BLYNT_DEPLOYMENT_ID"]
# The server abandons a run after 480 s, so wait a little longer than that.
REQUEST_TIMEOUT_S = 500
config = {
"language": "fr",
"context": {
"hints": [
{"type": "values", "name": "carModel", "values": ["208", "2008", "3008", "5008"]}
]
},
}
audio_path = sys.argv[1]
with open(audio_path, "rb") as audio_file:
response = requests.post(
f"https://api.blynt.ai/api/v1/deployments/{DEPLOYMENT_ID}/transcribe",
headers={"Authorization": f"Bearer {API_KEY}"},
files={"audio": ("turn.wav", audio_file, "audio/wav")},
data={"config": json.dumps(config)},
timeout=REQUEST_TIMEOUT_S,
)
response.raise_for_status()
result = response.json()
print(f"{result['transcript']!r} duration={result['turnAudioDuration']:.2f}s")Python, raw PCM
Raw samples carry no header, so declare sampleRate and channels in the config and send the part as audio/pcm:
import json
import os
import requests
API_KEY = os.environ["BLYNT_API_KEY"]
DEPLOYMENT_ID = os.environ["BLYNT_DEPLOYMENT_ID"]
with open("turn.pcm", "rb") as pcm_file:
pcm_bytes = pcm_file.read()
# int16 little-endian samples, 8 kHz stereo in this example.
config = {"language": "fr", "sampleRate": 8000, "channels": 2}
response = requests.post(
f"https://api.blynt.ai/api/v1/deployments/{DEPLOYMENT_ID}/transcribe",
headers={"Authorization": f"Bearer {API_KEY}"},
files={"audio": ("turn.pcm", pcm_bytes, "audio/pcm")},
data={"config": json.dumps(config)},
timeout=500,
)
response.raise_for_status()
print(response.json()["transcript"])Expected output
{
"transcript": "oui c'est bien une Peugeot 3008",
"turnAudioDuration": 4.7
}Next: the Sync API reference for the full request and response schema, the error codes, and the 48 MiB / 480 s limits.