Developer Guide: Integrate TTS API for Audio Generation

By ClioSound editorial team · Updated 2026-11-19

This documentation provides a concise reference for integrating the ClioSound TTS API into your language learning workflows. It covers authentication, request structures, and SDK usage, enabling teachers and methodologists to generate synthetic speech for exercises, listening tests, and study materials with minimal friction.

The guide details core parameters like voice selection, speed control, and output formats, alongside practical examples using cURL and the official OpenAI SDK. It also outlines rate limits, error handling, and character constraints, ensuring you can reliably automate audio generation for educational content.

Developer Guide: Integrate TTS API for Audio Generation

Frequently asked questions

What is the endpoint URL?

The endpoint is POST https://api.f7casino.info/v1/audio/speech. It accepts a JSON body identical to the OpenAI speech endpoint. You can use the official OpenAI SDKs by changing the base_url to https://api.f7casino.info/v1. This ensures compatibility with existing client libraries and simplifies integration for developers building language learning resources.

Do I need to install a specific SDK?

No, you do not need a specific SDK. You can use the official OpenAI SDK or plain HTTP requests. The API follows the same request shape as OpenAI’s speech endpoint. Simply update the base_url in your client configuration to point to https://api.f7casino.info/v1 and use your API key for authentication.

Can I use Python with this API?

Yes, Python works perfectly. You can use the official OpenAI Python SDK or make standard HTTP requests. Pass your API key via the Authorization header. The JSON body structure matches the OpenAI specification, allowing you to generate audio files directly from your Python scripts for educational exercises or listening tests.

How do I set the language explicitly?

Set the optional 'language' field in the request body to 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 setting the language parameter ensures accurate synthesis. Supported languages include Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, and Turkish.

What is the speed range parameter?

The speed parameter accepts values between 0.25 and 4.0. This allows you to adjust the speech rate for language learning materials. Lower speeds help learners catch details, while higher speeds simulate natural conversation. The parameter is part of the standard JSON body sent to the speech endpoint alongside model and voice selections.

Is the API compatible with Node.js?

Yes, it is compatible with Node.js. Use the official OpenAI Node.js SDK or standard HTTP libraries. Configure the base_url to https://api.f7casino.info/v1. The request shape matches the OpenAI specification, so existing Node.js code for TTS can be adapted easily by updating the endpoint and providing your Bearer token for authentication.

How do I handle long texts?

Split your text into parts of up to 4096 characters. Send each part as a separate request to the endpoint. Then, join the returned audio files. This approach ensures reliable synthesis for longer educational content. Requests are processed one after another, so under load a request may wait in a queue.

What headers are required?

You must include the Authorization header with your Bearer token: 'Authorization: Bearer tts-...'. The request body must be JSON containing model, input, voice, and response_format fields. Ensure the Content-Type is set to application/json. These headers and fields are required for successful synthesis and billing of your character usage.

Does the API support SSML?

No, the API does not support SSML. You pass plain text in the 'input' field. There are no SSML tags for prosody or pronunciation. If you need specific control, you must manage pacing and pauses by splitting text into separate requests or using the speed parameter to adjust the overall rate.

Can I stream the audio response?

No, the API does not support streaming or WebSocket connections. You receive the complete audio file in the response body after synthesis finishes. For real-time needs, you must implement client-side buffering or wait for the full file. The endpoint returns the file once processing is complete, which may take a few seconds.

First request

curl

curl https://api.f7casino.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.f7casino.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.f7casino.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

Get your API key

Sound wave illustration for: Get your API key

Access the /get-api-key/ page to register your account. You can authenticate via Google or create a standard email-based account. Each account is scoped to this specific site instance.

Sign up on /get-api-key/

Sign up on /get-api-key/

Navigate to the registration endpoint to initialize your developer workspace. The process is straightforward: provide your credentials to establish a unique account identifier for API access.

Use Google or email login

Use Google or email login

Select Google for immediate sign-in, which includes a $0.50 trial credit valid for 7 days. Alternatively, use email and password to start with a zero-balance account. Both methods create a single active key per session.

