{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google/json-schema/google-speech-generation-response-schema.json",
  "title": "SpeechGenerationResponse",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-speech-generation-api-openapi.yml#/components/schemas/SpeechGenerationResponse",
  "type": "object",
  "properties": {
    "candidates": {
      "type": "array",
      "description": "Generated audio candidates",
      "items": {
        "$ref": "#/$defs/AudioCandidate"
      }
    },
    "usageMetadata": {
      "$ref": "#/$defs/UsageMetadata",
      "description": "Token usage information"
    }
  },
  "$defs": {
    "AudioCandidate": {
      "type": "object",
      "properties": {
        "content": {
          "$ref": "#/$defs/AudioContent",
          "description": "Generated audio content"
        },
        "finishReason": {
          "type": "string",
          "enum": [
            "FINISH_REASON_UNSPECIFIED",
            "STOP",
            "MAX_TOKENS",
            "SAFETY",
            "RECITATION",
            "OTHER"
          ],
          "description": "Reason why generation stopped"
        },
        "index": {
          "type": "integer",
          "description": "Index of the candidate"
        }
      }
    },
    "AudioContent": {
      "type": "object",
      "properties": {
        "parts": {
          "type": "array",
          "description": "Audio data parts",
          "items": {
            "type": "object",
            "properties": {
              "inlineData": {
                "type": "object",
                "required": [
                  "mimeType",
                  "data"
                ],
                "properties": {
                  "mimeType": {
                    "type": "string",
                    "description": "MIME type of the audio (PCM format)"
                  },
                  "data": {
                    "type": "string",
                    "format": "byte",
                    "description": "Base64-encoded audio data (24kHz, 16-bit, mono PCM)"
                  }
                }
              }
            }
          }
        }
      }
    },
    "UsageMetadata": {
      "type": "object",
      "properties": {
        "promptTokenCount": {
          "type": "integer",
          "description": "Number of tokens in the prompt"
        },
        "candidatesTokenCount": {
          "type": "integer",
          "description": "Number of tokens in generated candidates"
        },
        "totalTokenCount": {
          "type": "integer",
          "description": "Total token count"
        }
      }
    }
  }
}