Quickstart

Get from zero to your first transcription request in five minutes.

This page gets you from zero to your first transcription request.

1. Get an API key

Your API key starts with sk- and is provisioned by LansonAI. If you do not have one yet, contact the LansonAI team.

The plaintext key is returned only once at provisioning time. The server stores only a SHA-256 hash. Save it immediately.

2. Transcribe a recorded file (simplest path)

Submit an audio URL, get a workflow ID, poll for the result:

BASE="https://audio.lansonai.com"
SK="sk-..."

# Submit the job
curl -X POST "$BASE/v1/audio/transcriptions" \
  -H "Authorization: Bearer $SK" \
  -H "Content-Type: application/json" \
  -d '{ "audio_url": "https://cdn.example.com/audio/meeting.wav" }'

Response (202 Accepted):

{
  "request_id": "...",
  "workflow_id": "<id>",
  "status": "queued",
  "endpoint": "GET /<id>"
}

Poll the status:

curl "$BASE/<workflow_id>" \
  -H "Authorization: Bearer $SK"

When status becomes complete, the output field contains the full transcription result with segments, timestamps, and metadata.

3. Realtime transcription (WebSocket)

For live speech, connect over WebSocket:

# 1) (browser only) get a 60-second session token
RT=$(curl -s -X POST "$BASE/v1/audio/transcriptions/session-token" \
  -H "Authorization: Bearer $SK" | jq -r .token)

# 2) Connect
# wss://audio.lansonai.com/v1/audio/transcriptions/stream?access_token=$RT

# 3) Send PCM16LE / 16kHz / mono audio frames
#    Text frame: {"type":"input_audio_buffer.append","audio":"<base64>"}
#    Or send raw binary PCM frames

# 4) Flush when a speech segment ends
#    {"type":"input_audio_buffer.flush"}

# 5) Receive transcription events
#    {"type":"conversation.item.input_audio_transcription.completed","text":"..."}

4. Expected output

Offline (complete status)

{
  "workflow_id": "...",
  "status": "complete",
  "output": {
    "result": {
      "segments": [
        { "id": 0, "start_time": 0.0, "end_time": 3.2, "text": "The weather is nice today", "confidence": 0.95 }
      ],
      "summary": { "total_duration": 120.5, "num_segments": 45 },
      "metadata": { "language": "zh", "model": "whisper-large-v3-turbo", "chunk_count": 3 }
    }
  }
}

Realtime event

{
  "type": "conversation.item.input_audio_transcription.completed",
  "utterance_index": 0,
  "text": "The weather is nice today",
  "language": "zh",
  "audio_duration_ms": 3200,
  "latency_ms": 480
}

Next steps