MLOS TTS • Quickstart

🚀 Quickstart: Using MLOS TTS in Your Browser

Available voices: en_male_01, en_female_01  • set via JSON field voice_id.

1. Log in and get your API key

Log in to the Dashboard → go to Account → API Keys → create or copy your key.

2. Try it instantly in the browser

Open the Try-It page, paste your x-api-key, enter text, then click Synthesize. The audio player will auto-play your result.

3. Call the API directly

Send a POST request to the TTS endpoint:

curl -X POST "https://tts.bryerstone.com/api/tts" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from MLOS TTS!",
    "voice_id": "en_male_01",
    "output_format": "wav",
    "return_base64": true
  }'
curl -X POST "https://tts.bryerstone.com/api/tts" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text":"Hello from MLOS TTS!", "voice_id":"en_female_01",
        "prompt_length":1, "sampling_rate":16000,
        "output_format":"wav", "return_base64": true }' \
  -o output.wav

The response will include audio as base64 or raw binary (depending on your headers).

Using Swagger with x-api-key

Swagger UI at /docs lets you call the API interactively, but you must supply your x-api-key.

  1. Log in to the Dashboard → go to Account → API Keys and copy your key.
  2. Open Swagger UI.
  3. Click the Authorize button (lock icon) and paste your key in the field named x-api-key.
  4. Or, when trying POST /api/tts, add a header manually:
    x-api-key: YOUR_API_KEY

Once authorized, you can use Try it out → Execute to generate speech right in Swagger.

Quickstart: Using the TTS API Server

This guide shows how to send text to tts.bryerstone.com and receive audio output in different programming languages.

📚 View API Examples in Multiple Languages


Python

import requests
API_URL = "https://tts.bryerstone.com/api/tts"
API_KEY = "YOUR_API_KEY"

payload = {
    "text": "Hello world, this is Bryerstone TTS!",
    "voice_id": "en_female_01",  # or "en_male_01"
    "prompt_length": 1,
    "sampling_rate": 16000,
    "output_format": "wav",
    "return_base64": False
}
headers = {"x-api-key": API_KEY, "Content-Type": "application/json"}
resp = requests.post(API_URL, json=payload, headers=headers)
open("output.wav","wb").write(resp.content)
curl -X POST "https://tts.bryerstone.com/api/tts" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text":"Hello from MLOS TTS!", "voice_id":"en_female_01",
        "prompt_length":1, "sampling_rate":16000,
        "output_format":"wav", "return_base64": true }' \
  -o output.wav
headers = {"x-api-key": API_KEY, "Content-Type": "application/json"} resp = requests.post(API_URL, json=payload, headers=headers) resp.raise_for_status() with open("output.wav", "wb") as f: f.write(resp.content) print("Saved audio to output.wav")

Note: x-api-key is required for /api/tts. Use Bearer <JWT> only for other /api/* routes (login, protected, etc.).

JavaScript (Node.js)

const fetch = require("node-fetch");
const fs = require("fs");

const API_URL = "https://tts.bryerstone.com/api/tts";
const API_KEY = "YOUR_API_KEY";

(async () => {
  const res = await fetch(API_URL, {
    method: "POST",
    headers: {
      "x-api-key": API_KEY,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      text: "Hello world, this is Bryerstone TTS!",
      voice_id: "en_male_01",
      prompt_length: 1,
      sampling_rate: 16000,
      output_format: "wav",
      return_base64: false
    })
  });
  if (!res.ok) throw new Error("HTTP " + res.status + ": " + (await res.text()));
  const buf = await res.buffer();
  fs.writeFileSync("output.wav", buf);
  console.log("Saved audio to output.wav");
})();

Note: x-api-key is required for /api/tts. Use Bearer <JWT> only for other /api/* routes (login, protected, etc.).

cURL

curl -X POST "https://tts.bryerstone.com/api/tts" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text":"Hello world, this is Bryerstone TTS!","voice_id":"en_male_01",
        "prompt_length":1, "sampling_rate":16000, "output_format":"wav", "return_base64": false }' \
  -o output.wav

Note: x-api-key is required for /api/tts. Use Bearer <JWT> only for other /api/* routes (login, protected, etc.).


Replace YOUR_API_KEY for calls to /api/tts. Use a JWT (from POST /api/login) only for other /api/* endpoints. See /examples for more sample scripts.