Speech to Text
Create stream token
Optional. Mint a single-use token so a browser or mobile app can stream without your API key.
POSThttps://api.voice.wistfare.com/v1/stt/stream/tokens
Optional
Only needed when audio streams from a browser or mobile app. Servers connect to WS /v1/stt/stream with the API key directly. See Streaming from a browser or app.
Call this from your server with your API key (all permission). Hand the returned token to the client, which connects to wss://api.voice.wistfare.com/v1/stt/stream?token=wv_st_…. The token opens one socket before it expires, bound to this key's project and to the model, language and latency below.
from wistfareai import WistfareAI
client = WistfareAI() # reads WISTFARE_API_KEY, on your server
token = client.speech_to_text.stream_tokens.create(
model="wistfare-stt-v3-beta", language="auto", latency="balanced", expires_in=60
)
print(token.token, token.expires_at) # give token.token to the clientRequest
JSON body, all fields optional:
| Field | Type | Default | Description |
|---|---|---|---|
model | string | wistfare-stt-v3-beta | The model the session will use. |
language | string | auto | A language code, or auto. Same values as the socket. |
latency | string | balanced | fast, balanced or accurate. |
expires_in | integer | 60 | Seconds until the token expires, from 10 to 600. |
Response
201 Created:
{
"token": "wv_st_Vb3kQ9xZ2mN7pR4tW8yC1dF6gH0jK5lA3sE9uI2o",
"expires_at": "2026-10-11T09:42:12Z",
"model": "wistfare-stt-v3-beta",
"language": "auto",
"latency": "balanced"
}| Field | Type | Description |
|---|---|---|
token | string | The single-use token, wv_st_…. It's never shown again. |
expires_at | string | Connect before this time (ISO-8601 UTC). |
model, language, latency | string | The options the token is bound to (model is canonical). |
Using the token
- Single use: the first connection attempt uses it up, even one that's refused.
- Bound options:
model,languageandlatencycome from the token. Repeating them on the socket URL is fine; a different value is refused withtoken_mismatch(4400).boostandpunctuationcan be added to the URL as usual. - Expiry applies to connecting: once connected, the session can run its full 15 minutes.
- Refused tokens: an unknown, expired or used token is refused during the WebSocket handshake with HTTP
403, so no socket opens (the JavaScript SDK rejects withAuthenticationError).
Errors
| Status | Code | Meaning |
|---|---|---|
400 | unsupported_model / unsupported_language / unsupported_latency | An option isn't valid for live transcription. |
401 | unauthorized | Missing, invalid or revoked API key. |
403 | read_only_key / account_suspended | The key is read-only, or spending is suspended on the account. |
422 | validation_error | expires_in is outside 10–600. |
429 | rate_limited | More than 20 tokens per minute on the account (by default). Retry after Retry-After seconds. |