{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/beatra-ai/json-schema/beatra-ai-text-to-speech-request-schema.json",
  "title": "TextToSpeechRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/beatra-ai-audio-api-openapi.yml#/components/schemas/TextToSpeechRequest",
  "properties": {
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Metadata",
      "description": "Caller-supplied metadata; ≤16 keys, key ≤64 chars, value ≤512 chars"
    },
    "callback_url": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "pattern": "^https://"
        },
        {
          "type": "null"
        }
      ],
      "title": "Callback Url",
      "description": "HTTPS URL beatra will POST the final Task envelope to when the Task reaches a terminal state"
    },
    "callback_signing_key_id": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64,
          "minLength": 1,
          "pattern": "^whkey_[A-Za-z0-9]+$"
        },
        {
          "type": "null"
        }
      ],
      "title": "Callback Signing Key Id",
      "description": "Optional standalone callback signing key. Omit for unsigned callback delivery; requires callback_url when provided."
    },
    "model_options": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model Options",
      "description": "Per-model-family passthrough options; opaque to the platform, validated per model"
    },
    "voice": {
      "type": "string",
      "title": "Voice",
      "description": "Opaque beatra voice_id (preset or cloned)"
    },
    "input": {
      "type": "string",
      "maxLength": 50000,
      "minLength": 1,
      "title": "Input",
      "description": "Text to synthesize. It may contain speech markup such as {pause 0.5}, {laugh}, {pron 行 hang2} or {sub W3C 万维网联盟}; read the vocabulary and limits from the model card (beatra.models.list)."
    },
    "model": {
      "type": "string",
      "enum": [
        "auto",
        "minimax-speech-2.8-hd",
        "minimax-speech-2.8-turbo",
        "doubao-seed-tts-2.0"
      ],
      "title": "Model",
      "description": "TTS model; 'auto' picks a model compatible with the voice",
      "default": "auto"
    },
    "language": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 32,
          "minLength": 2
        },
        {
          "type": "null"
        }
      ],
      "title": "Language",
      "description": "Optional BCP-47 language tag, for example zh-CN, yue-HK, or en-US. 'auto' explicitly asks the engine to detect the spoken language. Read supported_languages from the selected model's catalog card. When omitted, the voice or provider chooses the language."
    },
    "format": {
      "type": "string",
      "enum": [
        "mp3",
        "wav",
        "flac",
        "opus",
        "pcm"
      ],
      "title": "Format",
      "default": "mp3"
    },
    "sample_rate": {
      "anyOf": [
        {
          "type": "integer",
          "enum": [
            8000,
            16000,
            22050,
            24000,
            32000,
            44100
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Sample Rate"
    },
    "speed": {
      "type": "number",
      "maximum": 2.0,
      "minimum": 0.5,
      "title": "Speed",
      "default": 1.0
    },
    "volume": {
      "type": "number",
      "maximum": 10.0,
      "exclusiveMinimum": 0.0,
      "title": "Volume",
      "default": 1.0
    },
    "pitch": {
      "type": "number",
      "maximum": 1.0,
      "minimum": -1.0,
      "title": "Pitch",
      "description": "Pitch adjustment from -1 to 1: 0 keeps the voice's original pitch, -1 is the lowest and 1 the highest the selected model supports. Use decimals such as 0.25 or -0.5 for subtle tuning.",
      "default": 0.0
    },
    "emotion": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "happy",
            "sad",
            "angry",
            "fearful",
            "disgusted",
            "surprised",
            "calm",
            "fluent"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Emotion",
      "description": "Provider-neutral discrete speaking emotion"
    },
    "subtitle_enable": {
      "type": "boolean",
      "title": "Subtitle Enable",
      "description": "Request sentence-level subtitles with the audio. Subtitles are free; when present, output.subtitles carries the subtitle file URL and format.",
      "default": false
    },
    "direction": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Direction",
      "description": "Optional natural-language performance direction for the whole request, for example '像在耳边说悄悄话一样，轻声地说' or 'read it like breaking news'. Models and voices that follow it list direction under controls on their model card (with direction_max_characters); anywhere else it is ignored with an option_ignored warning. Effects vary with the voice and the text and are not a guarantee of intensity."
    },
    "previous_text": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Previous Text",
      "description": "Optional text that comes right before this clip, for example the previous line of a dialogue or the previous paragraph, so separate calls keep a continuous tone. It is never spoken and never billed; any length is accepted and only its end is used (previous_text_tail_characters on the model card). Models and voices that do not use it ignore it with an option_ignored warning."
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "voice",
    "input"
  ]
}