Documentation/Integration guide/Voice & Speech: Text-to-Speech & Speech-to-Text
Integration guide

Voice & Speech: Text-to-Speech & Speech-to-Text

Neural Text-to-Speech across provider-supported voices and high-speed Speech-to-Text audio transcription.

4 min read
•Updated October 21, 2026

Multimodal Audio Processing

The platform provides full multimodal audio processing powered by dedicated GPU clusters: Text-to-Speech (TTS) via POST /v1/audio/speech (3 credits) and Speech-to-Text (STT) transcription via POST /v1/audio/transcriptions (1 credit).

Neural Text-to-Speech (TTS)

POST /v1/audio/speech accepts model_alias=voice-v1, input text, gender, voice_style, speed, and format. It synthesizes expressive, natural human speech across provider-supported speaker styles and returns a signed outputUrl.

Neural Speech-to-Text (STT)

POST /v1/audio/transcriptions accepts multipart/form-data with file and optional model (transcribe-v1), model_alias, language, prompt and temperature. Upload audio up to 25 MB. It returns a JSON text transcript; timestamps, confidence scores and streaming responses are not part of the declared contract.

Code Implementation

import os
import time
import requests

BASE = "https://api.apimarketplace.com"
headers = {"Authorization": "Bearer " + os.environ["API_KEY"]}

def call(method, path, **kwargs):
    response = requests.request(method, BASE + path, headers=headers, timeout=300, **kwargs)
    response.raise_for_status()
    return response.json() if response.content else None

def wait(path, success):
    deadline = time.monotonic() + 900
    while time.monotonic() < deadline:
        result = call("GET", path)
        if result["status"] == success:
            return result
        if result["status"] == "failed":
            raise RuntimeError(result.get("errorMessage") or "Generation failed")
        time.sleep(3)
    raise TimeoutError("Still pending; keep the returned ID and check later")

payload = {'model': 'transcribe-v1', 'language': 'en'}
with open("recording.mp3", "rb") as audio:
    result = call("POST", "/v1/audio/transcriptions", files={"file": ("recording.mp3", audio, "audio/mpeg")}, data=payload)
print(result)


# Text-to-speech is a separate JSON request.
import os
import time
import requests

BASE = "https://api.apimarketplace.com"
headers = {"Authorization": "Bearer " + os.environ["API_KEY"]}

def call(method, path, **kwargs):
    response = requests.request(method, BASE + path, headers=headers, timeout=300, **kwargs)
    response.raise_for_status()
    return response.json() if response.content else None

def wait(path, success):
    deadline = time.monotonic() + 900
    while time.monotonic() < deadline:
        result = call("GET", path)
        if result["status"] == success:
            return result
        if result["status"] == "failed":
            raise RuntimeError(result.get("errorMessage") or "Generation failed")
        time.sleep(3)
    raise TimeoutError("Still pending; keep the returned ID and check later")

payload = {'model_alias': 'voice-v1',
 'input': 'Welcome to API Marketplace.',
 'voice_style': 'neutral',
 'gender': 'female',
 'speed': 1.0,
 'format': 'mp3'}
result = call('POST', '/v1/audio/speech', json=payload)
print(result)