Speko Docs
API Reference

Synthesize

Routes the request to the best TTS provider for your intent, with automatic failover. Returns binary audio. The `Content-Type` header (mirrored in `X-Speko-Audio-Format`) tells you the format.

POST
/v1/synthesize

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/octet-stream

application/json

application/json

application/json

application/json

"string"
{
  "error": "Invalid request",
  "code": "VALIDATION_ERROR",
  "issues": [
    {
      "path": "to",
      "message": "Required"
    }
  ],
  "retryable": false,
  "docs_url": "https://docs.speko.dev/errors/validation_error"
}
{
  "error": "Unauthorized",
  "code": "UNAUTHORIZED"
}
{
  "error": "Text is 8000 characters, and no provider for this request can synthesize it in one request. Split the text into parts of at most 5000 characters and send each part as its own request.",
  "code": "TEXT_TOO_LONG",
  "textLength": 8000,
  "maxChars": 5000
}
{
  "error": "All providers failed",
  "code": "SYNTHESIZE_FAILED"
}