API reference

Streaming speech recognition, with a small and explicit surface.

Use the REST API to create short-lived WebSocket sessions for Kikuyu and Dholuo ASR. Permanent API keys belong only on a trusted server.

Endpoints

GET/v1/models

List the available streaming ASR models and audio format.

Public

POST/v1/asr/sessions

Reserve audio credits and create a short-lived, one-use WebSocket credential.

Bearer API key

GET/v1/usage

Read the current credit balance and recent ASR usage.

Bearer API key

Create an ASR session

Send Authorization: Bearer celo_live_v1_… and optionally a unique Idempotency-Key. The request sets an upper bound of 1 to 300 audio seconds.

POST /v1/asr/sessions
Content-Type: application/json
Authorization: Bearer celo_live_v1_…
Idempotency-Key: 0f1d884f-8bb8-4ca0-b6b5-80ca196d4091

{
  "model": "celo-asr-kikuyu-v1",
  "max_audio_seconds": 60
}

Model is either celo-asr-kikuyu-v1 or celo-asr-dholuo-v1. Successful responses contain the WSS URL, two subprotocol values, expiry, reserved credits, and actual audio limit. If at least one second remains but the available balance is below the requested maximum, use the returned audio.max_audio_seconds and credits.reserved as the actual session limit.

WebSocket protocol

Open websocket_url with both values from websocket_protocols, in order. The second value is a one-use secret and must not be logged. A status event may arrive while the session initializes; wait for ready, then send mono, 16 kHz, little-endian signed PCM16 as binary frames no larger than 65,536 bytes.

Client → server

  • {"type":"config"} with optional language and context fields
  • Binary PCM16 audio frames
  • {"type":"flush"}
  • {"type":"reset"}

Server → client

  • status may arrive while the session initializes
  • ready with stream configuration
  • config and reset acknowledgements
  • delta with an evolving transcript
  • final or error

Errors

REST errors include a stable code, a safe message, and an request_id. Keep that identifier when contacting support; never send your API key or session credential. Responses also include X-Request-Id; honor Retry-After on 429 and 503 responses.

HTTPCode/typeMeaning
400invalid_request_errorMalformed JSON or invalid parameters.
401authentication_errorMissing, invalid, expired, or revoked key.
402insufficient_creditsNot enough audio credit to reserve a session.
403permission_errorAccount inactive or model scope denied.
404model_not_foundThe requested ASR model does not exist.
409idempotency_conflictIdempotency key reused incompatibly.
413request_too_largeJSON request body exceeds 16 KiB.
415unsupported_media_typeContent-Type is not application/json.
429rate_limit_errorSession or concurrency limit reached.
503api_errorService temporarily unavailable.

Machine-readable specifications

Use the OpenAPI document for REST tooling and the AsyncAPI document for WebSocket message schemas.