# LarVoice API — Claude, Codex and other AI agents > Create speech, manage voices, reuse presets and transcribe audio through HTTP. Base URL: https://api.larvoice.com Studio: https://app.larvoice.com Support: support@larvoice.com ## Read first - [Interactive API reference](https://api.larvoice.com/docs) - [Public OpenAPI contract](https://api.larvoice.com/openapi-lite.json): exact routes, schemas, examples and limits. - [Complete AI reference](https://api.larvoice.com/llms-full.txt): this guide plus the current public OpenAPI contract in one response. Use the remote MCP server (recommended for Google Antigravity, Claude Code, Codex, Cursor, Windsurf, VS Code, Gemini CLI, Cline, OpenCode and n8n) or call the HTTP endpoints directly. API and MCP access require an active LarVoice Pro subscription. ## MCP Server (Antigravity, Claude Code, Codex, Cursor, VS Code & more) Connect directly to the remote Streamable HTTP MCP server at `https://api.larvoice.com/mcp` using your Pro API key. No local package installation is required. Claude Code: ~~~sh export LARVOICE_API_KEY="YOUR_LARVOICE_API_KEY" claude mcp add --transport http larvoice https://api.larvoice.com/mcp \ --header "Authorization: Bearer ${LARVOICE_API_KEY}" ~~~ Google Antigravity (`~/.gemini/antigravity/mcp_config.json`, `~/.gemini/config/mcp_config.json`, or `.agents/mcp_config.json`): ~~~json { "mcpServers": { "larvoice": { "serverUrl": "https://api.larvoice.com/mcp", "headers": { "Authorization": "Bearer YOUR_LARVOICE_API_KEY" } } } } ~~~ OpenAI Codex CLI: ~~~sh export LARVOICE_API_KEY="YOUR_LARVOICE_API_KEY" codex mcp add larvoice --url https://api.larvoice.com/mcp --bearer-token-env-var LARVOICE_API_KEY ~~~ Or add to `~/.codex/config.toml`: ~~~toml [mcp_servers.larvoice] url = "https://api.larvoice.com/mcp" bearer_token_env_var = "LARVOICE_API_KEY" ~~~ Cursor (`~/.cursor/mcp.json` or `.cursor/mcp.json`): ~~~json { "mcpServers": { "larvoice": { "url": "https://api.larvoice.com/mcp", "headers": { "Authorization": "Bearer YOUR_LARVOICE_API_KEY" } } } } ~~~ Windsurf (`~/.codeium/windsurf/mcp_config.json`): use `serverUrl` + `Authorization: Bearer ` (same JSON structure as Antigravity). VS Code / GitHub Copilot (`.vscode/mcp.json`): ~~~json { "servers": { "larvoice": { "type": "http", "url": "https://api.larvoice.com/mcp", "headers": { "Authorization": "Bearer ${input:larvoiceApiKey}" } } }, "inputs": [ { "type": "promptString", "id": "larvoiceApiKey", "description": "LarVoice Pro API Key", "password": true } ] } ~~~ Gemini CLI (`~/.gemini/settings.json`): use `"httpUrl": "https://api.larvoice.com/mcp"` with `"headers": { "Authorization": "Bearer YOUR_LARVOICE_API_KEY" }`. Cline / Roo Code (`cline_mcp_settings.json` or `.roo/mcp.json`): set `"type": "streamableHttp"`, `"url": "https://api.larvoice.com/mcp"`, and the Bearer `headers`. OpenCode (`opencode.json`): under `mcp.servers.larvoice`, set `"type": "remote"`, `"url": "https://api.larvoice.com/mcp"`, `"oauth": false`, and `"headers": { "Authorization": "Bearer {env:LARVOICE_API_KEY}" }`. Available MCP tools: - `get_account`: check Pro plan status, credit balances, enabled models, pricing and character limits. - `list_voices`: search 514+ Vietnamese and English public voices (and optionally your cloned voices). - `list_my_voices`: list your personal cloned voices. - `list_presets`: list your saved voice/model presets. - `generate_speech`: convert text into natural speech synchronously and return `audio_url` and `task_url`. - `generate_subtitles_speech`: dub UTF-8 SRT subtitles into timed MP3 or per-cue ZIP audio. - `list_tasks` / `get_task`: inspect recent generated speech tasks from the last 7 days before retrying. - `translate_text`: translate plain text or SRT subtitles (free, 0 credits). ## Setup and authentication Sign in to Studio at https://app.larvoice.com with an active Pro account, open API Keys and create a key. Configure it locally as LARVOICE_API_KEY. Do not paste the real key into a prompt, commit it, print it in logs or put it in frontend code. If it is missing, ask the user to configure the environment variable. Send Authorization: Bearer on authenticated HTTP and MCP requests. Free or expired-Pro accounts receive HTTP 403 (api_pro_required). Public GET /voices and GET /health do not require authentication. JSON requests use Content-Type: application/json; audio uploads use multipart/form-data. An API key uses the same account credits, personal voices and owned history as Studio. ## Prompt to give your AI Read https://api.larvoice.com/llms.txt and https://api.larvoice.com/openapi-lite.json. Use LARVOICE_API_KEY from the local environment without revealing its value. Convert my text into Vietnamese speech. Use a matching voice_id from /voices, or omit voice_id to use the configured default. Make one generation request, check success and error, then return the audio link. Follow the contract for presets, subtitles and transcription; do not invent routes or fields. Report missing configuration or insufficient credits clearly. ## Text to speech POST /v1/tts returns the speech result directly. It is not an asynchronous submission endpoint. Models: v2, v2-pro, v3-fast. Free accounts can use the models enabled for their tier by the administrator. GET /user/billing returns free_models and the effective default_model. Pro accounts can use all enabled models. Omit optional settings to use the configured defaults. ~~~sh curl --fail-with-body --silent --show-error https://api.larvoice.com/v1/tts \ -H "Authorization: Bearer ${LARVOICE_API_KEY}" \ -H 'Content-Type: application/json' \ --data '{"model":"v3-fast","language":"vi","text":"Xin chào [pause_300] mọi người","voice_id":"e5af81f8d846b8d5ed9f7f352eb5b527"}' ~~~ Read success and error, not only the HTTP status. On success, audio_url is the audio link and task_url opens the owned task detail. Download the returned link without forwarding your API key to the audio host. Save useful output locally; task text/audio details expire after 7 days. TTS text is limited to 1,000 billable characters per request for Free accounts and 20,000 for Pro accounts by default; the current limits are returned by GET /user/billing in tts_character_limits. The request body is limited to 100,000 bytes. Allowed speech tags such as [pause_300] are kept for synthesis but excluded from the character count and credit cost. By default only [pause_] is allowed; other bracketed tags become one space before character counting. Read speech_tag_patterns from GET /user/billing for the current allowlist. Credits depend on the configured model price; do not assume every model is free or always costs 1 credit. Each generation can consume credits. After an uncertain response, inspect GET /tasks and task_url when available before submitting the same text again; TTS has no documented idempotency key. ## Choose a voice GET /voices?language=vi&search=PhatTai&page=1&per_page=30 returns public voices. Use each item's voice_id and language as language. Follow pagination to find further matches. GET /user/voices lists personal voices using Bearer authentication. Create, inspect, update or delete owned voices with the routes in the contract. Only upload reference audio the user has authorized. ## Presets and pronunciation GET/POST /user/presets lists or creates presets. GET/PATCH/DELETE /user/presets/{preset_id} reads, updates or deletes an owned preset. POST /user/presets/{preset_id}/duplicate copies it; an optional name can be supplied. Generate with an existing preset and an explicit override: ~~~json {"text":"Xin chào","preset_id":"REPLACE_WITH_OWNED_PRESET_ID","speed":1.2} ~~~ Explicit request fields override preset fields. Presets store reusable voice/model/settings configuration, not the generated audio. Use /user/pronunciations and /user/pronunciations/{pronunciation_id} to manage pronunciation rules for Vietnamese speech; use the request examples in the contract. ## Pause controls Pause is auto by default: each consecutive run of line breaks becomes one [pause_250] marker with a space on each side when pause is omitted, but a line break after punctuation is only collapsed to a space. Punctuation is kept unchanged. Supply pause fields to enable selected pauses; omitted fields stay at 0 and 0 disables that pause. Values are milliseconds: ~~~json {"pause":{"comma":200,"colon":300,"semicolon":350,"period":400,"question":450,"exclamation":450,"ellipsis":600,"newline":500,"paragraph":800}} ~~~ Send normal punctuation and newlines in text. For an explicit marker, you may include a tag such as [pause_300] in text; Studio also has a Chèn pause button. Pause tags remain in the synthesis input and are excluded from billable characters. Adjacent punctuation and line breaks use the longest applicable pause; terminal punctuation adds no pause. ## SRT subtitles to speech POST /v1/subtitles supports v3-fast only. Send UTF-8 .srt as multipart file or SRT content as JSON text. Choose a voice with voice_id. Omit mode_srt_type (or use mp3) for one full MP3; use mode_srt_type=zip for one audio file per cue and download the returned zip_url. The endpoint handles subtitle mode; do not add an srt field to a normal TTS request. ~~~sh curl --fail-with-body --silent --show-error https://api.larvoice.com/v1/subtitles \ -H "Authorization: Bearer ${LARVOICE_API_KEY}" \ -F 'file=@captions.srt' -F 'model=v3-fast' -F 'voice_id=0ecb8311020d735e7de8eadda3fe8f3f' ~~~ Limits: 1 MB SRT file, 100,000 spoken characters. Credits count dialogue only, excluding indexes and timestamps. The response follows the TTS result format and includes zip_url for ZIP output. ## Translation POST /v1/translate translates text or SRT subtitles through LarVoice. It is free (0 credits). JSON text defaults to source=auto, target=vi and displayLanguage=en-US. For SRT JSON set format=srt; multipart accepts one UTF-8 .srt file. GET /v1/translate also accepts text, source, target and displayLanguage query parameters. ~~~sh curl --fail-with-body --silent --show-error https://api.larvoice.com/v1/translate \ -H "Authorization: Bearer ${LARVOICE_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{"text":"description","source":"en","target":"vi"}' ~~~ ~~~sh curl --fail-with-body --silent --show-error https://api.larvoice.com/v1/translate \ -H "Authorization: Bearer ${LARVOICE_API_KEY}" \ -F 'file=@captions.srt' -F 'source=en' -F 'target=vi' ~~~ Success returns only {"text":"..."}. SRT cue numbers and timestamps are preserved. POST supports text longer than 5,000 characters; maximum request body is 25,000,000 bytes. SRT input is limited to 1,000,000 bytes and 100,000 dialogue characters. GET URLs must fit within 8,192 bytes. Save the translated text immediately. Failed translations return a safe LarVoice error code; retry 429 according to Retry-After. ## Audio to text and SRT POST /v1/transcriptions accepts one multipart audio file, or an MP4 video with LarVoice v3, and returns text plus word-timed SRT directly. Choose an enabled transcription model: Whisper Large v3, Whisper Large v3 Turbo, or LarVoice v3. LarVoice v3 supports Vietnamese only. Maximum 25,000,000 bytes. Supported extensions: flac, mp3, mpga, m4a, ogg, wav, webm and mp4 with LarVoice v3. ~~~sh curl --fail-with-body --silent --show-error https://api.larvoice.com/v1/transcriptions \ -H "Authorization: Bearer ${LARVOICE_API_KEY}" \ -F 'file=@speech.mp3' -F 'language=vi' -F 'max_words=6' ~~~ The response is complete when HTTP 200 returns status done. Save text and srt immediately. Use a stable 32-character hexadecimal request_id to retry a lost response without a second charge. GET /v1/transcriptions lists owned history; GET /v1/transcriptions/{id} reads one result. Results are retained for 7 days when the stored result is within the database result limit. Audio is not persisted. Results up to 1 MB are retained; larger results must be downloaded from the immediate response. Credits use rounded-up audio minutes at the configured price. A configured price of 0 is free; missing pricing means the feature is closed. Provider or validation failures are refunded automatically when a charge exists. ## Video analytics POST /v1/video-analytics accepts a public Facebook or TikTok URL and returns available analytics plus direct download links. Use only videos you own or are authorized to download and use. Current credit cost is returned as credit_cost; the current default is 0. ~~~sh curl --fail-with-body --silent --show-error https://api.larvoice.com/v1/video-analytics \ -H "Authorization: Bearer ${LARVOICE_API_KEY}" \ -H 'Content-Type: application/json' \ --data '{"url":"https://www.facebook.com/reel/1152262287331465"}' ~~~ The response includes platform, title, analytics, downloads and rights_notice. Download links may expire. Do not submit private links or content without permission. ## Image generation POST /v1/images creates one asynchronous image task. Add up to 15 HTTPS or supported data URL reference images. GET /v1/images/{id} polls the task; status succeeds returns generated image URLs. Use a stable 32-character hexadecimal request_id when retrying a lost POST response. ~~~sh curl --fail-with-body --silent --show-error https://api.larvoice.com/v1/images \ -H "Authorization: Bearer ${LARVOICE_API_KEY}" \ -H 'Content-Type: application/json' \ --data '{"prompt":"A vintage travel poster for Mars, bold title VISIT MARS","quality":"medium","aspect_ratio":"square_1_1","request_id":"0123456789abcdef0123456789abcdef"}' ~~~ The demo price is returned as credit_cost and can be changed by an administrator. A failed provider task is refunded automatically. Reference images support PNG, JPEG and WebP data URLs or public HTTPS URLs; each is limited to 20 MiB and the total is limited to 64 MiB. ## Errors and retries - 400/413: fix invalid fields, file size or text length before retrying. - 401: check the locally configured API key; do not print it. - 402: insufficient credits; ask the user to top up in Studio. - 403: active Pro subscription required (api_pro_required) or feature locked to Pro; ask the user to upgrade in Studio. - 404: check the ID, ownership and expiry. - 409: inspect the current resource state before changing or deleting it. - 429: respect Retry-After when present; otherwise use bounded exponential backoff. - 502/503: report temporary unavailability or missing configuration. Do not blindly repeat a paid POST; inspect its task URL or retry with the same request_id. Use only endpoints and fields in the current public contract. Never claim output exists until the API returns a successful result. No browser login cookies are needed for these public API calls.