API Documentation for Text-to-Speech Integration

By SpeakFlow editorial team · Updated 2026-11-18

This guide helps no-code course creators generate audio files for LMS platforms using a simple cloud API. You will learn how to convert your scripts into spoken audio with reliable, character-based pricing and straightforward integration steps. The documentation covers everything from obtaining your API key to handling responses, ensuring you can build workflows without complex infrastructure.

You can use the official OpenAI SDKs by adjusting the base URL, making this compatible with tools you likely already know. We explain the available models, voice presets, and supported languages so you can match your content’s tone. Each section includes concrete examples, helping you integrate text-to-speech into your course production pipeline quickly and accurately.

API Documentation for Text-to-Speech Integration

Frequently asked questions

What is the API endpoint?

Send a POST request to https://api.play66f.com/v1/audio/speech. The JSON body follows the same shape as the OpenAI speech endpoint, making it easy to integrate with existing tools that already support standard TTS structures.

How do I get an API key?

Sign up on the /get-api-key/ page using Google or an email and password. The dashboard displays your active Bearer key, allowing you to start making requests immediately without waiting for manual approval or setup.

Can I use the OpenAI SDK?

Yes. The API uses the same request shape as OpenAI. You can use the official OpenAI SDK by changing the base_url to https://api.play66f.com/v1 and providing your SpeakFlow key in the Authorization header.

What is the rate limit?

You are limited to 60 requests per minute per key. New accounts start with a lower limit of 10 requests per minute until you make your first top-up. Requests are processed sequentially, so high load may cause queuing.

How do I specify a voice?

Include the voice name in the request body. Available presets are aria, nova, luna, sage, felix, milo, atlas, and orion. Each voice can speak any of the 23 supported languages without needing specific configuration for language switching.

What formats are available?

You can choose from mp3, wav, opus, flac, or pcm by setting the response_format field. These formats cover most LMS and audio player requirements, ensuring compatibility with standard media players and course platforms.

How do I handle long texts?

Split your text into parts of up to 4096 characters. Generate audio for each part separately, then join the resulting audio files. This ensures each request stays within the character limit and processes efficiently.

What are the error codes?

The API returns standard HTTP status codes. If synthesis fails, the charge is returned in full. Check your response status and message to understand why a request did not succeed.

Is the SDK official?

There is no official SpeakFlow SDK. You should use the official OpenAI SDK or plain HTTP requests. The API is compatible with the OpenAI client library by adjusting the base URL and authentication header.

How do I set the language?

Include the optional language field with an ISO code. If omitted, the system guesses the language from the script, defaulting to English for Latin text. Set it explicitly for non-English Latin-script texts to ensure accuracy.

What is the speed range?

Adjust the speed between 0.25 and 4.0. This allows you to slow down narration for clarity or speed up content for quick reviews. The default speed provides a natural pacing suitable for most educational materials.

Can I use multiple keys?

Each account has one active key. You can issue a new key at any time, but the old one stops working immediately. This ensures secure access control without managing multiple concurrent active credentials for a single account.

How do I split text?

Divide your input into chunks of 4096 characters or fewer. Send each chunk as a separate POST request to the speech endpoint. After receiving all audio files, concatenate them to create the final course audio.

What is the character limit?

Each request accepts up to 4096 characters in the input field. Spaces and punctuation count toward this limit. For longer scripts, split the text into multiple requests to generate the complete audio file.

First request

curl

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

Sign up for an account on play66f.com using Google or an email and password. This creates your independent storefront account. Once registered, you can generate your API key to start making requests immediately.

Your key is displayed in the dashboard alongside your balance and character usage. Use the key in the Authorization: Bearer header for all API calls. Keep it secure and share it only with your LMS integration tools.

Sign up on the site

Sign up on the site

Visit the registration page to create your account. You can sign in with Google for instant access or use a standard email and password. Google sign-ins receive a $0.50 free trial credit valid for 7 days. Email accounts start without trial credit.

  • Google sign-in: instant access + $0.50 trial
  • Email/password: standard account creation
  • No credit card required

View key in dashboard

View key in dashboard

After logging in, navigate to the dashboard to view your active API key. The dashboard also shows your current balance, characters remaining, and a ready-to-use cURL example. This is where you monitor your usage and spending.

  • View active API key
  • Check balance and characters
  • Copy cURL example

