Cloud Text-to-Speech API for Android App Integration

By AppVoice API editorial team · Updated 2026-11-18

This guide explains how to integrate the AppVoice API into your Android application. You will learn to generate speech from text using standard HTTP requests, manage authentication with Bearer tokens, and handle audio responses efficiently. The instructions cover parameter configuration, supported formats, and error handling to help you build reliable voice features without extra infrastructure.

Designed for Android developers, this documentation provides concrete examples for implementing text-to-speech in mobile apps. You will find details on rate limits, language handling, and voice presets to ensure smooth user experiences. Follow these steps to add high-quality synthetic speech to your app with minimal code and predictable costs.

Cloud Text-to-Speech API for Android App Integration

Frequently asked questions

How do I get an API key?

Sign up on /get-api-key/ using Google or email. Accounts are per site. The dashboard displays your key, balance, and usage. You can issue a new key anytime; the old one stops immediately. Failed requests are free, and a $0.50 trial is available for Google sign-ups.

Can I use the OpenAI SDK?

Yes. The request shape matches the OpenAI speech endpoint. Change the base URL to https://api.playp6x.com/v1 and use your AppVoice key. The official OpenAI SDKs work by changing the base URL, allowing easy integration into your existing Android or iOS codebase.

What is the base URL for the API?

The base URL is https://api.playp6x.com/v1. Use POST https://api.playp6x.com/v1/audio/speech for synthesis. Other endpoints include GET /v1/voices and GET /v1/models. This structure ensures compatibility with standard HTTP clients and the OpenAI SDK.

Does the API support streaming?

No. The API returns the complete audio file in the response. There is no WebSocket or real-time partial audio streaming. You receive the full audio once synthesis completes, which typically takes a few seconds for short phrases.

Can I use SSML in the input text?

No. The API does not support SSML, phoneme dictionaries, or custom pronunciation lexicons. You can only send plain text up to 4096 characters. Control speed and voice via parameters, not markup tags within the text itself.

What happens if I exceed the rate limit?

You are limited to 60 requests per minute per key (10 before top-up). Requests are processed sequentially, so excess requests may wait in a queue. If synthesis fails, the charge is returned in full, but limits still apply.

How do I split long texts?

Split your text into parts of up to 4096 characters. Send each part as a separate request. Join the returned audio files on your client side. This ensures each request stays within the character limit and generates cleanly.

Is the 4096 character limit per request?

Yes. Each request accepts up to 4096 characters of input text. Spaces and punctuation count toward this limit. For longer texts, you must split the content into multiple requests and concatenate the resulting audio files.

Can I change the speed dynamically?

Yes. The speed parameter accepts values from 0.25 to 4.0. You can adjust this per request to make speech faster or slower. This allows you to fine-tune the output for different content types without changing voices.

Does the API return audio bytes or a URL?

The API returns the audio file directly in the response. Generated audio is not stored on the server. You receive the file immediately upon completion, which is efficient for mobile apps needing instant playback without additional download steps.

How do I handle language codes?

Set the optional language parameter to an ISO code. If omitted, the system guesses from the script, defaulting to English for Latin text. Explicitly set it for non-English Latin-script text to ensure correct synthesis across 23 supported languages.

Is the watermark visible or audible?

The watermark is inaudible. Every generated file carries an inaudible mark indicating synthetic speech. It does not affect audio quality or playback. This helps identify AI-generated content without listeners noticing any difference in the audio experience.

Can I use the same key on multiple devices?

Yes. One active key is issued per account. You can use this single key across multiple Android or iOS devices. Rate limits apply per key, so monitor usage if many devices generate audio simultaneously.

What is the response format for errors?

Standard HTTP error codes are returned. Failed requests are free, and charges are returned in full. The response includes details about the error, allowing your app to handle retries or display appropriate messages to users without losing credits.

First request

curl

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

To start using the AppVoice API in your Android app, you need an API key. This key authenticates your requests and tracks your usage against your account balance. You can generate or retrieve your key from the /get-api-key/ dashboard page after signing up with Google or email.

API Key Format

API Key Format

Your API key is a unique string starting with the prefix "tts-". It is case-sensitive and should be kept secure within your Android application or backend proxy to prevent unauthorized usage. Each account holds one active key at a time.

Bearer Token Usage

Bearer Token Usage

