API Documentation and Quickstart Guide for Text-to-Speech

By SpeechWeave editorial team · Updated 2026-11-19

This page provides the technical specifications for integrating SpeechWeave’s text-to-speech API into your synthetic speech dataset generation pipelines. It covers authentication, endpoint structures, request parameters, and response formats, enabling data science teams to programmatically generate audio files for training speech recognition models.

The guide details rate limits, error handling, and SDK compatibility, ensuring reliable high-volume usage. It is designed for developers who need precise control over voice selection, language support, and cost-per-character metrics when building large-scale ML datasets.

API Documentation and Quickstart Guide for Text-to-Speech

Frequently asked questions

What is the API endpoint URL?

The endpoint is POST https://api.fs26.info/v1/audio/speech. It accepts a JSON body with fields like model, input, voice, response_format, and speed. This structure mirrors the OpenAI speech endpoint, allowing you to use existing OpenAI SDKs by simply changing the base URL to https://api.fs26.info/v1.

Does the API support SSML?

No, the API does not support SSML. It accepts plain text input up to 4096 characters. You cannot use SSML tags. The service focuses on simple text-to-speech conversion without complex markup support.

How do I set the language parameter?

Pass the optional language field with an ISO code. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly set the language to ensure correct synthesis.

What happens if the request fails?

Failed requests are free. If synthesis fails, the charge is returned in full. You do not lose any credit for unsuccessful attempts. This ensures you only pay for successfully generated audio files.

Can I stream audio in real-time?

No, there is no streaming or real-time partial audio. The API returns the complete audio file in the response. You must wait for the full synthesis to complete before receiving the data. There is no WebSocket endpoint for live audio.

Is there a WebSocket endpoint?

No, there is no WebSocket endpoint. The API is a standard REST interface. You send a POST request and receive the full audio file in the response. There is no support for real-time streaming or partial audio chunks.

How do I handle rate limits?

The limit is 60 requests per minute per key. Before the first top-up, it is 10 per minute. Requests are processed sequentially, so under load, a request may wait in a queue. Monitor your usage to avoid delays.

What SDKs are officially supported?

There is no official SDK of our own. Use the OpenAI SDK or plain HTTP. The endpoint shape matches the OpenAI speech endpoint, so you can use the official OpenAI SDKs by changing the base URL to https://api.fs26.info/v1.

Does the API support custom voices?

No, there is no custom voice cloning. You can choose from 8 preset voices: aria, nova, luna, sage, felix, milo, atlas, or orion. You cannot upload your own voice or design custom voices for your specific needs.

How is the response format defined?

Define the format using the response_format field. Supported formats are mp3, wav, opus, flac, and pcm. The API returns the audio file in the specified format within the HTTP response body.

Can I send large texts in one request?

No, each request is limited to 4096 characters. If your text exceeds this length, you must split it into parts. Each part is sent as a separate request to ensure successful synthesis within the character limit.

How do I split text for long inputs?

Split your text into chunks of up to 4096 characters. Send each chunk as a separate request. Then, join the resulting audio files to create the final audio. This ensures each part is synthesized correctly.

Is there a Python SDK available?

There is no dedicated Python SDK of our own. However, you can use the official OpenAI Python SDK. Configure it by setting the base URL to https://api.fs26.info/v1. This allows you to use the same code structure as with OpenAI.

How do I authenticate with the API?

Use the Authorization: Bearer tts-... header with your API key. You get one active key per account. You can issue a new key at any time, which immediately invalidates the old one. Keep your key secure.

First request

curl

curl https://api.fs26.info/v1/audio/speech \
  -H "Authorization: Bearer $TTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"tts-1","voice":"aria","input":"Hello from the API.","response_format":"mp3"}' \
  --output hello.mp3

Python (openai)

from openai import OpenAI

client = OpenAI(base_url="https://api.fs26.info/v1", api_key="tts-...")

with client.audio.speech.with_streaming_response.create(
    model="tts-1", voice="nova", input="Hello from Python.", response_format="mp3"
) as response:
    response.stream_to_file("hello.mp3")

Node.js (openai)

import OpenAI from "openai";
import fs from "node:fs";

const client = new OpenAI({ baseURL: "https://api.fs26.info/v1", apiKey: process.env.TTS_API_KEY });
const res = await client.audio.speech.create({ model: "tts-1", voice: "milo", input: "Hello from Node.js." });
fs.writeFileSync("hello.mp3", Buffer.from(await res.arrayBuffer()));
voice
ariafemale
novafemale
lunafemale
sagefemale
felixmale
milomale
atlasmale
orionmale
language
arالعربية
zh中文
daDansk
nlNederlands
enEnglish
fiSuomi
frFrançais
deDeutsch
elΕλληνικά
heעברית
hiहिन्दी
itItaliano
ja日本語
ko한국어
msBahasa Melayu
noNorsk
plPolski
ptPortuguês
ruРусский
esEspañol
swKiswahili
svSvenska
trTürkçe

