Skip to content
Browse the docs

API reference · Audio

Create speech

POSThttps://api.useunbound.ai/v1/audio/speech

Says a text aloud and answers with the sound as MP3. Priced by the characters of the text, or by the seconds it makes for a model with a price per minute of sound: the price, or the most it can be, is held before it is made and charged only if it is delivered. The sound is also kept in your Library. A parameter that cannot be honoured is rejected with 400.

Headers

  • Authorizationstringrequired

    Bearer <key>, with a key from Settings → API.

  • Idempotency-Keystring

    Any unique string up to 180 characters. Repeating a request with the same key returns the same sound and is charged once.

Body

application/json

  • modelstringrequired

    An id from GET /v1/models with "type": "tts".

  • inputstringrequired

    The text to say, up to the limit of the model.

  • voicestring

    A voice of the model. Without it, its first one.

  • response_formatstringdefault "mp3"

    Only MP3 today.

    One ofmp3

Errors

  • 400The request is malformed, or a parameter is not supported by the model.
  • 401The API key is missing, revoked or expired.
  • 402Not enough credit, or the key reached its spending limit. Nothing was charged.
  • 403The key does not have the scope this endpoint needs.
  • 404The model does not exist or is not available through the API.
  • 409The request was cancelled before it finished. Nothing was charged.
  • 413The request body is larger than 1 MB.
  • 429Too many requests for this key. Retry after the number of seconds in the Retry-After header.
  • 502The upstream provider failed. The hold was released; you were not charged.

All errors use the envelope described in the introduction. None of them result in a charge.