Regenerate key if needed

You can issue a new API key at any time from the dashboard. When you generate a new key, the previous one stops working immediately. This is useful if you suspect your key has been exposed or if you are rotating credentials for security.

  • Generate new key anytime
  • Old key stops immediately
  • No downtime during rotation

Make your first request

Sound wave illustration for: Make your first request

Send a POST request to the speech endpoint with your JSON payload. The API returns an audio file directly in the response body, ready for immediate download or storage in your LMS media library.

Ensure your text does not exceed 4096 characters per request. For longer course scripts, split the text into chunks and join the resulting audio files sequentially.

Endpoint URL structure ['Direct your POST request to https://api.play66f.com/v1/audio/speech. This standard REST endpoint accepts JSON payloads and returns audio data.', {'h3': 'JSON body format', 'paras': ['The request body must be valid JSON containing the model identifier, input text, voice selection, and desired audio format. Use the standard structure compatible with OpenAI SDKs for easy integration.', 'Example structure includes keys for model, input, voice, and response_format. Ensure special characters in your script are properly encoded within the JSON string.']}, {'h3': 'Required fields', 'paras': ['You must provide the model (tts-1 or tts-1-hd), input (your text up to 4096 characters), and voice (one of the 8 presets). The response_format is also required to specify MP3, WAV, OPUS, FLAC, or PCM.', 'Include the Authorization: Bearer tts-... header with your API key. The language field is optional; if omitted, the system guesses the language from the script, defaulting to English for Latin text.']}] A clean, minimal illustration of a computer screen displaying a JSON code snippet being sent to a server, with a small audio waveform icon appearing as output, suitable for online course creators.

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

The SpeakFlow API is compatible with the official OpenAI SDKs, requiring only a base URL adjustment. This allows you to use familiar libraries without rewriting your integration logic. Simply point the client to our API endpoint and authenticate with your Bearer token.

This approach works for Python, Node.js, and other supported languages. You retain the convenience of the standard SDK methods while leveraging our character-based pricing and voice presets.

Change base URL

Set the base_url to https://api.play66f.com/v1 in your SDK configuration. This redirects all requests to our infrastructure while maintaining the standard request shape.

Ensure the version path remains /v1 to match the expected endpoint structure for speech synthesis.

  • Use https://api.play66f.com/v1 as the base URL.
  • Keep the standard /audio/speech endpoint path.

Use official SDKs

Any official OpenAI SDK works out of the box. This includes Python, JavaScript, and Go clients.

You can use the same code structure for speech generation, adjusting only the authentication and base URL parameters.

  • Python SDK
  • JavaScript SDK
  • Go SDK

Header configuration

Include your API key in the Authorization header as Bearer tts-.... This authenticates your requests and tracks your character usage against your balance.

Ensure the header format matches the standard Bearer token structure used by the OpenAI SDKs.

  • Authorization: Bearer tts-<your-key>
  • Standard Bearer token format

Supported models

Sound wave illustration for: Supported models

The API offers two model variants that share the same underlying engine and voice capabilities. Both models accept the same input text up to 4096 characters and support all eight voice presets across 23 languages. You can switch between them based on your quality preferences without changing your integration logic.

tts-1 model

The standard model provides fast synthesis suitable for most course content. It generates audio at roughly real-time speed, making it ideal for bulk production of lesson audio files. This model handles the full range of voice styles from warm narrators to energetic promo tones.

tts-1-hd model

The high-definition model delivers enhanced audio quality. Typical speed is roughly real time on long texts, but short phrases take a few seconds and requests are processed one after another. Use this variant when clarity is critical for educational material or when producing premium course assets. It supports all the same voices and languages as the standard model.

Same price for both

Both models are priced identically at $10 per 1 million characters. You can test the HD model with your free trial credit to compare audio quality against the standard model without incurring extra costs. Billing is based on character count, not model selection.

Voice selection

Sound wave illustration for: Voice selection

Select a voice preset that matches your course tone. The API supports eight distinct voices, ranging from warm narrators to neutral news readers, all capable of speaking any of the 23 supported languages.

List available voices

