Frequently asked questions
How do I get an API key?
Visit /get-api-key/ to sign up using Google or an email and password. Your account page displays your unique API key, current balance, and usage statistics. You can also issue a new key at any time, which immediately invalidates the previous one.
What is the base URL for the API?
The API base URL is https://api.bagan7login.com/v1. You send requests to the /audio/speech endpoint using POST. This URL structure allows you to use standard HTTP clients or compatible SDKs by simply updating your base URL configuration.
Which model should I use?
Choose between "tts-1" and "tts-1-hd". Both models use the same engine and incur identical pricing. Select based on your quality preference, as both deliver natural-sounding audio suitable for guided meditation sessions without any difference in cost or character limits.
Can I change the voice after sending the request?
No, you must specify the voice in the request body before sending it. The voice parameter accepts one of eight presets like aria, nova, or atlas. Once the synthesis job is submitted, the voice is locked for that specific audio generation.
How do I handle rate limits?
You are limited to 60 requests per minute per key, or 10 per minute before your first top-up. If you exceed this, requests may queue or fail. Monitor your usage via the dashboard to ensure smooth generation for your meditation app.
What happens if the text exceeds 4096 characters?
Split your input text into chunks of up to 4096 characters. Generate audio for each part individually, then join the resulting audio files together. This approach ensures high-quality synthesis while staying within the single-request character limit defined by the API.
Is the OpenAI SDK compatible?
Yes, the official OpenAI SDKs work by changing the base URL to https://api.bagan7login.com/v1. Use the standard speech endpoint and your API key. This compatibility allows you to integrate quickly without writing custom HTTP clients or learning a new library.
How do I specify a language?
Include the optional "language" field with an ISO code in your request body. If omitted, the system guesses the language from the script, defaulting to English for Latin text. Explicitly setting it ensures correct pronunciation for non-English languages like German or Japanese.
Can I request a specific audio format?
Yes, use the "response_format" field to choose between mp3, wav, opus, flac, or pcm. MP3 and WAV are ideal for meditation apps due to broad compatibility. Select the format that best fits your application’s storage and playback requirements.
What is the speed parameter range?
The speed parameter accepts values between 0.25 and 4.0. This allows you to adjust the pacing of the narration to suit different meditation styles. Lower speeds create a calmer atmosphere, while higher speeds can be used for energetic fitness guidance.
Are there any limits on the number of voices?
There are no limits on how many voices you can use. You have access to eight presets: aria, nova, luna, sage, felix, milo, atlas, and orion. You can switch between any voice for each request to diversify your audio content.
How do I renew my API key?
You can issue a new API key at any time from your account page. The new key becomes active immediately, and the old one stops working at once. This is useful for security rotations without interrupting your ongoing synthesis jobs.
What is the difference between tts-1 and tts-1-hd?
Both models use the same engine and have identical pricing at $10 per million characters. The choice is purely based on audio quality preference. Both deliver natural-sounding speech suitable for meditation and fitness applications without any difference in cost.
Do I need to pay for each request?
You pay based on the character count of successful requests. Failed requests are free, with the charge returned in full. The rate is $0.01 per 1,000 characters, including spaces and punctuation. You can top up using USDT on the TRON network.
First request
curl
curl https://api.bagan7login.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.mp3Python (openai)
from openai import OpenAI
client = OpenAI(base_url="https://api.bagan7login.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.bagan7login.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 | |
|---|---|
aria | female |
nova | female |
luna | female |
sage | female |
felix | male |
milo | male |
atlas | male |
orion | male |
| language | |
|---|---|
ar | العربية |
zh | 中文 |
da | Dansk |
nl | Nederlands |
en | English |
fi | Suomi |
fr | Français |
de | Deutsch |
el | Ελληνικά |
he | עברית |
hi | हिन्दी |
it | Italiano |
ja | 日本語 |
ko | 한국어 |
ms | Bahasa Melayu |
no | Norsk |
pl | Polski |
pt | Português |
ru | Русский |
es | Español |
sw | Kiswahili |
sv | Svenska |
tr | Türkçe |
Authentication
MindfulSpeech uses a simple API key system to secure your meditation audio generation. You receive one active key per account, which you can use across all your fitness startup projects. This key identifies your account and tracks your character usage against your balance.
The key format begins with tts- followed by a unique string. Keep this value secure in your environment variables or configuration files to prevent unauthorized usage of your generated audio files.
API Key Format
Your API key is a single string starting with tts-. It is generated when you sign in via Google or email on the /get-api-key/ page. This key is the sole credential needed for all API requests.
- Keys start with
tts- - One active key per account
- Visible on the dashboard
Bearer Token Usage
Include your key in the HTTP header as a Bearer token. Use the format Authorization: Bearer tts-.... This standard method ensures your requests are authenticated before processing.
Key Management
You can issue a new key at any time from your dashboard. When you do, the old key stops working immediately. This is useful if you suspect exposure or need to rotate credentials for your meditation app backend.
Endpoints Overview
The API provides three primary endpoints for integrating text-to-speech into your meditation or fitness application. These endpoints allow you to generate audio, explore available voice presets, and verify model details using standard HTTP methods.
Speech Endpoint
Use POST https://api.bagan7login.com/v1/audio/speech to convert text into audio files. Send a JSON body containing your text, selected voice, and desired format. The endpoint returns the audio file directly in the response body.
- Endpoint: POST /v1/audio/speech
- Input: JSON body with text, voice, and format parameters
- Output: Audio file in selected format (mp3, wav, opus, etc.)
Voices List
Retrieve available voice presets using GET https://api.bagan7login.com/v1/voices. This endpoint returns a list of eight distinct voices, including options like Aria for warm narration or Milo for conversational tones, along with their supported languages and formats.
- Endpoint: GET /v1/voices
- Returns: List of voice presets, languages, and formats
- Use case: Selecting the ideal voice for guided sessions
Models Info
Check available models with GET https://api.bagan7login.com/v1/models. This endpoint provides information about the tts-1 and tts-1-hd models, allowing you to choose the appropriate engine based on your quality and performance needs.
- Endpoint: GET /v1/models
- Returns: Model details and capabilities
- Use case: Verifying model availability and specifications
Request Parameters
Configure your API requests by selecting the synthesis model, defining the input text, and choosing a voice preset. These parameters determine the audio quality, length, and tonal character of the generated meditation or fitness audio.
Model Selection
Choose between tts-1 for standard efficiency or tts-1-hd for higher fidelity. Both models use the same engine and pricing, so select tts-1-hd when nuanced vocal textures enhance the user experience in guided sessions.
Input Text Limit
Each request accepts up to 4096 characters, including spaces and punctuation. For longer scripts, split the text into chunks and join the resulting audio files. Short phrases may take a few seconds to generate.
Voice Selection
Select from eight presets tailored for clarity and calm. Use luna for soft storytelling or sage for instructional content. Ensure the chosen voice aligns with the serene tone of your meditation app without hiring additional actors.
Response Formats
The API returns the generated audio file directly in the response body. You can choose from four supported formats depending on your app’s needs: MP3, WAV, OPUS, or FLAC.
MP3 Audio
MP3 is a supported format that offers a balance between quality and file size. It is ideal for mobile meditation apps where bandwidth conservation matters. The resulting files are small enough for quick loading while maintaining clear, soothing narration for guided sessions.
WAV Audio
WAV provides uncompressed, high-fidelity audio. Use this format if you need raw audio data for editing or if your platform requires lossless quality. The files will be larger than MP3, but they preserve every detail of the voice synthesis without compression artifacts.
OPUS Audio
OPUS is a modern, highly efficient codec that delivers excellent quality at low bitrates. It is suitable for web-based players and modern mobile environments. This format ensures smooth playback even on slower connections, keeping the user experience serene and uninterrupted.
Speed Adjustment
Adjust the speed parameter (0.25–4.0) to control voice pacing. The default is 1.0. Lower values slow the voice, ideal for guided meditation. Higher values speed it up for quick tutorials.
Range 0.25 to 4.0
Set any float between 0.25 and 4.0 in your request. The API accepts this value directly. It scales the audio generation rate proportionally. Use precise decimals for fine-tuning.
Slower for Meditation
Use 0.75–0.9 for calm sessions. This range creates a serene atmosphere. It helps users relax and focus. Match the pace to your script's breathing cues.
- Recommended: 0.8 for deep relaxation
- Use 0.9 for gentle transitions
Faster for Tutorials
Use 1.2–1.5 for instructional content. This keeps energy high and concise. Ideal for quick fitness tips or app navigation guides. Avoid speeds above 2.0 for clarity.
- Recommended: 1.3 for standard tutorials
- Use 1.5 for rapid updates

Language Support
MindfulSpeech supports 23 languages, including English, Spanish, Hindi, and Japanese. Any voice can speak any supported language, allowing you to create inclusive guided meditation sessions for global audiences without managing multiple voice models. The API handles the linguistic nuances, ensuring natural pronunciation across diverse scripts.
ISO Code Usage
For non-English Latin-script text, explicitly set the language field. This ensures accurate pronunciation and prevents misinterpretation of words that might sound similar in other languages. For example, use "es" for Spanish or "hi" for Hindi to guarantee the voice speaks the intended language correctly.
- Supported codes: en, es, hi, fr, de, ja, ko, zh, ar, ru, pt, it, pl, tr, sv, da, fi, no, el, he, ms, sw, nl
Auto-Detection
If the language field is omitted, the system guesses the language based on the text script. Latin text defaults to English, while Cyrillic or CJK characters trigger the appropriate language model. This works well for simple scripts but may fail for mixed-language content.
Default English
English is the default for any Latin-script input lacking a language code. If you provide text in German or French without specifying language, it will be generated in English. Always define the language parameter for non-English content to maintain audio quality and clarity.
Error Handling
Understanding error responses helps you build resilient meditation and fitness apps. Our API returns standard HTTP status codes so you can programmatically handle issues like network hiccups or invalid parameters without interrupting the user experience.
We prioritize clear feedback so you can adjust your integration quickly. Below is how to handle the most common scenarios you might encounter during integration.
Rate Limit Errors
You may receive a 429 status code if you exceed 60 requests per minute. New accounts start with a lower limit of 10 requests per minute until the first top-up is processed.
Implement exponential backoff in your integration. This ensures your guided sessions load smoothly without overwhelming the queue during peak usage times.
- Status code: 429 Too Many Requests
- Limit: 60 requests/minute (10 for new accounts)
- Include
Retry-Afterheader in response
Invalid Input
Errors here usually mean the text exceeds 4096 characters or the voice ID is unknown. Ensure you split longer scripts into smaller parts before sending them to the API.
Check that your language ISO code matches one of the 23 supported languages. If omitted, the system guesses from Latin script, defaulting to English.
- Text limit: 4096 characters per request
- Check
voiceagainst /v1/voices - Verify
languageISO codes
Server Errors
If synthesis fails, the charge is returned in full. You will receive a 5xx status code indicating a temporary issue with our processing engine.
Retry the request after a short delay. Since requests are processed sequentially, under load you may experience slight delays before the audio is generated.
- 5xx errors indicate temporary failures
- Failed requests are free
- Retry with short delay
Quickstart Example
Start by generating audio for your first guided meditation session using the command line or Python. These examples demonstrate the basic workflow for converting text into soothing audio files, ensuring your API integration begins smoothly.
Curl Command
Use this command to send a POST request to the speech endpoint. Replace YOUR_API_KEY with your actual key and adjust the text or voice as needed for your specific meditation script.
- Replace
YOUR_API_KEYwith your token. - Adjust the
inputtext to your script. - Set
voiceto 'luna' for a soft tone.
Python SDK Setup
Install the OpenAI SDK and configure it to point to our base URL. This allows you to use familiar methods while leveraging our TTS engine for your fitness or meditation app.
Base URL Configuration
Set your API base URL to https://api.bagan7login.com/v1. This ensures all requests are routed correctly to our cloud infrastructure for audio synthesis.
Listen to the 8 voices
Each sample below was generated by this API from the same sentence. Optimize your team's wellness to drive sustainable startup growth.
23 languages
Any voice speaks any of these languages.
Sources and further reading
- Wikipedia
- FFmpeg documentation
- W3C WAI: making audio and video accessible
- Python documentation
- LibriTTS-R paper (arXiv 2305.18802)
- LibriTTS-R corpus (OpenSLR 141)
- curl documentation
- TRON developer hub: TRC-20
- IETF RFC 7845: Ogg Opus
- Node.js documentation
- Creative Commons Attribution 4.0
- openai-python on GitHub