Copy key from dashboard

Upon successful authentication, retrieve your API key from the dashboard. This key, starting with tts-, authenticates all requests. Store it securely, as generating a new key immediately invalidates the previous one.

First request with cURL

Sound wave illustration for: First request with cURL

Generate synthetic speech for language learning materials by sending a POST request to the TTS endpoint. This method returns an audio file directly, allowing teachers to quickly produce listening exercises without manual recording.

POST to /v1/audio/speech

Send your request to https://api.f7casino.info/v1/audio/speech. The endpoint accepts JSON bodies containing the text to synthesize and configuration options for voice and format.

Include Authorization header

Authenticate your request using a Bearer token. Retrieve your unique key from the /get-api-key/ dashboard after signing in with Google or email.

  • Header: Authorization: Bearer tts-your-api-key-here

Send JSON body with text

Include the input field with your text (up to 4096 characters). Specify a voice from the eight available presets and your preferred response_format (e.g., mp3, wav).

  • ```json { "model": "tts-1", "input": "Hello, welcome to our English lesson.", "voice": "aria", "response_format": "mp3" } ```

OpenAI SDK integration

Sound wave illustration for: OpenAI SDK integration

Integrate the ClioSound API using the official OpenAI SDKs by pointing the client to our base URL. This approach allows you to generate audio for language learning materials using familiar code structures without adopting a proprietary client library.

Set base_url to api endpoint

Configure the SDK client to target https://api.f7casino.info/v1 instead of the default OpenAI endpoint. This redirects all requests to the ClioSound infrastructure while maintaining the standard request schema.

Use official OpenAI SDKs

The API implements the same request shape as the OpenAI speech endpoint. You can use any official OpenAI SDK (Python, Node.js, etc.) to handle the POST /v1/audio/speech calls seamlessly.

Change key in configuration

Replace the standard API key with your ClioSound key (format tts-...). Ensure the Authorization: Bearer header is correctly set for each request to authenticate against our rate limits and billing system.

Request parameters

Sound wave illustration for: Request parameters

Configure the synthesis parameters to define audio quality, content limits, and voice selection. The API accepts a JSON body with specific fields for model, input text, and voice identity.

Model: tts-1 or tts-1-hd

Select "tts-1" for standard quality or "tts-1-hd" for high-definition audio. Both models use the same underlying engine and incur identical pricing per character.

Input: text up to 4096 chars

Provide the text string in the input field. The maximum length is 4096 characters per request, including spaces and punctuation. For longer texts, split the content into chunks and join the resulting audio files.

Voice: 8 presets available

Choose from eight distinct voice presets tailored for clear speech. Options include female voices like aria and nova, or male voices like felix and atlas. Each voice supports all 23 available languages.

Set the voice parameter to one of these presets. If the language field is omitted, the system guesses the language from the script, defaulting to English for Latin text.

  • Aria (warm, clear narrator)
  • Felix (energetic, promo)
  • Atlas (neutral, news)
  • Luna (soft, storytelling)

Response formats

Sound wave illustration for: Response formats

Specify the desired output encoding via the response_format parameter. The API supports MP3, WAV, OPUS, FLAC, and PCM formats, allowing you to choose the best balance between file size and quality for your language learning materials.

MP3, WAV, OPUS, FLAC, PCM

Select MP3 for efficient storage and web delivery, or WAV/FLAC for lossless quality suitable for professional editing. OPUS offers high compression with good clarity, while PCM provides raw, uncompressed audio data for immediate processing.

  • MP3: Standard compressed audio, ideal for web playback
  • WAV/FLAC: Lossless formats for archival or editing
  • OPUS: Efficient compression format
  • PCM: Raw uncompressed audio data

Audio file returned directly

The API response contains the audio file directly in the body. No additional download steps are required; simply parse the response to save or play the generated speech immediately.

No streaming support

The API does not support streaming or WebSocket connections. Audio is generated entirely before the response is sent. For real-time partial audio, you must implement client-side splitting and concatenation logic.