Authentication

Sound wave illustration for: Authentication

Authentication is handled via a Bearer token passed in the Authorization header. Each account holds one active key, issued upon sign-up via Google or email. This single key authenticates all API requests to the endpoint.

Bearer token format

Bearer token format

Include the header Authorization: Bearer tts-<your-key>. The key string begins with tts- and is unique to your account. Ensure no extra whitespace is included in the token value.

Key issuance process

Key issuance process

Keys are generated immediately after account creation. Google sign-ups receive a $0.50 trial credit; email/password accounts start with zero balance. You can view your current key on the /get-api-key/ dashboard page.

  • Google sign-up: includes trial credit
  • Email signup: no trial credit
  • View key on dashboard

Old key revocation timing

Issuing a new key immediately invalidates the previous one. The old key stops working at once, ensuring only one active key per account. This prevents concurrent usage conflicts across different data science pipelines.

Endpoint Structure

Sound wave illustration for: Endpoint Structure

The API provides three primary endpoints for synthetic speech dataset generation. The speech generation endpoint handles audio synthesis via POST requests, while the voices and models endpoints allow programmatic discovery of available assets.

Speech generation endpoint

Send text to POST https://api.fs26.info/v1/audio/speech to receive an audio file. This endpoint processes requests sequentially, which may introduce queue delays under load. It accepts JSON bodies with model, input, voice, and format parameters.

Voices listing endpoint

Use GET https://api.fs26.info/v1/voices to retrieve available presets, supported languages, formats, and pricing. This allows your data science pipeline to dynamically select voices based on language coverage or cost-per-character requirements.

Models listing endpoint

Query GET https://api.fs26.info/v1/models to verify available engine versions. The API supports "tts-1" and "tts-1-hd", which share the same engine and pricing structure for consistent dataset generation.

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts a JSON body with model, input, voice, response_format, speed, and optional language. Use tts-1 or tts-1-hd for identical engine and pricing. Set input to your text (max 4096 characters). Specify one of eight voice presets. Supported formats include mp3, wav, opus, flac, and pcm. Speed ranges from 0.25 to 4.0.

Model selection (tts-1, tts-1-hd)

Both models use the same engine and price ($10 per 1 million characters). Choose tts-1-hd if higher fidelity is required for your speech recognition training data, or tts-1 for standard output. There is no price difference between them.

Input text limit

Each request supports up to 4096 characters. Spaces and punctuation count toward this limit. For longer texts, split into parts, generate audio files, and join them. Generation speed is roughly real-time, with short phrases taking a few seconds.

Voice preset selection

Select from eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. Each voice can speak any of the 23 supported languages. If language is omitted, it is guessed from the script, defaulting to English for Latin text. Set language explicitly for non-English Latin-script text to ensure accuracy.

  • Female: aria, nova, luna, sage
  • Male: felix, milo, atlas, orion

Response Formats

Sound wave illustration for: Response Formats

The API returns binary audio data directly in the response body, allowing straightforward integration into data science pipelines. Each generated file contains an inaudible watermark to mark synthetic speech, which is useful for dataset labeling. You choose the format via the response_format parameter to match your model's ingestion requirements.

Selecting the right format balances storage efficiency and decoding speed. MP3 and WAV are standard for most training jobs, while FLAC and PCM offer lossless or raw options for high-fidelity acoustic analysis. All formats support the full range of voice presets and language settings.

MP3 output format

MP3 is an efficient format for general speech recognition training. It provides good compression with minimal quality loss, reducing storage costs for large datasets. The format is widely supported by existing audio processing libraries and frameworks.

Use MP3 when storage space is a primary constraint or when your downstream models handle compressed audio natively. It works well for the standard tts-1 model and is suitable for most voice consistency evaluations.

  • Default compression level
  • Ideal for large-scale dataset storage
  • Supported by most audio libraries

WAV output format

WAV provides uncompressed audio. It is an option for high-precision speech recognition model training.

WAV files are larger than MP3 but eliminate decoding artifacts. Use this format when your pipeline requires raw audio data for detailed spectral analysis or when testing model sensitivity to compression artifacts.

  • Uncompressed audio
  • No data loss
  • Preferred for acoustic feature extraction

FLAC and PCM options

FLAC offers lossless compression. It is suitable for archival storage of training datasets where disk space is limited but fidelity is required. PCM provides raw uncompressed audio.

Both formats support the same voice presets and language settings as MP3 and WAV. Choose FLAC for balanced storage and quality, or PCM for maximum simplicity in audio processing workflows.

  • Lossless compression (FLAC)
  • Raw audio data (PCM)
  • Suitable for archival storage

Rate Limits

Sound wave illustration for: Rate Limits

Requests are processed sequentially, which means concurrent calls may wait in a queue before synthesis begins. This linear processing model ensures consistent voice quality but requires careful rate management for high-throughput dataset generation.

Standard requests per minute

