# Paxa Labs API

The Paxa API is one HTTP API for Thai, English, and Mandarin Chinese text to speech, Thai-first speech to text, document OCR, and translation into Thai. Create a key, send one POST request, and get audio back.

The Paxa API converts text into speech with [Paxa TTS Flash v2](https://paxalabs.com/text-to-speech), the flagship Thai, English, and Mandarin Chinese TTS model. [Transcription](https://paxalabs.com/docs/speech-to-text) turns recordings of Thai speech, and of other languages, into verbatim text with word timestamps. [OCR](https://paxalabs.com/docs/ocr) reads PDFs and images into Markdown or structured blocks, and [Document Extraction](https://paxalabs.com/docs/extraction) fills a schema of typed fields from them. [Translation](https://paxalabs.com/docs/translation) renders any language into Thai with register control and glossaries. Requests are priced in credits. Audio arrives as a complete file or [streamed](https://paxalabs.com/docs/streaming), with [word-level timing](https://paxalabs.com/docs/timestamps) on request. A [live WebSocket](https://paxalabs.com/docs/live-streaming) carries two-way conversations. An [OpenAI-compatible endpoint](https://paxalabs.com/docs/openai-compatibility) accepts existing OpenAI SDK code after a change of base URL.

## Send your first request

1. Create an API key: Create a key in the [dashboard](https://paxalabs.com/app/keys). The full key is shown once, at creation. Store it as `PAXA_API_KEY` in your environment.
2. Send the request: POST your text and a `voice` to `/v1/tts`. The response body is the MP3 audio.
3. Play the audio: The example saves `speech.mp3`. New accounts start with 100 free credits, which covers about 10,000 characters.

curl:

```bash
curl -X POST https://api.paxalabs.com/v1/tts \
  -H "Authorization: Bearer $PAXA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "สวัสดีครับ ยินดีต้อนรับสู่ Paxa Labs",
    "voice": "khanomkrok",
    "model": "paxa-tts-flash-v2"
  }' \
  --output speech.mp3
```

TypeScript:

```typescript
import { writeFile } from "node:fs/promises";

const response = await fetch("https://api.paxalabs.com/v1/tts", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PAXA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    text: "สวัสดีครับ ยินดีต้อนรับสู่ Paxa Labs",
    voice: "khanomkrok",
    model: "paxa-tts-flash-v2",
  }),
});

if (!response.ok) throw new Error(`TTS failed: ${response.status}`);
await writeFile("speech.mp3", Buffer.from(await response.arrayBuffer()));
```

Python:

```python
import os
import requests

response = requests.post(
    "https://api.paxalabs.com/v1/tts",
    headers={"Authorization": f"Bearer {os.environ['PAXA_API_KEY']}"},
    json={"text": "สวัสดีครับ ยินดีต้อนรับสู่ Paxa Labs", "voice": "khanomkrok", "model": "paxa-tts-flash-v2"},
)
response.raise_for_status()

with open("speech.mp3", "wb") as f:
    f.write(response.content)
```

Coding agents start at [/llms.txt](https://paxalabs.com/llms.txt). See [coding agents](https://paxalabs.com/docs/agents) for the skill and the full corpus, or connect the [MCP server](https://paxalabs.com/docs/mcp) to give an agent the API as tools.

## Base URL

Every endpoint sits under `https://api.paxalabs.com`. The API is served over HTTPS only. Every failure returns an RFC 9457 problem+json body carrying a stable machine-readable code. See [Errors](https://paxalabs.com/docs/errors) for the full catalog.

> The API is in beta. When synthesis capacity is unavailable, requests answer `provider_unavailable` and nothing is charged.

## All pages

- [Create and send API keys](https://paxalabs.com/docs/authentication)
- [MCP server](https://paxalabs.com/docs/mcp)
- [Load docs into a coding agent](https://paxalabs.com/docs/agents)
- [Generate speech from text](https://paxalabs.com/docs/text-to-speech)
- [Stream audio as it is generated](https://paxalabs.com/docs/streaming)
- [Get word-level timestamps](https://paxalabs.com/docs/timestamps)
- [Direct the delivery with tags](https://paxalabs.com/docs/directions)
- [Add pauses](https://paxalabs.com/docs/pauses)
- [Control variation with temperature](https://paxalabs.com/docs/temperature)
- [Emotion tags on Paxa TTS Flash (v1)](https://paxalabs.com/docs/emotion-tags)
- [Designed voices](https://paxalabs.com/docs/designed-voices)
- [Two-way live speech over WebSocket](https://paxalabs.com/docs/live-streaming)
- [Optimize latency](https://paxalabs.com/docs/latency)
- [Transcribe recordings](https://paxalabs.com/docs/speech-to-text)
- [Read documents with OCR](https://paxalabs.com/docs/ocr)
- [Extract fields from documents](https://paxalabs.com/docs/extraction)
- [Translate text into Thai](https://paxalabs.com/docs/translation)
- [Credits, charges, and refunds](https://paxalabs.com/docs/credits)
- [Rate limits and concurrency](https://paxalabs.com/docs/rate-limits)
- [Make retries safe with idempotency keys](https://paxalabs.com/docs/idempotency)
- [Error codes and responses](https://paxalabs.com/docs/errors)
- [Use the OpenAI SDK with Paxa](https://paxalabs.com/docs/openai-compatibility)
- [Switch from OpenAI text to speech and Whisper](https://paxalabs.com/docs/migrate-from-openai)
- [Use Paxa in apps and frameworks](https://paxalabs.com/docs/integrations)
- [Use Paxa with Open WebUI](https://paxalabs.com/docs/integrations/open-webui)
- [Use Paxa with LibreChat](https://paxalabs.com/docs/integrations/librechat)
- [Use Paxa with AnythingLLM](https://paxalabs.com/docs/integrations/anythingllm)
- [Use Paxa with Home Assistant](https://paxalabs.com/docs/integrations/home-assistant)
- [Use Paxa with SillyTavern](https://paxalabs.com/docs/integrations/sillytavern)
- [Use Paxa with LiveKit Agents](https://paxalabs.com/docs/integrations/livekit)
- [Use Paxa with Strands Agents](https://paxalabs.com/docs/integrations/strands)
- [Synthesize speech](https://paxalabs.com/docs/api/text-to-speech)
- [Synthesize speech (OpenAI-compatible)](https://paxalabs.com/docs/api/speech)
- [Live speech](https://paxalabs.com/docs/api/live)
- [Design a voice](https://paxalabs.com/docs/api/voice-design)
- [List designed voices](https://paxalabs.com/docs/api/designed-voices)
- [Save a designed voice](https://paxalabs.com/docs/api/save-voice)
- [Rename a designed voice](https://paxalabs.com/docs/api/rename-voice)
- [Delete a designed voice](https://paxalabs.com/docs/api/delete-voice)
- [Transcribe a recording](https://paxalabs.com/docs/api/stt)
- [Realtime transcription](https://paxalabs.com/docs/api/stt-live)
- [Transcribe a recording (OpenAI-compatible)](https://paxalabs.com/docs/api/transcriptions)
- [Read a document](https://paxalabs.com/docs/api/ocr)
- [Extract fields from a document](https://paxalabs.com/docs/api/extract)
- [Translate text](https://paxalabs.com/docs/api/translate)
- [List models](https://paxalabs.com/docs/api/models)
- [List voices](https://paxalabs.com/docs/api/voices)
- [List voices for OpenAI-compatible apps](https://paxalabs.com/docs/api/audio-voices)
- [List speech models for OpenAI-compatible apps](https://paxalabs.com/docs/api/audio-models)
- [Get key, balance, and plan](https://paxalabs.com/docs/api/me)
- [Send feedback](https://paxalabs.com/docs/api/feedback)
- [List feedback](https://paxalabs.com/docs/api/feedback-list)
- [Health check](https://paxalabs.com/docs/api/health)
- [API changelog](https://paxalabs.com/docs/changelog)