Response formats

Rate limits

Sound wave illustration for: Rate limits

Rate limits apply per API key to ensure stable generation for your language learning resources. The system processes requests sequentially, meaning high-volume usage may introduce slight delays depending on current load.

60 requests per minute

Once your account is funded, you are allowed up to 60 requests per minute. This limit is enforced to maintain consistent audio synthesis quality and server stability for all users.

10 requests before top-up

New accounts start with a lower limit of 10 requests per minute. This applies until you complete your first top-up via USDT (TRC-20). The limit increases automatically once the transfer is confirmed.

Queueing under load

Requests are processed one after another, so under load a request may wait in a queue. If many users are generating audio simultaneously, your request may wait in a queue. Longer texts take more time to synthesize, potentially affecting throughput.

  • Typical speed: ~25 characters per second
  • Short phrases take a few seconds

Error handling

Sound wave illustration for: Error handling

Errors are returned as standard HTTP status codes with a JSON body. Each response includes an error code and message to help you debug integration issues quickly without guessing the cause of failure.

The API distinguishes between authentication failures, throttling events, and malformed input. Use these codes to implement robust retry logic and user notifications in your language learning applications.

401 for invalid key

The request is rejected if the Authorization header contains an incorrect or expired API key. Ensure you copied the key from the dashboard on /get-api-key/ and that it starts with tts-. If you issued a new key, the old one becomes invalid immediately.

429 for rate limit

You receive this status when exceeding 60 requests per minute per key. New accounts without a top-up are limited to 10 requests per minute. Requests may also queue under load, causing delays. Implement exponential backoff to handle these limits gracefully.

400 for bad request

This error indicates invalid input parameters. Common causes include an input field exceeding 4096 characters, an unknown voice preset, or an unsupported response_format. Check the JSON body structure and ensure the text length fits within the single-request limit.

Audio generation limits

Sound wave illustration for: Audio generation limits

The API enforces a strict 4096-character limit per request, counting spaces and punctuation. For longer texts, you must split the input manually into smaller chunks before sending them to the endpoint. Each chunk generates a separate audio file, requiring careful handling to maintain synchronization and narrative flow across the final output.

You are responsible for managing the segmentation logic in your application. While the API processes requests sequentially, splitting allows you to handle texts exceeding the single-request limit efficiently without waiting for a single massive synthesis job to complete.

4096 characters max per call

Every request is capped at 4096 characters. This limit includes all spaces, punctuation, and special characters within the input field. Exceeding this count results in a 400 Bad Request error. For language learning materials, this typically covers short sentences or brief dialogue exchanges suitable for listening exercises.

  • Count includes spaces and punctuation
  • Returns 400 error if exceeded
  • Suitable for short sentences or dialogues

Split long texts manually

Clients must divide long texts into chunks of 4096 characters or less before sending POST requests. This approach allows you to control pacing and ensure consistent voice delivery across segments. It is particularly useful for generating audio for textbook chapters or extended reading passages.

  • Divide text into <4096 char chunks
  • Control pacing and voice consistency
  • Ideal for textbook chapters or passages

Join audio files server-side

After receiving multiple audio files from separate requests, you must concatenate them in your backend or client application to produce a single continuous file. The API does not handle stitching. This gives you full control over the final audio format and ensures no gaps or overlaps if you implement proper silence padding.

  • Concatenate in your own logic
  • API returns separate files
  • Control final format and gaps

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This transparency simplifies cost tracking for educational budgets.

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. openai-python on GitHub
  3. Node.js documentation
  4. IETF RFC 7845: Ogg Opus
  5. openai-node on GitHub
  6. TRON developer hub: TRC-20
  7. LibriTTS-R paper (arXiv 2305.18802)
  8. MDN: Web Speech API
  9. Creative Commons Attribution 4.0
  10. LibriVox public-domain audiobooks
  11. W3C WAI: making audio and video accessible
  12. OpenAI API reference: create speech

More on this site