Choose from female voices like Aria (clear narrator) or Luna (soft storytelling), and male options such as Felix (energetic) or Atlas (neutral). Each voice offers a different delivery style suitable for educational content.

  • Aria: warm, clear narrator
  • Nova: bright, upbeat
  • Luna: soft, storytelling
  • Sage: calm, instructional
  • Felix: energetic, promo
  • Milo: friendly, conversational
  • Atlas: neutral, news
  • Orion: deep, documentary

Voice presets

Presets are based on licensed recordings from LibriTTS-R. They provide consistent, reliable audio output without the need for manual tuning. Select the preset that best fits your script's pacing.

Language hints

Any voice can speak any of the 23 supported languages. If you omit the language field, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script text, explicitly set the language parameter to ensure accuracy.

Voice selection

Audio formats

Sound wave illustration for: Audio formats

Select your preferred audio format via the response_format field in the JSON body. We support MP3, WAV, Opus, FLAC, and PCM to suit different LMS player requirements and storage constraints.

MP3 output

MP3 is the default and most compatible format for web players and learning management systems. It offers a good balance between file size and quality for typical course narration.

WAV output

Choose WAV for uncompressed, high-fidelity audio. This format is ideal if your LMS requires lossless audio or if you plan to edit the narration further in a DAW.

Opus, FLAC, PCM

Opus provides efficient compression. FLAC offers lossless compression. PCM delivers raw, uncompressed audio data.

Rate limits

Sound wave illustration for: Rate limits

SpeakFlow enforces a request rate limit of 60 per minute per API key. This limit applies to all synthesis endpoints and ensures stable processing for your course audio generation workflows. If you exceed this threshold, additional requests will be rejected until the window resets.

60 requests per minute

Once you have topped up your account, you can send up to 60 requests per minute. Requests are processed one after another, so under load a request may wait in a queue.

  • Limit resets every 60 seconds.
  • Applies per API key, not per IP.

10 requests before top-up

New accounts starting with the free trial credit are limited to 10 requests per minute. This ensures fair usage during the trial period while you test integration with your LMS.

  • Applies only to accounts without a USDT top-up.
  • Increases to 60/min after funding.

Queue behavior

Requests are processed sequentially. Under heavy load, your request may wait in a queue before synthesis begins. This can slightly increase total processing time for large batches, but each request is handled individually.

  • No guaranteed sub-second latency for bulk jobs.
  • Requests are processed one after another.

image":

Error handling

Sound wave illustration for: Error handling

When synthesis fails, you receive a standard HTTP error code. The response body includes a specific error message explaining the cause, such as invalid input or rate limits. Check your request format and character count to resolve common issues before retrying.

Use exponential backoff when retrying failed requests, especially under load. Since requests are processed sequentially, a temporary queue delay may cause transient failures. Wait a few seconds between retries to avoid hitting rate limits again or overwhelming the server.

Common error codes

The API returns standard HTTP status codes. A 400 error indicates invalid JSON or missing fields. A 429 error means you have exceeded the rate limit of 60 requests per minute. A 500 error suggests a temporary server issue.

  • 400: Invalid request format or parameters
  • 401: Unauthorized or invalid API key
  • 429: Rate limit exceeded
  • 500: Internal server error

Retry logic

Implement retry logic with exponential backoff for 429 and 500 errors. Wait 1–2 seconds before the first retry, doubling the wait time for subsequent attempts.

This approach handles queue delays effectively. Requests are processed one after another, so short waits prevent repeated failures during high load periods.

Free failed requests

If synthesis fails, the charge is returned in full. You are only billed for successful audio generation. Failed requests do not deduct from your balance.

This ensures you only pay for usable audio files. Check the response status to confirm whether a request was charged or refunded.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. This approach avoids the complexity of custom voice cloning while providing high-quality, consistent synthetic speech.

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. Creative Commons Attribution 4.0
  3. OpenAI API reference: create speech
  4. MDN: Web Speech API
  5. curl documentation
  6. FFmpeg documentation
  7. Tether (USDT)
  8. LibriVox public-domain audiobooks
  9. openai-python on GitHub
  10. LibriTTS-R paper (arXiv 2305.18802)
  11. IETF RFC 7845: Ogg Opus
  12. Python documentation

More on this site