Include your key in the HTTP header of every request to https://api.playp6x.com/v1. Use the standard Authorization header format: Authorization: Bearer tts-your-api-key-here. The API uses this token to verify your identity and deduct characters from your balance.

  • Header: Authorization: Bearer tts-...
  • Case-sensitive string
  • Required for all endpoints

Key Management

You can issue a new key at any time from your dashboard. When you generate a new key, the previous one stops working immediately. This is useful for rotating credentials if you suspect a leak or for managing different app environments.

Endpoints Overview

Sound wave illustration for: Endpoints Overview

Your Android app communicates with three core endpoints. The speech endpoint generates audio from text, while the list voices and list models endpoints provide metadata for configuration.

Speech Generation

Use POST /v1/audio/speech to convert text into audio files. Send your JSON payload with the text, voice, and format preferences. The API returns the audio file directly in the response body.

List Voices

Call GET /v1/voices to retrieve available voice presets, supported languages, and format options. This helps you configure your app’s UI with accurate voice selections and language settings before making synthesis requests.

List Models

Use GET /v1/models to fetch the available TTS models. This endpoint confirms the supported model IDs, such as tts-1 and tts-1-hd, which you include in your speech requests.

Speech Endpoint

Sound wave illustration for: Speech Endpoint

Generate speech by sending a POST request to the /v1/audio/speech endpoint. The API accepts text input and returns an audio file directly in the response, allowing seamless integration into Android applications without complex streaming logic.

Use the standard JSON body structure to define the model, voice, and output format. This endpoint is the core of the service, processing your text into high-quality synthetic speech ready for playback in your app.

POST Method

Send a standard HTTP POST request to the speech endpoint. The request must include the API key in the Authorization header and the text payload in the JSON body. This simple method ensures compatibility with standard Android HTTP libraries like OkHttp or Retrofit.

JSON Body Structure

The request body contains the text to be spoken, the model identifier (tts-1 or tts-1-hd), the desired voice preset, and the output format. You can also specify a speed multiplier between 0.25 and 4.0. Each request supports up to 4096 characters of input text.

  • model: tts-1 or tts-1-hd
  • input: your text string
  • voice: e.g., aria, nova, felix
  • response_format: mp3, wav, opus, flac, or pcm

Response Format

On success, the API returns the generated audio file directly in the response body with the appropriate Content-Type header. Failed requests return a JSON error object but do not charge your balance, ensuring you only pay for successful synthesis.

Request Parameters

Sound wave illustration for: Request Parameters

Configure the synthesis behavior using three core parameters: model, voice, and speed. The model determines the engine (tts-1 or tts-1-hd use the same engine), while the voice selects the speaker persona. Speed adjusts the playback rate to fit your app’s pacing needs.

These settings allow you to balance audio fidelity and processing time. Adjusting speed helps reduce generation time for longer text segments, while voice selection ensures the tone matches your app’s brand identity.

Model Selection

Choose between 'tts-1' for standard quality or 'tts-1-hd' for higher fidelity. Both use the same engine and pricing tier, so pick based on your audio quality requirements without worrying about cost differences.

  • tts-1: Standard quality
  • tts-1-hd: Higher fidelity
  • Same price: $0.01 per 1,000 characters

Voice Presets

Select from eight licensed voices, including female options like Aria and Nova, and male options like Felix and Milo. Each voice has a distinct character, from warm narration to energetic promo styles, suitable for various app contexts.

All voices support 23 languages. If you omit the language code, the system guesses it based on the script, defaulting to English for Latin text. Explicitly set the language for non-English Latin-script content to ensure accuracy.

  • 8 presets: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, Orion
  • Supports 23 languages
  • Auto-detection defaults to English for Latin script

Speed Control

Adjust speech speed between 0.25 and 4.0. Slower speeds improve clarity for instructional content, while faster speeds reduce generation time and character costs for long texts. Requests are processed sequentially, so higher speeds can help manage queue latency.

  • Range: 0.25–4.0
  • Optimizes generation time
  • Reduces perceived latency

Audio Formats

Sound wave illustration for: Audio Formats

For most Android apps, MP3 is the default choice for balancing quality and file size. It is universally supported by Android’s MediaPlayer and ExoPlayer, ensuring smooth playback across all devices without additional codec dependencies.

MP3 Support

