Theme
For AI agents
Start with /llms.txt. It contains the official SDK packages, authentication rules, and the complete endpoint inventory. Use /llms-api.txt when you need full request contracts, response shapes, realtime protocols, and error behavior.
Environment
bash
export VOICELAB_API_KEY=vlk_your_secretKeep this secret in the tool runtime, never in a model prompt or browser bundle. Product endpoints authenticate with Authorization: Bearer $VOICELAB_API_KEY. Account-management endpoints require a user access JWT instead.
Recommended agent flow
For TTS:
- Call
GET /v1/tts/languages. - Call
GET /v1/voices?language={code}. - Call
POST /v1/ttswith a unique idempotency key. - Save the binary WAV response.
For STT:
- Call
POST /v1/sttwith multipart audio and a UUID idempotency key. - If the API returns
202, pollGET /v1/stt/transcriptions/{id}. - Use the history, editor, or export endpoints when the task requires durable output.
For Voice Isolator:
- Use a key with
audio_isolationAccess. - Submit multipart
filetoPOST /v1/voice-isolationswith a UUID idempotency key. Reuse that key and content on retries. - Poll job detail, including MP3 preparation after inference completes. Stop on a failed job or failed audio conversion.
- Download
audio_urlwithout forwarding the API key. Refresh detail when a signed URL expires. - Request an export only if a different format is needed. DELETE hides history and does not cancel processing or erase audio.
For LLM:
- Use a key with
llmAccess and readGET /v1/modelsfor IDs, prices, and limits. - Send
POST /v1/chat/completionswith caller-supplied messages and a unique idempotency key. - For SSE, parse events and wait for
[DONE]; HTTP200alone is insufficient. - Capture
X-LLM-Request-IDand inspectGET /v1/llm/requests/{id}after an interrupted response or duplicate retry. - Execute validated function calls in your application. Submit tool results in a new paid completion with a new idempotency key.
- Stop on
llm_usage_pendingand contact support. Do not retry under new keys.
For realtime work, call POST /v1/ticket and use the returned short-lived ticket in the WebSocket URL. Never place the API key itself in a WebSocket URL.
Tool definitions
Resolve voice_id from the voice catalog before calling the TTS tool.
json
[
{
"name": "voicelab_tts",
"description": "Generate a 24 kHz mono WAV file from text with VoiceLab.",
"input_schema": {
"type": "object",
"properties": {
"text": { "type": "string", "description": "UTF-8 text, at most 1000 bytes" },
"language": { "type": "string", "description": "Code returned by GET /v1/tts/languages" },
"voice_id": { "type": "string", "description": "Opaque voice_... ID returned by GET /v1/voices" },
"speed": { "type": "number", "minimum": 0.5, "maximum": 2.0, "default": 1.0 }
},
"required": ["text", "language", "voice_id"]
}
},
{
"name": "voicelab_stt",
"description": "Transcribe an audio file with VoiceLab and optionally request speaker labels.",
"input_schema": {
"type": "object",
"properties": {
"file_path": { "type": "string", "description": "Path to MP3, WAV, M4A/AAC, OGG/Opus, WebM/Opus, or FLAC audio" },
"language": { "type": "string", "enum": ["uz", "en", "ru"] },
"include_speakers": { "type": "boolean", "default": false }
},
"required": ["file_path", "language"]
}
}
]Retry rules
- Use a new TTS idempotency key for every new generation. On a network failure, retry the identical body with the same key.
- Use a new UUID for each new STT audio/field combination. Retry an identical upload with the same UUID.
- Honor
Retry-Afterfor429and use jittered exponential backoff. - Do not automatically retry validation or authorization failures.
- Log
request_idfor support, but never log API keys or realtime tickets.