Speech to Text

Create stream token

Optional. Mint a single-use token so a browser or mobile app can stream without your API key.

POST/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 client

Request

JSON body, all fields optional:

FieldTypeDefaultDescription
modelstringwistfare-stt-v3-betaThe model the session will use.
languagestringautoA language code, or auto. Same values as the socket.
latencystringbalancedfast, balanced or accurate.
expires_ininteger60Seconds 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"
}
FieldTypeDescription
tokenstringThe single-use token, wv_st_…. It's never shown again.
expires_atstringConnect before this time (ISO-8601 UTC).
model, language, latencystringThe 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, language and latency come from the token. Repeating them on the socket URL is fine; a different value is refused with token_mismatch (4400). boost and punctuation can 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 with AuthenticationError).

Errors

StatusCodeMeaning
400unsupported_model / unsupported_language / unsupported_latencyAn option isn't valid for live transcription.
401unauthorizedMissing, invalid or revoked API key.
403read_only_key / account_suspendedThe key is read-only, or spending is suspended on the account.
422validation_errorexpires_in is outside 10–600.
429rate_limitedMore than 20 tokens per minute on the account (by default). Retry after Retry-After seconds.

On this page