MP3 provides reliable compression suitable for playback directly from the API response. It keeps bandwidth costs low while maintaining clear speech quality for navigation instructions, voice messages, or audiobook snippets.

WAV Support

Choose WAV when you need uncompressed, high-fidelity audio for offline storage or precise editing. Although file sizes are larger, WAV ensures no data loss during playback, ideal for high-quality voice features.

Opus, FLAC, PCM

Use Opus for efficient streaming with low latency, perfect for real-time conversational interfaces. FLAC offers lossless compression for archival needs, while PCM provides raw, uncompressed data for custom audio processing pipelines.

  • Opus: Efficient format for streaming
  • FLAC: Lossless compression
  • PCM: Raw data for custom processing
Audio Formats

Language Handling

Sound wave illustration for: Language Handling

AppVoice API automatically detects the language of your input text to ensure accurate synthesis. This simplifies integration for Android apps, as you can send text without manually specifying language codes for common scenarios.

For precise control, you can explicitly set the language parameter using an ISO code. This is essential when the default detection might misinterpret the input script or tone.

The system guesses the language based on the text script. Latin script defaults to English. If you are sending non-English text using Latin characters, you must set the language parameter to avoid incorrect synthesis.

Auto-Detection

The API analyzes your input text to determine the most likely language. This works seamlessly for standard inputs, reducing the number of parameters you need to manage in your Android app's API calls.

Manual Language Code

You can override auto-detection by providing a specific ISO language code in the request. This ensures accurate pronunciation for complex or mixed-script texts where the default guess might be incorrect.

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.

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

Script-Based Guessing

If the language field is omitted, the API infers the language from the character set. Text using Latin characters defaults to English. For other Latin-script languages, you must explicitly set the language code.

Voices are trained to speak all supported languages, so any voice preset can be used with any supported language code.

Rate Limits

Sound wave illustration for: Rate Limits

The API enforces a standard rate limit of 60 requests per minute per active key. This cap ensures stable performance for your Android app’s audio generation pipeline, preventing sudden bursts from overwhelming the service during peak usage times.

60 Requests Per Minute

Each API key is allowed up to 60 requests per minute. This limit applies uniformly across all requests sent to the speech endpoint, ensuring predictable throughput for your mobile application.

Initial Limit

New keys start with a lower limit of 10 requests per minute. This allows you to test integration without immediate high-volume pressure. You can upgrade this limit at any time by topping up your account.

Limit Increase

To increase your limit, top up your account with at least $5 USDT on the TRON network (TRC-20). Once the transfer is confirmed, your limit increases to 60 requests per minute automatically within minutes.

Error Handling

Sound wave illustration for: Error Handling

Handling errors correctly ensures your Android app maintains a smooth user experience even when synthesis fails. Our API returns standard HTTP status codes to indicate success or failure, allowing you to implement robust error handling in your Kotlin or Java code.

Common Error Codes

We return specific HTTP status codes to help you diagnose issues quickly. A 400 Bad Request indicates invalid parameters, while 401 Unauthorized means your API key is missing or incorrect. Rate limits trigger a 429 response, and server issues return a 500 code.

  • 400: Invalid request parameters (e.g., invalid voice ID)
  • 401: Unauthorized or expired API key
  • 429: Rate limit exceeded (60 requests/minute)
  • 500: Internal server error during synthesis

Retry Logic

For transient errors like 429 or 500, implement exponential backoff in your app. Wait briefly before retrying, as requests are processed sequentially. Avoid rapid retries to prevent overwhelming the queue. For 400 errors, check your input text and parameters before retrying, as these will not succeed on immediate repeat.

Billing for Errors

If synthesis fails due to a server error, you are not charged for the request. Failed requests are refunded in full, ensuring you only pay for successfully generated audio. This applies to both standard and HD models, keeping your costs predictable even during high load.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. However, failed requests are always refunded, ensuring you never pay for unsuccessful audio generation.

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. MDN: Web Speech API
  3. Creative Commons Attribution 4.0
  4. IETF RFC 7845: Ogg Opus
  5. Python documentation
  6. FFmpeg documentation
  7. curl documentation
  8. ISO 639 language codes
  9. Tether (USDT)
  10. TRON developer hub: TRC-20
  11. LibriVox public-domain audiobooks
  12. openai-node on GitHub

More on this site