How to Integrate TTS API into Android Applications

By VoxApp editorial team · Updated 2026-11-19

This guide provides a structured workflow for integrating the VoxApp text-to-speech API into Android applications. It details the technical steps required to send text payloads and receive audio files, enabling indie developers to implement high-quality voice features without managing complex infrastructure.

Readers will learn how to configure network permissions, construct JSON requests, and handle responses using standard HTTP clients. The instructions cover parameter validation, rate limit management, and error handling, ensuring reliable integration for mobile apps using the tts-1 or tts-1-hd models.

How to Integrate TTS API into Android Applications

Frequently asked questions

What is an API?

An API is a cloud interface where you send text and receive an audio file. The endpoint is POST https://api.ace65.info/v1/audio/speech. It uses a JSON body similar to the OpenAI speech endpoint, allowing you to integrate high-quality voice features into your Android application without managing complex infrastructure.

How do I install the SDK?

We do not provide an official SDK. You can use the official OpenAI SDK by changing the base_url to https://api.ace65.info/v1. Alternatively, use plain HTTP requests. This approach allows you to integrate the TTS service into your Android app using standard networking libraries without additional dependencies.

Is Android supported?

Yes, the API is designed for integration into Android applications. You can send text requests from your Android device or backend and receive audio files. The platform enables indie developers to implement voice features without managing complex infrastructure, ensuring reliable performance for mobile applications.

How long does integration take?

Integration is straightforward using standard HTTP requests or the OpenAI SDK with a modified base_url. You send a JSON payload with your text and voice selection. Most developers can implement basic functionality quickly, as the API follows a familiar request shape compatible with existing TTS implementations.

Do I need internet?

Yes, the API is cloud-based. You must send text to https://api.ace65.info/v1/audio/speech and receive the audio file over the internet. There is no offline mode or local processing capability. Your Android app requires an active network connection to generate speech.

Can I use offline mode?

No, the service is entirely cloud-based. Text is sent to our servers for synthesis, and the audio file is returned in the response. There is no local engine or offline mode available. Your Android application must maintain an internet connection to use the TTS API.

How do I handle large texts?

Split your text into parts of up to 4096 characters per request. Send each part separately and join the resulting audio files. This ensures compliance with the character limit. Failed requests are free, so you can retry parts if synthesis errors occur during the process.

What is a background thread?

A background thread handles network requests so your UI remains responsive. Since synthesis takes time, send your POST request to the API on a background thread. Receive the audio file and update your interface once the response is ready. This prevents blocking the main Android thread.

How do I save the audio?

The API returns the audio file directly in the response. You can save this file to your Android device storage or play it immediately. Supported formats include mp3, wav, opus, flac, and pcm. Choose the format that best fits your application's requirements and storage constraints.

Is JSON required?

Yes, the request body must be JSON. Include fields like model, input, voice, and response_format. The endpoint expects a standard JSON structure. Using the OpenAI SDK simplifies this by handling JSON serialization automatically. Ensure your Android app sends valid JSON to avoid request errors.

Can I use Python?

Change the base_url to https://api.ace65.info/v1 and use your API key. This works with the official OpenAI Python SDK or any HTTP library.

How do I test the API?

Use the curl example provided on the /get-api-key/ page. Send a POST request with your API key and sample text. Check the response for the audio file. You can also use the OpenAI SDK with the modified base_url to verify integration before deploying to your Android application.

What is a rate limit?

The limit is 60 requests per minute per key. Before your first top-up, it is 10 requests per minute. Exceeding this may cause delays as requests are processed sequentially. Monitor your usage on the dashboard to ensure smooth operation within your Android application's expected traffic volume.

How do I rotate keys?

Issue a new key from your account dashboard. The new key becomes active immediately, and the old one stops at once. Update your Android application configuration with the new key. This ensures secure access without downtime, as only one active key is valid per account.

Pre-Integration Requirements

