{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sunbird-ai/json-schema/sunbird-ai-speech-response-schema.json",
  "title": "SpeechResponse",
  "description": "Normalized response for response_mode='url' across all providers.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/sunbird-ai-api-openapi.json#/components/schemas/SpeechResponse",
  "properties": {
    "audio_url": {
      "type": "string",
      "title": "Audio Url",
      "description": "Signed URL to the generated audio."
    },
    "model": {
      "type": "string",
      "title": "Model",
      "description": "Model used."
    },
    "platform": {
      "type": "string",
      "title": "Platform",
      "description": "Platform used."
    },
    "voice": {
      "type": "string",
      "title": "Voice",
      "description": "Speaker name actually served."
    },
    "audio_url_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Audio Url Expires At"
    },
    "language": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Language"
    },
    "sample_rate": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sample Rate"
    },
    "duration_seconds": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Duration Seconds"
    },
    "gcs_object": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Gcs Object"
    },
    "request_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Request Id"
    },
    "timings_ms": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Timings Ms"
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/SpeechUsage"
        },
        {
          "type": "null"
        }
      ],
      "description": "Usage for this synthesis (characters, bytes, seconds)."
    },
    "warnings": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Warnings",
      "description": "Deprecation notices for this request (e.g. a legacy speaker id was passed as `voice`). Absent when there is nothing to warn about."
    }
  },
  "type": "object",
  "required": [
    "audio_url",
    "model",
    "platform",
    "voice"
  ],
  "$defs": {
    "SpeechUsage": {
      "properties": {
        "input_characters": {
          "type": "integer",
          "title": "Input Characters",
          "description": "Number of characters in the synthesized text"
        },
        "output_audio_bytes": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output Audio Bytes",
          "description": "Size of the generated audio in bytes"
        },
        "duration_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Duration Seconds",
          "description": "Duration of the generated audio in seconds"
        }
      },
      "type": "object",
      "required": [
        "input_characters"
      ],
      "title": "SpeechUsage",
      "description": "Usage for text-to-speech requests (character-count convention)."
    }
  }
}