A speech-to-text API for 99 languages
Transcribe 99 languages and generate spoken audio using one OpenAI-compatible endpoint, a single API key, and shared billing with thelastapi.
On this page 7 sections
You can run speech-to-text across 99 languages and generate natural text-to-speech audio under a single provider using thelastapi. The platform provides an OpenAI-compatible gateway at /v1/ai that serves transcription through vibiz/transcribe and speech synthesis through vibiz/voice. With one API key and shared billing, you can take recorded audio, convert it to text, run it through language models, and generate spoken responses without juggling multiple vendors.
Building voice assistants, transcription pipelines, or automated customer support tools usually requires coordinating multiple separate accounts. A unified gateway handles both directions of audio processing using standard OpenAI SDK methods or straightforward HTTP requests.
Why combine transcription and speech synthesis in one provider
Splitting voice inputs and voice outputs between different vendors adds friction to production applications. Most teams run into three specific operational problems:
- Scattered billing and keys. Audio ingestion and voice synthesis end up on separate credit cards, with different dashboard balances, separate spending caps, and unique authentication headers.
- Mismatched client libraries. You write one wrapper around your speech-to-text service and a different streaming client for text-to-speech, each with unique error shapes and network retry logic.
- Disconnected asset storage. Generated audio files need to be manually uploaded to an object store to generate permanent URLs for client playback, adding extra latency and infrastructure code.
With thelastapi, transcription and voice generation sit behind the exact same authentication and routing layer. Because the endpoints follow the standard OpenAI audio specification, you can point standard SDKs directly at the platform by changing the base URL. For an overview of other media capabilities on the same gateway, see one API for image, video and voice AI models.
Transcribing audio across 99 languages with vibiz/transcribe
The vibiz/transcribe model accepts audio recordings up to 25 MB in size and transcribes speech across 99 languages. It runs on a dedicated lab voice model and is billed at $0.22 per hour of audio processed.
You can run transcription directly from your terminal using the CLI:
vibiz transcribe call.m4a --language enTo call the transcription route from your application, make a multipart form post to POST /v1/ai/audio/transcriptions. You can use standard curl:
curl https://thelastapi.dev/v1/ai/audio/transcriptions \
-H "Authorization: Bearer $VIBIZ_API_KEY" \
-F file="@meeting.mp3" \
-F model="vibiz/transcribe" \
-F language="en"The gateway parses the audio, runs the transcription model, and returns a JSON response containing the full transcript text.
If you have your own Google credentials configured via vibiz ai keys set google, you can route Google transcription models through your own account where thelastapi charges $0. Note that transcription running on a Google key carries a 14 MB file upload limit instead of the standard 25 MB platform limit.
Generating spoken audio with vibiz/voice
Once your application processes transcribed text or generates a reply with a language model, you can synthesize audio using the text-to-speech endpoint at POST /v1/ai/audio/speech. The platform provides three voice tiers:
| Model | Description | Price |
|---|---|---|
vibiz/voice | Natural real-time voices | $0.04 per 1,000 characters |
vibiz/voice-pro | The most expressive voices | $0.08 per 1,000 characters |
vibiz/voice-lite | The fastest voices, supporting 32 languages | $0.04 per 1,000 characters |
The text limit per request is 4,096 characters. You can choose from nine standard voice personalities: alloy, ash, coral, echo, fable, nova, onyx, sage, and shimmer. To see deeper formatting options and voice comparisons, check a text-to-speech API: voices, formats and price per 1,000 characters.
From the CLI, generate speech files with a single command:
vibiz say "Welcome to Acme Bakery" -o welcome.mp3 --voice alloyWith HTTP requests, stream raw mp3 or pcm bytes:
curl https://thelastapi.dev/v1/ai/audio/speech \
-H "Authorization: Bearer $VIBIZ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "vibiz/voice",
"input": "Your reservation is confirmed for seven o clock.",
"voice": "nova"
}' \
--output confirmation.mp3When you request mp3 audio while running on your own Google key, the audio returns as audio/wav because the gateway does not convert the native audio stream. Standard pcm outputs remain 24 kHz 16-bit mono PCM.
Calling both with the OpenAI SDK
Because thelastapi exposes OpenAI-compatible routes, you do not need dedicated third-party packages for speech. You configure the official OpenAI SDK using your project AI key and base URL.
First, set up your project resources:
vibiz init "Voice Assistant" --resources ai
vibiz devThe CLI writes your local environment variables, including VIBIZ_AI_BASE_URL and VIBIZ_AI_API_KEY, alongside standard aliases like OPENAI_BASE_URL and OPENAI_API_KEY.
Here is an end-to-end Node.js script that transcribes an incoming audio file, processes the text, and synthesizes a spoken reply:
import fs from 'fs';
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: process.env.VIBIZ_AI_BASE_URL,
apiKey: process.env.VIBIZ_AI_API_KEY,
});
async function runVoiceLoop() {
// 1. Transcribe the user's voice message
const transcription = await openai.audio.transcriptions.create({
file: fs.createReadStream('incoming.m4a'),
model: 'vibiz/transcribe',
language: 'en',
});
console.log('User said:', transcription.text);
// 2. Generate a conversational response
const chat = await openai.chat.completions.create({
model: 'vibiz/fast',
messages: [
{ role: 'system', content: 'Answer concisely in two sentences or less.' },
{ role: 'user', content: transcription.text },
],
});
const replyText = chat.choices[0]?.message.content ?? 'I did not catch that.';
// 3. Convert the response text to spoken audio
const speechResponse = await openai.audio.speech.create({
model: 'vibiz/voice',
voice: 'coral',
input: replyText,
});
const buffer = Buffer.from(await speechResponse.arrayBuffer());
await fs.promises.writeFile('response.mp3', buffer);
console.log('Spoken reply written to response.mp3');
}
runVoiceLoop();If your application already imports @vibiz/app, you can initialize the client directly without manual environment variables by calling new OpenAI(vibiz.ai).
Voice audio storage and asset management
Whenever you generate spoken audio with POST /v1/ai/audio/speech using a project key, the generated audio is automatically stored in the project's Files. You do not need to write separate upload scripts or configure storage buckets.
When a speech generation call finishes, the response contains two custom HTTP headers:
X-Vibiz-File-Id: The unique file identifier (for example,file_01k...).X-Vibiz-File-Url: A permanent public URL serving the audio.
Public file links are hosted at https://thelastapi.dev/f/<key>/<name>. The key uses 32 random characters so the link cannot be guessed or scraped, but can be embedded directly in web players or mobile applications without sending authorization headers.
You can inspect, search, and manage generated audio files using the CLI:
vibiz files --type audio
vibiz files search "reservation"If you call the speech endpoint using an account key (vz_sk_...) without passing an X-Vibiz-Project: prj_... header, the audio is not permanently stored, and returned links expire after 24 hours.
Pricing, quotas and limits
Audio endpoints follow clear rate and payload boundaries to protect your infrastructure:
- Upload limits: Transcription accepts files up to 25 MB (or 14 MB if routed through your own Google key).
- Text lengths: Text-to-speech accepts up to 4,096 characters per request.
- Account ceilings: New accounts carry a default spend limit of $5 per UTC day across AI models and actions, which an owner can adjust in Billing.
- Project budgets: Projects carry a default daily AI limit of $1 per UTC day. When hit, calls answer with status
429anddetails.reason: "project_budget". - Concurrency & rates: Project keys allow 120 requests and 200,000 tokens a minute with 25 concurrent requests in flight by default (configurable up to 600 requests and 50 in flight). Account keys allow 300 requests and 400,000 tokens a minute.
If you are expanding beyond audio into visual generation, see how video pipelines operate in a text-to-video API: a six-second clip from a prompt. Detailed technical specifications for every endpoint are available on the AI documentation page.
To begin building voice pipelines, set up your workspace with vibiz init and test your first transcription using your project key.
Frequently asked questions
Can I transcribe non-English recordings with the speech-to-text API?
Yes, `vibiz/transcribe` supports transcription across 99 languages. You can specify the spoken language using the `language` parameter in your request or let the model detect it.
How does speech-to-text and text-to-speech billing work?
Speech-to-text with `vibiz/transcribe` costs $0.22 per hour of audio processed. Text-to-speech costs $0.04 per 1,000 characters for `vibiz/voice` and `vibiz/voice-lite`, or $0.08 per 1,000 characters for `vibiz/voice-pro`.
Are generated text-to-speech audio files saved automatically?
Yes, whenever you generate speech using a project key, the audio file is automatically saved into your project's Files drive with a permanent URL returned in the `X-Vibiz-File-Url` header.
What audio formats are accepted for transcription?
You can upload audio files up to 25 MB in size in common audio formats including MP3, WAV, OGG, WebM, AAC, FLAC, and M4A.