Skip to main content

Audio Generation

Mesh API provides a full suite of audio endpoints — convert text to speech, transcribe audio files, stream TTS/STT in real time, and browse available voices — all through a single API key. All endpoints share the same base URL: https://api.meshapi.ai/v1/audio Auth: Authorization: Bearer rsk_<your-key> on all REST requests. WebSocket endpoints accept the key via Sec-WebSocket-Protocol: Bearer <rsk_...> or ?api_key=<rsk_...>.

Speech-to-Text

POST /v1/audio/transcriptions Transcribe an audio file. The provider is resolved automatically from the model name. You can supply audio as a file upload, a public URL, or a cloud storage URL. This endpoint uses multipart/form-data — not JSON. Multiple STT providers are supported, e.g. elevenlabs/scribe_v2, sarvam/saaras:v3, openai/whisper-large-v3, google/gemini-3.5-transcribe, gpt-4o-transcribe, and the Qwen ASR models. There is no default: model is required. To list transcription-capable models, use the search endpoint filtered by modality: GET /v1/models/search?input_modality=audio&output_modality=text.

Form fields

enable_logging is a query parameter, not a form field: POST /v1/audio/transcriptions?enable_logging=false opts out of ElevenLabs request logging (default true). Sent as a form field it is ignored and logging stays on.

Response

With response_format=verbose_json:
type separates speech (word, spacing) from non-speech audio_event tokens, so you can drop events without parsing the text.

Examples


Qwen ASR models

Alibaba Qwen / DashScope speech-to-text, served through the same POST /v1/audio/transcriptions endpoint and form fields above. Four models are live:

Synchronous vs. file transcription

qwen3-asr-flash returns the transcript in the same response, typically within a couple of seconds. The *-filetrans models run as an asynchronous file-transcription job upstream. Mesh submits the audio, waits for the job to finish, and returns the transcript in the same response — you do not poll — so expect a few extra seconds of latency, and a larger file takes longer. The request and response shape is identical to the synchronous model; only the model value changes.

Fields and response

These models use the common STT form fields and return the standard body:
  • language_code is accepted as a hint (BCP-47, e.g. en, zh) on qwen3-asr-flash, qwen3-asr-flash-filetrans and fun-asr; omit it for auto-detection. qwen-audio-3.0-asr-flash-filetrans ignores it and always auto-detects.
  • The detected language, when reported, is on the usage record (GET /v1/usage/requests/{id}), not in the transcription body.
  • verbose_json is not provided by these models — they return { "text": ... } only.

Billing

Qwen ASR is billed per hour of audio on the clip’s detected duration: rate_per_hour × audio_seconds ÷ 3600. A short clip bills a small, non-zero amount. The per-hour rate for each model is on GET /v1/models; the exact charge for one request is on GET /v1/usage/requests/{id} as cost_usd.

Examples


Transcribe and Translate

POST /v1/audio/transcriptions/translate Transcribe audio and translate the result directly to English in a single step. This is a legacy alias of POST /v1/audio/translations, with the same behaviour. Prefer that path, which also takes response_format and temperature. This endpoint uses multipart/form-data.

Form fields

Response

Example

If the selected model doesn’t support translation, the API returns a 422 error. Check GET /v1/models to confirm a model’s capabilities.

WebSocket Real-Time STT

WS /v1/audio/transcriptions/realtime Transcribe audio in real time. Send raw audio chunks as they are captured (e.g. from a microphone) and receive partial and final transcripts as they are produced. The wire protocol is selected automatically from the model you pass. Standard streaming models (e.g. openai/whisper-large-v3) use an OpenAI-compatible frame protocol. ElevenLabs models (elevenlabs/scribe_v2_realtime) use ElevenLabs’ Scribe v2 realtime frames — see the ElevenLabs models subsection below.

Authentication

Pass your Mesh API key in one of these ways:
  • Sec-WebSocket-Protocol: Bearer rsk_... header
  • ?api_key=rsk_... query parameter
  • ?token=rsk_... query parameter

Query parameters

Each streaming session reserves $10 of your balance while open, and an account can hold 5 concurrent WebSocket sessions, shared with realtime and streaming TTS sessions. Supported audio formats: pcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_44100, pcm_48000, ulaw_8000

Standard streaming models

Standard streaming models — e.g. openai/whisper-large-v3 — use an OpenAI-compatible frame protocol. Client → server (JSON frames)
Server → client (JSON frames)

Example

ElevenLabs models

ElevenLabs models (elevenlabs/scribe_v2_realtime) use ElevenLabs’ Scribe v2 realtime frames. Client → server (JSON frames) Send input_audio_chunk frames with base64-encoded audio. This is the only message type the server forwards upstream — any other message type is silently dropped.
Set "commit": true to trigger a VAD commit when using commit_strategy: manual. Server → client (JSON frames)

Voice Management

List voices

GET /v1/audio/voices Returns a unified voice catalog spanning every TTS model brand. The list can be large, so filter by brand or model to narrow it to the voices you can actually use with the model you plan to call. Each voice is returned with voice_id, name, brand, model, language, gender, and preview_url. The response also carries count and a truncated flag (true when the list was capped before the full set was fetched).
Pass a voice’s voice_id as the voice field on POST /v1/audio/speech (or the {voice_id} path segment on the streaming endpoint) — and use the same model the voice is listed under. Filtering by brand/model keeps you from picking a voice that isn’t valid for the model you call.

Get a single voice

GET /v1/audio/voices/{voice_id} Fetch metadata for a specific voice by its ElevenLabs voice ID.

Error handling

All endpoints use standard HTTP status codes. Common cases: WebSocket sessions send a JSON error frame and then close with code 1000 before disconnecting, except while the server is draining for a restart, when the close code is 1011. Reconnect and retry.

Available models

Together STT models support batch transcription (upload a file). Diarization, audio-event tagging, and source_url/cloud_storage_url are ElevenLabs-only features.
For Indian-language audio, the language_code parameter significantly improves accuracy. Supported codes include hi, ta, te, kn, ml, mr, gu, bn.
google/gemini-3.5-transcribe parameter support. Gemini honours a subset of the fields above:
  • language / language_code — sent as a recognition hint (one language). Omit it for auto-detection; setting it suppresses speech in other languages.
  • diarize — label speakers. The label is returned as speaker_id on each word and segment.
  • timestamp_granularities[] / timestamps_granularity=word — per-word start/end times.
  • response_format — verbose_json (or diarized_json) is the container that carries the words array and per-speaker segments. It returns that detail only when combined with diarize and/or a timestamp granularity; on its own it returns text. Plain json always returns text only.
num_speakers and diarization_threshold are ignored — Gemini has no speaker-count control. Diarization and word timestamps are returned only with verbose_json or diarized_json.Gemini also accepts .m4a, .mp4, .webm and .opus audio in addition to the common formats.