Sound wave illustration for: Pre-Integration Requirements

Before implementing the text-to-speech feature in your Android application, you must obtain a valid API key and configure the necessary network permissions. This ensures your app can communicate securely with the VoxApp endpoint.

Proper initialization of the HTTP client is critical for handling POST requests efficiently. Configure your client to support the required JSON body structure and handle potential network variations during synthesis requests.

API Key Acquisition

Navigate to https://ace65.info/get-api-key/ and sign in using Google or email. The dashboard displays your active API key, balance, and usage statistics. Keys are tied to the specific site account.

Use the provided key in your authorization header. You can issue a new key at any time, which immediately invalidates the previous one.

  • Sign up via Google or email on /get-api-key/
  • Retrieve the Bearer token from the dashboard
  • Note that keys are site-specific

Network Permissions

Add the INTERNET permission to your AndroidManifest.xml to allow HTTP/HTTPS traffic. Without this, your app cannot reach https://api.ace65.info/v1.

Ensure your app handles network state changes gracefully, as synthesis may fail if connectivity is lost during the request.

  • Add <uses-permission android:name="android.permission.INTERNET"/>
  • Handle network availability checks

HTTP Client Setup

Initialize an HTTP client capable of sending POST requests with a JSON body. The endpoint is https://api.ace65.info/v1/audio/speech.

Set the Content-Type header to application/json and include the Authorization header with your Bearer token. Configure timeouts appropriately to avoid hanging during synthesis.

  • Use POST method for /v1/audio/speech
  • Set Content-Type: application/json
  • Include Authorization: Bearer <key>

Request Construction

Sound wave illustration for: Request Construction

To generate speech, send a POST request to https://api.ace65.info/v1/audio/speech. The body must be valid JSON containing the required fields: model, input, voice, and response_format. Optional parameters like speed and language allow for fine-tuning the output.

JSON Body Structure

Include model as "tts-1" or "tts-1-hd", input with your text string, voice from the eight presets, and response_format (mp3, wav, opus, flac, or pcm). The speed parameter accepts values between 0.25 and 4.0. If the text language differs from the voice default, specify it using the ISO code in the language field.

Parameter Validation

Ensure the input string does not exceed 4096 characters. The voice value must match one of the eight available presets: aria, nova, luna, sage, felix, milo, atlas, or orion. Invalid models or voices return a 400 error. Speed values outside the 0.25–4.0 range are rejected.

Text Length Handling

Since requests are limited to 4096 characters, split longer texts into smaller segments on your end. Concatenate the resulting audio files sequentially on the client side. Note that spaces and punctuation count toward the character limit, so plan your split points accordingly to avoid truncation.

Authentication Setup

Sound wave illustration for: Authentication Setup

Authentication is established by passing the API key in the HTTP header. This mechanism ensures that each request is securely tied to your specific account and billing profile.

Header Configuration

Include the authorization header in every request to the endpoint https://api.ace65.info/v1. The header key must be exactly Authorization.

  • Header name: Authorization
  • Format: Bearer <your-key>
  • Example: Authorization: Bearer tts-123abc456def

Bearer Token Usage

The token is the active key generated in your dashboard. It validates your identity and deducts credits from your balance upon successful synthesis.

  • One active key per account
  • New keys invalidate old ones immediately
  • No expiration unless rotated

Security Best Practices

Store keys in environment variables or Android SharedPreferences with encryption. Avoid hardcoding them in source control. Rotate keys via the dashboard if a leak is suspected.

  • Use environment variables for build-time injection
  • Rotate keys via the dashboard
  • Keep keys out of git repositories

Response Handling

Sound wave illustration for: Response Handling

Upon receiving a successful response from the POST /v1/audio/speech endpoint, the Android application receives a binary audio stream. The response headers indicate the content type, which corresponds to the requested response_format (mp3, wav, opus, flac, or pcm). The application must read this stream directly into memory or a temporary file buffer without parsing JSON, as the body contains raw audio data.

