Loly 3.5
Create stream token
Exchanges the voice key for a short-lived token that opens the WebSocket. The allowance is deducted here.
POST
/api/v1/tts/stream-tokenOn this page
Code examples
curl -X POST https://studio.evomlabs.com/api/v1/tts/stream-token \
-H "Authorization: Bearer vc_sk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"text_length": 200}'Request
| Field | Type | Required | Description |
|---|---|---|---|
text_length | integer | Yes | Integer from 1 through 10,000; allowance is deducted when the token is issued. |
voice_id | string | No | Required with an account key. Omit with a voice key; if provided, it must match the key-bound voice. |
Response
JSON
{
"ok": true,
"data": {
"stream_token": "SHORT_LIVED_TOKEN",
"ws_url": "wss://studio.evomlabs.com/ws/tts/stream",
"max_length": 200,
"chars_deducted": 200,
"expires_in": 60
}
}Errors
REST failures use the documented error envelope. Handle the error code instead of matching the human-readable message.
Error codesWas this page helpful?