PixMind Docs
API Guides

Text to Speech API

List voices, synthesize speech, and retrieve audio with the PixMind API.

Convert a script into downloadable audio. Choose a voice from the configured provider catalogue, then submit a synchronous synthesis request.

OperationMethodEndpoint
List voicesGET/api-platform/v1/tts/voices
Synthesize speechPOST/api-platform/v1/tts/synthesize

Open TTS Playground · Create an API key

Authentication

Base URL: https://aihub-admin.aimix.pro

Use an enabled PixMind API key with audio permission. Send the key in the Authorization header. POST requests also require Content-Type: application/json.

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Quickstart

The following request uses the Microsoft route and an English voice. Synthesis returns the audio URL directly; there is no task polling step.

Create a narration
curl 'https://aihub-admin.aimix.pro/api-platform/v1/tts/synthesize' \
  -H "Authorization: Bearer $PIXMIND_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: narration-order-001' \
  -d '{
    "provider": "microsoft-api",
    "voiceId": "en-US-AriaNeural",
    "text": "Welcome to PixMind.",
    "format": "mp3"
  }'

Example response. The URL is illustrative; use the actual returned audioUrl.

200 · Speech synthesis result
{
  "code": 1000,
  "data": {
    "audioUrl": "https://example.com/narration.mp3",
    "format": "mp3",
    "provider": "microsoft-api",
    "model": "tts:microsoft-api",
    "type": "tts",
    "usage": {
      "characters": 19,
      "units": 1,
      "credits": 0
    }
  }
}

List voices

GET /api-platform/v1/tts/voices

Query parameters

ParameterTypeRequiredDefaultDescription
providerstringNoallA provider ID from the table below, or all. Only configured providers are returned.
languagestringNoallMicrosoft language code, such as en-US or zh-CN; maximum 40 characters. Other providers return their full group.
Find an English Microsoft voice
curl 'https://aihub-admin.aimix.pro/api-platform/v1/tts/voices?provider=microsoft-api&language=en-US' \
  -H "Authorization: Bearer $PIXMIND_API_KEY"

Voice catalogue response

The response groups voices by provider and language. Select the voice from the same provider you use for synthesis.

ProviderWhere to read voiceId
Microsoftgrouped[language][].id, or list[].key
Huoshangrouped.all[].id, or list[].key
Googlegrouped.all[].key; list is an object containing arrays grouped by model
MiniMax / Xjguoyugrouped.all[].key, or list[].key
Response structure · shortened example
{
  "code": 1000,
  "data": {
    "microsoft-api": {
      "grouped": {
        "en-US": [
          {
            "id": "en-US-AriaNeural",
            "name": "Aria",
            "gender": "Female",
            "lang": "英语(美国)",
            "en_lang": "English (American)",
            "type": "microsoft-api"
          }
        ]
      },
      "list": [
        {
          "key": "en-US-AriaNeural",
          "name": "Aria",
          "type": "microsoft-api"
        }
      ]
    }
  }
}

Catalogue entries may include example_voice_url for auditioning. Provider-specific metadata is preserved. An explicitly requested, unconfigured provider returns 503.

Synthesize speech

POST /api-platform/v1/tts/synthesize

Request body

ParameterTypeRequiredDefaultDescription
textstringYes—Non-blank script, 1–10,000 JavaScript UTF-16 code units. Whitespace counts toward length.
voiceIdstringYes—Voice ID from the selected provider's catalogue; maximum 200 characters.
providerstringNomicrosoft-apiExact provider ID, including case. See provider settings below.
formatstringNoProvider defaultAudio format accepted by that provider.
speednumberNoProvider defaultSpeech speed. Ranges differ by provider.
pitchnumberNo0Pitch adjustment. Google, Huoshan and Xjguoyu only accept 0.
volumenumberNoProvider defaultVolume within the provider's supported range.
stylePromptstringNo—Google only; maximum 2,000 characters.
emotionstringNo—MiniMax only; maximum 2,000 characters.
modelstringNoProvider defaultGoogle or MiniMax only; use a model supported by the configured provider. Maximum 2,000 characters.

Unknown request fields are rejected. Do not send app IDs, tenant IDs, billing fields or the website's internal context.

Provider settings