Audio Stream Reception

Use the HTTP client’s ResponseBody to access the raw bytes. The response contains raw audio data which should be read directly into memory or a temporary file buffer.

  • Read the ResponseBody byte array directly.
  • Ensure the buffer size matches the expected audio payload.
  • Close the input stream immediately after reading to free resources.

File Saving Methods

Save the received bytes to internal storage or external cache using standard Android FileOutputStream. For short phrases, immediate playback is feasible; for longer texts, storing the file ensures reliability if the user navigates away from the screen. Use the .mp3 or .wav extension matching the selected format.

  • Write bytes to a private internal file.
  • Use Context.getExternalCacheDir() for temporary large files.
  • Verify file integrity after writing completes.

Error Response Parsing

If the synthesis fails, the API returns a JSON error object. Parse this response to retrieve the error code and message. Failed requests are free, so no balance deduction occurs. Log the specific error (e.g., invalid model or voice) to assist in debugging integration issues without consuming user credits.

  • Check HTTP status code (4xx or 5xx).
  • Parse JSON body for error object.
  • Log error details for debugging purposes.

Voice Selection Strategy

Sound wave illustration for: Voice Selection Strategy

Selecting the appropriate voice preset is critical for Android application context. VoxApp provides eight distinct voice models, ranging from the warm narration of Aria to the neutral news delivery of Atlas. Each voice is optimized for specific use cases, allowing developers to align audio output with application tone without additional configuration.

Preset Voice Options

The API offers eight preset voices divided by gender and tonal characteristics. Female options include Aria, Nova, Luna, and Sage. Male options include Felix, Milo, Atlas, and Orion. All voices support any of the 23 supported languages, ensuring consistent quality across diverse regional deployments.

  • Aria: Warm, clear narrator
  • Luna: Soft, storytelling
  • Atlas: Neutral, news
  • Felix: Energetic, promo

Language Matching

Although every voice can speak any supported language, setting the language parameter is recommended for non-English Latin-script text. Without it, the system defaults to English, which may affect pronunciation accuracy. Supported languages include Arabic, Chinese, French, German, Japanese, and others listed in the documentation.

Tone Adjustment

Tone is primarily determined by the voice preset selection. The API does not support SSML or emotion tags. Adjust speed between 0.25 and 4.0 to modify pacing. For a faster, energetic feel, select Felix or Nova. For a calm, instructional tone, use Sage or Atlas.

Performance Optimization

Sound wave illustration for: Performance Optimization

Generating audio synchronously blocks the main UI thread, causing jank during synthesis. Offload requests to a background executor to maintain a responsive interface. Use Kotlin coroutines or Java ExecutorService to handle network I/O without freezing the app.

Cache responses locally to avoid redundant API calls for static content. Ensure cache keys include voice, format, and speed parameters for accurate retrieval.

Background Threading

Use Kotlin Coroutines or Java ExecutorService to handle network I/O without freezing the UI thread. Perform synthesis in the background to maintain a smooth user experience.

Ensure the HTTP client is configured with appropriate timeouts to prevent hanging during high-latency network conditions.

  • Use Kotlin Coroutines for async synthesis
  • Configure HTTP client timeouts
  • Avoid main thread blocking

Caching Responses

Store generated audio files locally using Room or DataStore to avoid redundant API calls for static content. This reduces latency and conserves your character quota.

Include voice, format, and speed parameters in cache keys for accurate retrieval. Invalidate cache when parameters change.

  • Use Room or DataStore for local storage
  • Include all parameters in cache keys
  • Invalidate cache on parameter changes

Queue Management

Process requests sequentially if real-time consistency is required, or use a priority queue for urgent updates. Monitor the queue length to prevent memory leaks.

