{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sunbird-ai/json-schema/sunbird-ai-stttranscript-schema.json",
  "title": "STTTranscript",
  "description": "Result of a speech-to-text request: transcribed text, optional diarization and timestamps, and metadata.",
  "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/STTTranscript",
  "properties": {
    "audio_transcription": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Audio Transcription",
      "description": "The transcribed text from the audio"
    },
    "diarization_output": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Diarization Output",
      "description": "Speaker diarization data"
    },
    "formatted_diarization_output": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Formatted Diarization Output",
      "description": "Human-readable diarization output"
    },
    "audio_transcription_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Audio Transcription Id",
      "description": "Database ID of the saved transcription"
    },
    "audio_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Audio Url",
      "description": "URL or path to the processed audio file"
    },
    "language": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Language",
      "description": "The language code used for transcription"
    },
    "was_audio_trimmed": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Was Audio Trimmed",
      "description": "Whether the audio was trimmed to max duration",
      "default": false
    },
    "original_duration_minutes": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Original Duration Minutes",
      "description": "Original duration in minutes if audio was trimmed"
    },
    "segments": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/TranscriptionSegment"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Segments",
      "description": "Timestamped segments. Only populated when the request sets timestamps=true"
    },
    "duration_seconds": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Duration Seconds",
      "description": "Duration of the transcribed audio in seconds"
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/AudioUsage"
        },
        {
          "type": "null"
        }
      ],
      "description": "Usage for this transcription (audio duration in seconds)"
    }
  },
  "type": "object",
  "$defs": {
    "AudioUsage": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "duration",
            "tokens"
          ],
          "title": "Type",
          "description": "Which usage variant this object carries",
          "default": "duration"
        },
        "seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Seconds",
          "description": "Duration of the transcribed audio in seconds"
        },
        "input_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Input Tokens",
          "description": "Input tokens, when the ASR backend reports them"
        },
        "output_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output Tokens",
          "description": "Output tokens, when the ASR backend reports them"
        },
        "total_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Total Tokens",
          "description": "Total tokens, when the ASR backend reports them"
        }
      },
      "type": "object",
      "title": "AudioUsage",
      "description": "Usage for speech-to-text requests (OpenAI transcription shape)."
    },
    "TranscriptionSegment": {
      "properties": {
        "start": {
          "type": "number",
          "title": "Start",
          "description": "Segment start time in seconds"
        },
        "end": {
          "type": "number",
          "title": "End",
          "description": "Segment end time in seconds"
        },
        "text": {
          "type": "string",
          "title": "Text",
          "description": "Text transcribed for this segment"
        }
      },
      "type": "object",
      "required": [
        "start",
        "end",
        "text"
      ],
      "title": "TranscriptionSegment",
      "description": "A single timestamped span of transcribed audio."
    }
  }
}