API Documentation for Text to Speech Synthesis

By Mindful Synth editorial team · Updated 2026-11-18

This documentation explains how to integrate Mindful Synth’s text-to-speech API into your fitness and meditation applications. You will learn to generate natural audio from scripts using standard HTTP requests, compatible with existing OpenAI SDKs. The guide covers authentication, endpoint structures, and parameter settings for voices, formats, and speed, ensuring you can produce clear narration for guided meditations or workout cues.

Designed for startups scaling their user base, this reference helps developers handle rate limits, manage API keys, and process long texts efficiently. We provide concrete examples in cURL, Python, and JavaScript, along with details on voice selection and language support. Whether you need calm instructional tones or energetic promo audio, this page gives you the technical specifics to build reliable, scalable audio features without unnecessary complexity.

API Documentation for Text to Speech Synthesis

Frequently asked questions

How do I get an API key?

Sign up on the /get-api-key/ page using Google or email and password. Your account is specific to this site. Once registered, you can view your active API key, balance, and usage details directly on the dashboard.

What is the base URL for the API?

The API base URL is https://api.king1app.com/v1. You send POST requests to https://api.king1app.com/v1/audio/speech for speech synthesis. Other endpoints like /v1/voices are also accessible via this base URL.

Which SDKs are compatible?

The request shape matches the OpenAI speech endpoint. Official OpenAI SDKs work by changing the base_url to https://api.king1app.com/v1 and using your site key. You can also use plain HTTP requests.

How do I handle long texts?

Split your text into parts of up to 4096 characters per request. Generate audio for each part individually, then join the resulting audio files together. This ensures compatibility with the character limit per request.

What are the rate limits?

You are limited to 60 requests per minute per key. Before your first top-up, the limit is 10 requests per minute. Requests are processed sequentially, so high load may cause queuing delays.

How many requests per minute?

The standard limit is 60 requests per minute per API key. If you have not topped up your account yet, the limit is lower at 10 requests per minute.

What response formats are supported?

You can choose from mp3, wav, opus, flac, and pcm formats. Specify the desired format using the response_format field in your JSON request body to receive the audio file in your preferred encoding.

Can I use MP3 format?

Yes, MP3 is a supported response format. Include "mp3" in the response_format field of your request. Other supported formats include wav, opus, flac, and pcm for different use cases.

How do I select a voice?

Choose from eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. Select the voice name in the voice field of your request. Each voice has a distinct tone suitable for meditation or fitness content.

What happens if the API is slow?

Requests are processed sequentially. Under load, your request may wait in a queue. Typical speed is roughly real-time, but short phrases may take a few seconds to generate. Longer texts scale with user growth.

How do I handle errors?

If synthesis fails, the charge is returned in full. Check your request parameters, such as text length and voice validity. Failed requests incur no cost, so you can retry without worrying about balance deduction.

Is authentication required?

Yes, authentication is required. Include an Authorization header with your Bearer token: Authorization: Bearer tts-... Use your unique API key obtained from your account dashboard to authorize each request to the API.

Can I issue a new API key?

Yes, you can issue a new API key at any time. Navigate to your account settings on the site. A new key can be generated to replace your current active key for security or rotation purposes.

What happens to the old key?

When you issue a new key, the old one stops working immediately. Only one key is active per account at any given time. Ensure you update your applications to use the new key promptly.

First request

curl

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

Authentication

Sound wave illustration for: Authentication

Access the Mindful Synth API by including your unique API key in the request header. This key authenticates your account and tracks your character usage against your current balance.

API Key Format

API Key Format

Your API key is a string starting with "tts-" followed by alphanumeric characters. You can view your active key on the /get-api-key/ dashboard page alongside your current balance and usage statistics.

Bearer Token Usage

Bearer Token Usage

Include the key in the Authorization header using the standard Bearer scheme: Authorization: Bearer tts-.... Ensure no extra spaces or characters are added to the token value to avoid authentication errors.

Key Management

Each account maintains one active key at a time. You can issue a new key from your dashboard at any time; the previous key stops working immediately, ensuring secure access control for your meditation app integrations.

Endpoints Overview

Sound wave illustration for: Endpoints Overview

Mindful Synth exposes three core REST endpoints to handle audio synthesis, voice discovery, and model selection. These endpoints follow standard patterns, allowing you to integrate seamlessly with existing infrastructure using simple HTTP requests.

Speech Endpoint

The POST /v1/audio/speech endpoint converts your input text into audio files. Send a JSON body containing the model, input text, voice, and desired format. The service returns the audio file directly in the response body.

  • Endpoint: POST /v1/audio/speech
  • Supports JSON body with standard fields
  • Returns audio data directly

Voices Endpoint

Use GET /v1/voices to retrieve a list of available voices, their associated languages, supported formats, and pricing details. This endpoint helps you select the right tone for your meditation or fitness app before making synthesis requests.

  • Endpoint: GET /v1/voices
  • Returns voice metadata and pricing
  • Lists supported languages and formats

Models Endpoint

The GET /v1/models endpoint provides information about the underlying TTS models. Currently, it lists "tts-1" and "tts-1-hd," which share the same engine and price point, allowing you to standardize your API calls across different quality tiers if needed.

  • Endpoint: GET /v1/models
  • Lists tts-1 and tts-1-hd
  • Shares engine and pricing

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts plain text input for synthesis, with a strict limit of 4,096 characters per request. Spaces and punctuation count toward this total, so plan your payload accordingly.

Input Text Limit

Each API call processes a single text block up to 4,096 characters. If your script exceeds this, split the text into chunks and join the resulting audio files afterward.

Voice Selection