Implement retry logic with exponential backoff for transient errors. Ensure the queue respects the 60 requests per minute rate limit.

  • Use priority queue for urgent updates
  • Monitor queue length
  • Implement exponential backoff

Rate Limit Management

Sound wave illustration for: Rate Limit Management

VoxApp enforces a strict rate limit of 60 requests per minute per API key, with a reduced allowance of 10 requests per minute for accounts before their first top-up. This constraint ensures stable processing for indie developers integrating the TTS engine into Android applications, preventing server overload during peak usage periods.

Request Throttling

Implement exponential backoff in your Android background services to respect the 60 requests/minute limit. Monitor the Retry-After header in HTTP 429 responses to pause subsequent synthesis tasks until the rate limit resets, ensuring smooth audio generation without immediate rejection.

Retry Logic

Configure your HTTP client to automatically retry failed requests with a short delay. Since requests are processed sequentially, brief queuing delays may occur under load. A robust retry mechanism handles transient 5xx errors and temporary rate limits gracefully, preserving user experience in your app.

Balance Monitoring

Regularly check your account balance via the /get-api-key/ dashboard or API. With pricing at $0.01 per 1,000 characters, monitor character consumption to manage your balance. The dashboard displays remaining credits, usage statistics, and allows immediate key rotation if needed.

Rate Limit Management

Testing Procedures

Sound wave illustration for: Testing Procedures

Verify API connectivity and response structure before integrating into your Android application. Use curl to confirm authentication, voice selection, and audio generation.

Ensure your implementation handles both success and error cases correctly. Validate that audio files are generated within expected timeframes and character limits.

Curl Validation

Execute a test request using curl to confirm your API key works. Send a POST request to https://api.ace65.info/v1/audio/speech with a sample text payload.

  • Verify the response contains valid audio data in the requested format (mp3, wav, opus, flac, or pcm).
  • Check that the HTTP status is 200 and headers include the correct content type.
  • Confirm that the request respects the 4096-character limit per request.

SDK Testing

Use the official OpenAI SDK by setting the base_url to https://api.ace65.info/v1. Initialize the client with your Bearer token.

  • Test all eight voice presets to ensure correct audio generation for each.
  • Validate language parameter handling, especially for non-English Latin-script texts.
  • Confirm that speed adjustments between 0.25 and 4.0 work as expected.

Load Testing

Monitor your account’s rate limit of 60 requests per minute. Send requests to observe queuing behavior under load.

  • Track response times to ensure they align with real-time generation speeds.
  • Verify that failed requests do not incur charges and return correct error codes.
  • Ensure your Android app handles temporary network errors gracefully during high-demand periods.

Deployment Considerations

Sound wave illustration for: Deployment Considerations

Deploying the VoxApp TTS API in Android applications requires distinguishing between development and production environments to ensure stable audio generation. Use the dedicated production key obtained from the /get-api-key/ page, which operates under the same rate limits (60 requests per minute) but provides consistent billing and usage tracking.

Production Keys

The production key is issued upon account creation or via the dashboard. It operates under the standard rate limits. Store this key securely within your Android application, preferably in a build-specific configuration file that is excluded from version control if it contains sensitive credentials.

  • Keys are single-active; issuing a new key immediately invalidates the previous one.
  • Use the same tts-... format as the test key.

Environment Variables

