API Documentation: Quickstart Guide for Developers

By SpinTopia editorial team · Updated 2026-11-19

This guide explains how to generate Hindi speech via the SpinTopia REST API. You will learn to configure authentication, structure requests, and handle responses for the tts-1 and tts-1-hd models. The documentation covers essential endpoints, parameter options, and integration patterns using standard HTTP clients or the OpenAI SDK.

Designed for indie developers, this reference provides concrete examples for implementing text-to-speech in online stores or video content pipelines. You will find specific details on voice selection, audio formats, rate limits, and error handling to ensure reliable, predictable character-based billing.

API Documentation: Quickstart Guide for Developers

Frequently asked questions

How do I get my API key?

Sign up on /get-api-key/ using Google or email. Your active key appears on the dashboard. You can issue a new key at any time; the old one stops immediately. Each account has one active key at a time.

What is the base URL for the API?

The API base URL is https://api.spinstopia.cc/v1. Use POST https://api.spinstopia.cc/v1/audio/speech for synthesis. Other endpoints include GET /v1/voices and GET /v1/models for configuration details.

Can I use the official OpenAI SDK?

Yes. The request shape matches the OpenAI speech endpoint. Configure your SDK’s base_url to https://api.spinstopia.cc/v1 and use your SpinTopia key. The official OpenAI SDKs work directly with this configuration.

What models are available?

Two models are available: tts-1 and tts-1-hd. They use the same engine and price. Select either model in your request body. Both support the same voices, languages, and audio formats.

What is the maximum input length?

The maximum input length is 4096 characters per request. For longer texts, split them into parts of up to 4096 characters and join the resulting audio files. Spaces and punctuation count toward the limit.

How do I set the language to Hindi?

Set the language parameter to 'hi' (ISO code) in your request body. Although Hindi uses Devanagari script, explicitly setting the language ensures correct synthesis. If omitted, the system guesses based on the script.

What happens if I exceed the rate limit?

The limit is 60 requests per minute per key. Exceeding this may cause requests to wait in a queue or fail. Requests are processed sequentially, so under load, generation time increases significantly.

Are failed requests charged?

No. Failed requests are free. If synthesis fails, the charge is returned in full. You only pay for successful audio generation. The price is $10 per 1 million characters.

How do I rotate my API key?

Issue a new key from your dashboard at any time. The new key becomes active immediately. The old key stops working at once. You can manage keys directly from the account settings page.

What audio formats are supported?

Supported formats are mp3, wav, opus, flac, and pcm. Specify the desired format in the response_format field. The generated audio is returned directly in the API response without storage.

Is streaming supported via WebSocket?

No. Streaming via WebSocket is not supported. The API returns the complete audio file after synthesis. Requests are processed one after another, so you receive the final output once generation completes.

Does the API support SSML?

No. The API does not support SSML. You send plain text in the input field. There are no emotion tags or phoneme dictionaries. Simple text input is sufficient for most use cases.

How do I handle errors in code?

Check the HTTP status code and response body for error details. Failed requests return no charge. Implement retry logic for rate limits or queue delays. The API returns standard error codes for invalid inputs.

Is there a Python SDK provided?

No official SDK is provided. Use the official OpenAI Python SDK or plain HTTP requests. Configure the base_url to https://api.spinstopia.cc/v1. This allows you to use familiar libraries with our API.

First request

curl

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

Authentication is handled via a Bearer token passed in the HTTP header. Each account holds one active key; use Authorization: Bearer tts-... for all requests.

Bearer Token Setup

Bearer Token Setup

Retrieve your key from the dashboard after signing in via Google or email. Include it in every request header as Authorization: Bearer YOUR_API_KEY.

API Key Management

API Key Management

Only one key is active per account. The dashboard displays your current key, balance, and usage statistics.

Key Rotation Process

Issue a new key via the dashboard at any time. The previous key stops working immediately upon issuance, ensuring secure access control.

Endpoints Overview

Sound wave illustration for: Endpoints Overview

The API exposes three primary endpoints for speech synthesis and configuration. The main endpoint handles audio generation, while the secondary endpoints provide metadata about available voices and model capabilities.

POST /v1/audio/speech

This is the core endpoint for generating audio. Send a JSON payload with the model, input, voice, and optional parameters like response_format or speed. The API returns the audio file directly in the response body.

  • Accepts text up to 4096 characters per request.
  • Supports MP3, WAV, OPUS, FLAC, and PCM formats.
  • Rate limited to 60 requests per minute.

GET /v1/voices

Retrieve the full list of available voices, their associated languages, and supported output formats. This helps you verify which voice suits your specific language requirement before making synthesis requests.

  • Lists all 8 voice presets.
  • Shows supported languages and formats.
  • Returns pricing information.

GET /v1/models

Fetch the current model configurations. This endpoint confirms the available model IDs (tts-1 and tts-1-hd) and their respective engine characteristics, ensuring your client code targets the correct version.

Request Parameters

Sound wave illustration for: Request Parameters

Configure the request body to generate audio from text. The API accepts plain strings with a maximum length of 4096 characters per request, including spaces and punctuation. For longer content, split the text into chunks and join the resulting audio files manually.

Input Text Field

Pass your text in the input field. The engine processes up to 4096 characters per call. If your content exceeds this limit, divide the text into smaller segments, generate each segment, and concatenate the audio outputs.

  • Maximum 4096 characters per request
  • Spaces and punctuation count toward the limit
  • No SSML or phoneme dictionaries supported.

Voice Selection