Choose from eight preset voices, such as Aria for warm narration or Felix for energetic promos. Select the voice parameter from the available list, and optionally specify the language ISO code to ensure correct pronunciation.

  • aria: Warm, clear narrator
  • felix: Energetic, promo
  • luna: Soft, storytelling
  • atlas: Neutral, news

Response Format

Specify the audio format using the response_format parameter. Supported options include mp3, wav, opus, flac, and pcm. This allows you to optimize file size and compatibility for your fitness or meditation app.

  • mp3: Universal compatibility
  • wav: High quality, uncompressed
  • opus: Efficient compression

Rate Limits

Sound wave illustration for: Rate Limits

Mindful Synth ensures fair usage with a base limit of 60 requests per minute per API key. New accounts start with a stricter 10 requests per minute until the first top-up is processed.

Requests Per Minute

Each active key allows up to 60 synthesis requests per minute. This limit applies globally to all requests sent from that key, regardless of voice or format.

  • Standard limit: 60 requests/minute
  • Initial limit: 10 requests/minute until first top-up

Queue Behavior

Requests are processed sequentially. If you exceed the rate limit or send many concurrent requests, subsequent requests will wait in a queue until capacity is available.

  • Requests are processed one after another
  • Queuing occurs under high load

Retry Strategy

Implement exponential backoff for retries. Since requests may be queued, immediate retries can exacerbate congestion. Wait briefly before retrying to allow the queue to clear.

Response Codes

Sound wave illustration for: Response Codes

The API returns standard HTTP status codes to indicate the result of your synthesis request. Understanding these responses helps you handle success and failure cases efficiently in your fitness or meditation app.

Success Response

A 200 OK response includes the generated audio file in the requested format (mp3, wav, opus, flac, or pcm). The response header contains the character count processed, allowing you to track billing accurately against your balance.

  • Status code: 200
  • Body: Binary audio data
  • Header: X-Characters-Processed

Error Handling

Common errors include 400 Bad Request for invalid parameters (e.g., unsupported voice) or 401 Unauthorized for invalid API keys. Failed synthesis attempts are free, so you will not be charged for these errors.

  • 400: Invalid input or voice
  • 401: Invalid or expired key
  • 429: Too many requests

Rate Limit Exceeded

When you exceed 60 requests per minute, the API returns a 429 Too Many Requests error. Implement exponential backoff in your retry logic to handle queue delays gracefully during peak usage.

  • Limit: 60 req/min
  • Code: 429
  • Action: Exponential backoff
Response Codes

Code Examples

Sound wave illustration for: Code Examples

The API accepts standard JSON payloads, making integration straightforward for any developer. You can test the endpoint immediately with a simple command or integrate it into your app’s backend using your preferred language.

All examples below use the tts-1 model. Replace YOUR_API_KEY with your key from the dashboard. The base URL is https://api.king1app.com/v1.

cURL Example

Send a request and save the output to speech.mp3:

curl -X POST "https://api.king1app.com/v1/audio/speech" \

-H "Authorization: Bearer YOUR_API_KEY" \

-H "Content-Type: application/json" \

-d '{"model": "tts-1", "input": "Focus on your breath.", "voice": "sage", "response_format": "mp3"}' \

-o speech.mp3

OpenAI SDK Example

Use the official OpenAI SDK by pointing it to our base URL:

import openai

client = openai.OpenAI(base_url="https://api.king1app.com/v1", api_key="YOUR_API_KEY")

response = client.audio.speech.create(

model="tts-1", voice="nova", input="Stay consistent, your progress matters.", response_format="mp3")

response.write_to_file("meditation.mp3")

Python Example

For direct control, use requests to handle the stream:

import requests

url = "https://api.king1app.com/v1/audio/speech"

headers = {"Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}

data = {"model": "tts-1", "voice": "aria", "input": "You are capable of great things.", "response_format": "mp3"}

response = requests.post(url, headers=headers, json=data)

with open("motivation.mp3", "wb") as f:

f.write(response.content)

Long Text Handling

Sound wave illustration for: Long Text Handling

Long-form meditation scripts or guided fitness routines often exceed the 4,096-character limit per request. The API requires you to split the input text into smaller chunks before sending them sequentially.

Character Splitting

Divide your script into segments of up to 4,096 characters each. Ensure you split at natural pauses or sentence boundaries to maintain audio continuity. Spaces and punctuation count toward this limit.

Audio Joining

Each API call returns a distinct audio file. You must concatenate these files in the exact order of your original text segments to reconstruct the full audio track. There is no built-in stitching on the server side.

  • Process segments in order to preserve narrative flow.
  • Concatenate files using your preferred audio library or tool.

Latency Considerations

Requests are processed sequentially, so multiple segments may queue under load. Generation speed is roughly real-time (25 characters per second), but short phrases may take a few seconds per call. Plan your client-side logic to handle these delays gracefully without blocking the user experience.

Voice Selection

Sound wave illustration for: Voice Selection

Mindful Synth provides eight distinct voice presets designed to match the diverse tonal needs of fitness and meditation applications. Each voice is grounded in licensed recordings, ensuring a consistent, professional audio experience for your users.

Available Voices

Select from four female and four male voices, ranging from warm narrators like Aria to energetic promo voices like Felix. Each preset offers a specific character suitable for different content types, from guided meditations to high-intensity workout cues.

  • 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

Language Compatibility

Every voice can speak any of the 23 supported languages, allowing you to maintain a consistent audio brand across global markets. If the language parameter is omitted, the system guesses the language from the script, defaulting to English for Latin text.

  • Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, Turkish

Tone Matching

Choose voices that align with your app’s vibe. Use Atlas for neutral updates or Orion for deep, documentary-style narration. The API supports speed adjustments from 0.25x to 4.0x, letting you fine-tune the pacing to match the energy of your content.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Failed requests are free, so you only pay for successfully generated audio files.

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

More on this site