Load the API key and base URL (https://api.ace65.info/v1) from environment variables or Android’s BuildConfig to avoid hardcoding secrets. This allows you to switch between test and production keys without recompiling the APK. Ensure that the base URL is correctly set to the production endpoint to avoid latency or routing issues.

Key Rotation

Rotate keys directly from the /get-api-key/ dashboard. When you generate a new key, the old one becomes invalid immediately. Update your Android app’s configuration to use the new key before the old one expires or is compromised. This process does not require a new app release if keys are loaded dynamically from environment variables.

Troubleshooting

Sound wave illustration for: Troubleshooting

Integration failures typically stem from network constraints or misconfigured headers. Ensuring stable connectivity and correct endpoint paths prevents initial connection drops during audio synthesis requests.

Addressing these issues systematically ensures reliable audio delivery for your Android application without unnecessary delays or repeated attempts.

Common Connection Issues

Verify that your Android device has internet permissions enabled in the manifest. Check that the base URL https://api.ace65.info/v1 is accessible from your environment, as firewalls may block the POST requests.

  • Ensure INTERNET permission is declared in AndroidManifest.xml.
  • Verify firewall rules allow outbound HTTPS traffic to api.ace65.info.
  • Check for proxy settings that might intercept the POST request.

Authentication Failures

Confirm the Authorization: Bearer tts-... header contains a valid key. Keys expire immediately upon issuing a new one, so ensure you are using the most recent key from your dashboard.

  • Use the exact key from /get-api-key/.
  • Ensure no trailing spaces in the token.
  • Verify the key has not been invalidated by a recent rotation.

Audio Format Errors

Specify supported formats like mp3, wav, opus, flac, or pcm in the response_format field. Unsupported formats may cause silent failures or malformed audio streams returned by the API.

  • Supported formats: mp3, wav, opus, flac, pcm.
  • Ensure the client can decode the returned format.
  • Check that the model parameter matches the selected voice capabilities.

Best Practices

Sound wave illustration for: Best Practices

Efficient text preprocessing reduces latency and ensures consistent audio quality. Android clients should trim whitespace and split long inputs at natural sentence boundaries before submission. Since the API limits requests to 4096 characters, splitting logic must preserve context across segments. Use standard Java String.split or regex patterns to identify sentence ends, avoiding arbitrary breaks that disrupt audio continuity.

Proper preprocessing also handles special characters and punctuation that might confuse the TTS engine. Remove non-printable characters and ensure encoding is UTF-8. This minimizes character count waste and prevents errors during synthesis.

Text Preprocessing

Split text into segments of 4096 characters or fewer. Join audio files sequentially on the client side. This approach maintains narrative flow while adhering to API constraints.

Trim leading and trailing whitespace. Normalize unicode characters to prevent encoding issues. Validate input length before sending requests to avoid wasted API calls.

  • Split at sentence boundaries, not mid-word
  • Normalize unicode to NFC form
  • Remove non-printable characters

Error Logging

Log all API responses, including status codes and body content, for debugging. Capture request payloads to reproduce issues. Store logs locally on the device for offline review if needed.

Implement structured logging with timestamps and request IDs. This aids support teams in diagnosing issues. Ensure logs do not contain sensitive user data or API keys.

User Feedback

Provide users with clear feedback during TTS generation. Show progress indicators or status messages. Handle errors gracefully with user-friendly messages, e.g., 'Voice generation failed' instead of raw API errors.

Allow users to retry failed requests easily. Offer options to adjust speed or voice if the default output is unsatisfactory.

Support and Updates

Sound wave illustration for: Support and Updates

Our technical documentation is updated alongside API changes to ensure accuracy. You can review the full reference at https://ace65.info/docs/.

Documentation Updates

The documentation reflects the current API structure, including endpoint details and parameter validation. Updates are applied to the live site without delay.

Email Support

We provide support exclusively via email. There is no live chat or phone number available for direct assistance.

  • No phone support
  • No live chat

Changelog Access

Information on updates is available through the standard documentation channels. There is no dedicated changelog page.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Understanding these distinctions helps developers select the right tool for their app’s audio needs without over-engineering the solution.

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. curl documentation
  3. IETF RFC 7845: Ogg Opus
  4. Python documentation
  5. LibriTTS-R corpus (OpenSLR 141)
  6. Node.js documentation
  7. OpenAI API reference: create speech
  8. ISO 639 language codes
  9. Tether (USDT)
  10. TRON developer hub: TRC-20
  11. MDN: Web Speech API
  12. openai-node on GitHub

More on this site