Select one of eight preset voices using the voice parameter. Each voice has a distinct tone, from warm narrators to energetic promo speakers. The API supports 23 languages; if language is omitted, Latin script defaults to English, but you should explicitly set it for non-English Latin text.

  • 8 available presets (e.g., aria, nova, felix)
  • Supports 23 languages including Hindi
  • Voice can speak any supported language

Response Format

Specify the output format via the response_format field. Options include mp3, wav, opus, flac, and pcm. The generated audio is returned directly in the response body and is not stored on our servers.

  • mp3, wav, opus, flac, pcm
  • Audio returned in the response body
  • No permanent storage of generated audio

Curl Example

Sound wave illustration for: Curl Example

Generate audio files directly from your terminal using standard HTTP requests. This section demonstrates the core request structure required to synthesize speech, ensuring you understand the necessary components before integrating with your application.

The API accepts plain text inputs and returns audio files in various formats. Use the examples below to verify connectivity and correct parameter formatting before scaling to production workloads.

Basic Request Structure

Send a POST request to the speech endpoint. The request must include your authentication header and a JSON body containing the text, voice, and format parameters. Ensure your text does not exceed 4,096 characters.

Headers Configuration

Include the Authorization header with your Bearer token. Set the Content-Type to application/json. These headers are required for all requests to authenticate your account and process the payload correctly.

JSON Body Example

The body must contain model, input, voice, and response_format. For example, use tts-1 with the nova voice and mp3 format. You can also specify a speed multiplier between 0.25 and 4.0.

```json { "model": "tts-1", "input": "Hello world", "voice": "nova", "response_format": "mp3", "speed": 1.0 } ```

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

Leverage the official OpenAI SDKs by overriding the base URL to point at our infrastructure. This allows you to use familiar libraries while directing requests to the SpinTopia endpoint, ensuring seamless integration into existing codebases without rewriting HTTP clients.

Base URL Override

Set the API base URL to https://api.spinstopia.cc/v1. This single configuration change redirects all standard speech requests to our engine, maintaining compatibility with the established request shape and authentication patterns.

Client Initialization

Initialize the client with your Bearer token and the overridden base URL. The authentication header Authorization: Bearer tts-... is handled automatically by the SDK, requiring no custom middleware or header manipulation for standard calls.

  • Use standard environment variables for key management
  • No custom client classes required

Method Compatibility

The audio/speech endpoint mirrors the OpenAI structure, supporting model, input, voice, response_format, and speed. You can call the same methods used for standard speech generation, receiving audio files directly in your application logic.

OpenAI SDK Integration

Error Handling

Sound wave illustration for: Error Handling

Errors return standard HTTP status codes with a JSON body containing an error code and message. Check the code field to identify the issue, such as invalid parameters or authentication failures, and adjust your request payload accordingly.

4xx Client Errors

Client errors (400–499) indicate issues with your request, such as missing required fields, invalid voice IDs, or exceeding the 4096-character input limit. Review the response body for the specific error code and correct your payload before retrying.

5xx Server Errors

Server errors (500–599) are rare but may occur during high load or temporary backend issues. These requests are free, so no characters are deducted. Wait a few seconds and retry the request; if the issue persists, contact support via email.

Rate Limit Responses

When you exceed the limit of 60 requests per minute, the API returns a 429 status code. Your key allows 10 requests per minute initially, increasing to 60 after the first top-up. Monitor the Retry-After header to determine when to resume sending requests.

Rate Limits

Sound wave illustration for: Rate Limits

Rate limits protect service stability for indie developers. Your API key allows 60 requests per minute under normal conditions. Failed requests do not consume quota, ensuring you are not penalized for transient errors.

60 Requests Per Minute

Standard usage permits 60 POST requests to /v1/audio/speech within a rolling 60-second window. This limit applies per API key. If you exceed this, you will receive a 429 Too Many Requests response.

10 Requests Initial Limit

New accounts start with a lower limit of 10 requests per minute. This applies until the first successful top-up. This restriction prevents abuse during the trial phase while allowing sufficient testing for short phrases.

Limit Reset Conditions

The 10-request limit resets immediately upon a successful USDT (TRC-20) top-up of at least $5. The standard 60-request limit resets continuously on a sliding window basis. No manual intervention is required.

Audio Formats

Sound wave illustration for: Audio Formats

The API supports five distinct audio formats to suit different deployment needs. You can choose between MP3, WAV, Opus, FLAC, or PCM by setting the response_format parameter in your request.

MP3 Output

MP3 is the default format, offering a good balance between file size and quality. It is ideal for web playback and general-purpose applications where bandwidth efficiency matters.

WAV Output

WAV provides uncompressed, high-fidelity audio. Use this format when you need lossless quality for professional video editing or archival purposes, accepting the larger file sizes.

Opus, FLAC, PCM Options

Opus offers efficient compression. FLAC provides lossless compression without the overhead of WAV. PCM delivers raw, uncompressed audio data for immediate processing pipelines.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. The engine does not support SSML tags for fine-grained control over pauses, pitch, or emphasis.

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. openai-python on GitHub
  4. LibriTTS-R corpus (OpenSLR 141)
  5. ISO 639 language codes
  6. LibriVox public-domain audiobooks
  7. LibriTTS-R paper (arXiv 2305.18802)
  8. Tether (USDT)
  9. IETF RFC 7845: Ogg Opus
  10. Node.js documentation
  11. W3C WAI: making audio and video accessible
  12. Creative Commons Attribution 4.0

More on this site