After topping up your account, you are allowed 60 requests per minute per API key. This limit applies to all successful and failed synthesis attempts.

Pre-top-up limit

New accounts without a top-up are limited to 10 requests per minute. This allows you to validate the integration before committing to larger scale generation.

Queue behavior under load

Requests are processed one after another. Under heavy load, a request may wait in the queue, increasing the total time to receive the audio file. Plan your batch sizes accordingly to avoid excessive latency.

Rate Limits

Error Handling

Sound wave illustration for: Error Handling

API responses clearly indicate success or failure. Understanding these codes helps automate error recovery and billing reconciliation efficiently.

Failed synthesis attempts do not consume your credit. If the engine cannot process the input, the charge is returned in full, ensuring you only pay for successful audio generation.

HTTP status codes

Use standard HTTP codes to determine next steps. 200 indicates successful audio generation. 4xx errors typically denote authentication or parameter issues, while 5xx errors suggest temporary server-side processing delays.

  • 200: Success, audio data returned
  • 401: Invalid or expired API key
  • 429: Rate limit exceeded
  • 500: Internal server error

Failed request billing

If synthesis fails, the charge is returned in full. You are billed only for completed requests where audio is successfully generated and returned in the response body.

Input validation errors

Ensure input text does not exceed 4096 characters. Provide a valid voice preset from the /v1/voices endpoint. If the language is ambiguous, explicitly set the language parameter to avoid default English guessing for Latin-script text.

SDK Integration

Sound wave illustration for: SDK Integration

The API mirrors the OpenAI speech endpoint structure, allowing direct reuse of official OpenAI SDKs. By simply adjusting the base_url to https://api.fs26.info/v1, your existing client configurations remain valid without code refactoring.

You can initialize the client using standard authentication headers. The SDK handles the JSON body construction for model, input, voice, and format parameters automatically, ensuring consistent request shapes across different programming environments and language bindings.

OpenAI SDK compatibility

The API follows the same request shape as the OpenAI speech endpoint. This allows you to use the official OpenAI SDKs by changing the base_url to https://api.fs26.info/v1. Your existing code for handling JSON bodies, headers, and error responses remains compatible.

Base URL configuration

Point your SDK client to https://api.fs26.info/v1. This endpoint serves all TTS operations, including speech generation, voice listing, and model information. Ensure your environment variables or configuration files reflect this base URL to route requests correctly.

Client initialization steps

  • Set Authorization: Bearer tts-<your-key> in the HTTP headers.
  • Configure base_url to https://api.fs26.info/v1.
  • Initialize the SDK client with your API key.
  • Pass parameters like model, input, voice, and response_format as per the standard schema.

Curl Example

Sound wave illustration for: Curl Example

This section provides a concrete curl example for generating speech. It demonstrates the exact request structure, required headers, and how to parse the binary audio response for immediate use in your pipeline.

The example uses the tts-1 model with the aria voice. It shows how to pass a short test string and save the output directly to a file for quick validation of your integration.

Basic request structure

Send a POST request to the speech endpoint with a JSON body containing the model, input, and voice fields. The API returns the audio file directly in the response body.

Use the --data flag to pass your JSON payload. Ensure the text does not exceed 4096 characters to avoid truncation errors.

  • Endpoint: POST https://api.fs26.info/v1/audio/speech
  • Method: POST
  • Content-Type: application/json

Headers configuration

Include your API key in the Authorization header using the Bearer scheme. Replace YOUR_API_KEY with your actual key from the dashboard.

No additional headers are strictly required for basic synthesis, but ensure your client handles binary data correctly.

  • Authorization: Bearer YOUR_API_KEY
  • Content-Type: application/json

Response parsing

The response contains the audio bytes directly. Redirect the output to a file using > output.mp3. This allows immediate playback or ingestion into your dataset generation pipeline.

If the request fails, the response will contain a JSON error object with a message field describing the issue, such as invalid voice or rate limit exceeded.

  • Save output: > speech.mp3
  • Error format: JSON with message field

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Synthetic speech generation embeds inaudible markers directly into the audio waveform during synthesis.

Avatar of the voice aria
ariafemale
Avatar of the voice nova
novafemale
Avatar of the voice luna
lunafemale
Avatar of the voice sage
sagefemale
Avatar of the voice felix
felixmale
Avatar of the voice milo
milomale
Avatar of the voice atlas
atlasmale
Avatar of the voice orion
orionmale

23 languages

Any voice speaks any of these languages.

Sources and further reading

  1. Wikipedia
  2. FFmpeg documentation
  3. LibriVox public-domain audiobooks
  4. W3C WAI: making audio and video accessible
  5. openai-python on GitHub
  6. curl documentation
  7. MDN: Web Speech API
  8. OpenAI API reference: create speech
  9. Creative Commons Attribution 4.0
  10. IETF RFC 7845: Ogg Opus
  11. Node.js documentation
  12. Tether (USDT)

More on this site