Provider IDFormatsDefault formatSpeed range / defaultVolume range / defaultPitch range / default
microsoft-apimp3mp3−100 to 100 / 00 to 100 / 100−100 to 100 / 0
google-genaimp3, wav, oggmp30 to 2 / 11 to 2 / 10 only
huoshan_big_modelmp3, wavmp30.8 to 2 / 10.5 to 2 / 10 only
MiniMaxmp3mp30.5 to 2 / 10 to 10 / 1−12 to 12 / 0
xjguoyuwavwav0 to 2 / 11 to 2 / 10 only

Omit optional controls to use that provider's defaults. A numeric value valid for one provider may be invalid for another.

Response fields

Field inside dataTypeDescription
audioUrlstringURL of the synthesized audio.
formatstringActual returned audio format.
providerstringSelected provider ID.
modelstringUsage-log identifier, such as tts:microsoft-api. This is not the optional request model.
typestringAlways tts.
durationnumber, optionalIncluded only when the synthesis service provides duration.
usage.charactersnumberInput length measured as JavaScript UTF-16 code units.
usage.unitsnumberCharacter count divided by 100, rounded up.
usage.creditsnumberActual API credits charged for the request.

SDK examples

TypeScript

Run this on your server with PIXMIND_API_KEY set. Generate one idempotency key for each intended narration and reuse it for any identical retry.

Node.js · synthesize narration
import { randomUUID } from "node:crypto";

const requestId = randomUUID();
const response = await fetch(
  "https://aihub-admin.aimix.pro/api-platform/v1/tts/synthesize",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.PIXMIND_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": requestId,
    },
    body: JSON.stringify({
      provider: "microsoft-api",
      voiceId: "en-US-AriaNeural",
      text: "Welcome to PixMind.",
      format: "mp3",
    }),
    signal: AbortSignal.timeout(120_000),
  },
);

const result = await response.json();
if (!response.ok || result.code !== 1000) {
  throw new Error(result.message ?? `HTTP ${response.status}`);
}

console.log(result.data.audioUrl);
console.log(result.data.usage);

Python

Python · synthesize narration
import os
import uuid
import requests

request_id = str(uuid.uuid4())
response = requests.post(
    "https://aihub-admin.aimix.pro/api-platform/v1/tts/synthesize",
    headers={
        "Authorization": "Bearer " + os.environ["PIXMIND_API_KEY"],
        "Idempotency-Key": request_id,
    },
    json={
        "provider": "microsoft-api",
        "voiceId": "en-US-AriaNeural",
        "text": "Welcome to PixMind.",
        "format": "mp3",
    },
    timeout=120,
)

result = response.json()
if not response.ok or result.get("code") != 1000:
    raise RuntimeError(result.get("message", "Speech synthesis failed"))

print(result["data"]["audioUrl"])
print(result["data"]["usage"])

Billing and availability

Paid providers bill in 100-character units, rounded up: Math.ceil(text.length / 100). JavaScript text.length counts UTF-16 code units, so some emoji count as two units of length. Microsoft currently charges zero API credits.

Query GET /api-platform/v1/tools with the same API key to read prices and ttsAvailability. Paid pricing uses GoogleTTS, HuoshanTTS, MiniMaxTTS and XjguoyuTTS. API usage is billed through the API wallet. The website's free-plan 100-character limit does not apply to this endpoint.

Synthesis or audio-output upload failure refunds the original charge. A timeout in your client does not establish whether the server finished; keep the original idempotency key.

Idempotency and retries

Idempotency-Key is optional, but recommended for synthesis. It accepts 1–128 printable ASCII characters and is retained for 24 hours within the API application and operation.

SituationBehaviour
Same key, same normalized request, completedReturns the cached result.
Same key, changed requestReturns 409.
Original request processing or result uncertainReturns 409; does not start another synthesis.

Do not automatically generate a new key after a timeout or conflict.

Errors

Errors use HTTP status plus a JSON envelope. Inspect both response.ok and code.

Example · invalid input
{
  "code": 400,
  "message": "text must contain 1 to 10000 characters.",
  "data": null
}
HTTP statusCommon causeNext step
400Empty text, unknown field, wrong voice/provider parameter, unsupported format or numeric rangeCorrect the request using the parameter tables.
401Missing, invalid or disabled API keyCheck the Bearer key and its status.
403The key does not allow audio accessEnable audio permission for this API key.
409Idempotency conflict or processing/uncertain original requestKeep the original request ID; avoid a duplicate submission.
429API rate limit or concurrency limitRespect the applicable limit; do not submit a new duplicate request.
503Requested speech provider is not configuredSelect a provider marked available by the tools catalogue.
5xxSynthesis or output delivery failureInspect the public message and API usage log before retrying.

On this page