openapi: 3.1.0
info:
  title: SimpliSmart Speech-to-Text API (V3)
  description: |
    High-quality speech recognition and transcription services using Whisper V3 model.
  version: '1.0.0'

servers:
  - url: https://http.whisper.proxy.prod.s9t.link
    description: Production LLM Proxy Server

tags:
  - name: Speech to Text
    description: Speech recognition and transcription services using Whisper V3 model

paths:
  /model/infer/whisper:
    post:
      tags:
        - Speech to Text
      summary: Transcribe or translate audio using Whisper Large V3
      description: |
        Process audio files for transcription or translation with enhanced language support.
        Supports multiple audio formats and provides detailed word-level timestamps and speaker diarization.
      operationId: transcribeAudioV3
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WhisperV3Request'
            example:
              audio_data: "base64_encoded_audio_content"
              language: "en"
              task: "transcribe"
              word_timestamps: true
              diarization: false
              streaming: false
              batch_size: 24
              length_penalty: 1.0
              patience: 1.0
              vad_onset: 0.5
              vad_offset: 0.363
      responses:
        '200':
          description: Successful transcription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhisperV3Response'
        '400':
          description: Invalid request parameters
        '401':
          description: Unauthorized - Invalid token
        '500':
          description: Internal server error

components:
  schemas:
    WhisperV3Request:
      type: object
      required:
        - audio_data
        - language
        - task
      properties:
        audio_data:
          type: string
          description: "TEXT FIELD: This is a string field (not a file upload). Provide the audio as a base64-encoded string. First convert your audio file (.mp3, .wav, .flac) to base64, then paste the resulting string here."
          example: "base64_encoded_audio_content"
        language:
          type: string
          description: Language code (e.g. 'en' for English)
          example: "en"
        task:
          type: string
          enum: [transcribe, translate]
          description: Task type - transcribe in source language or translate to English
          example: "transcribe"
        initial_prompt:
          type: string
          description: Optional starting text prompt for context
          example: "Meeting transcript between John and Sarah:"
        beam_size:
          type: integer
          description: Number of parallel sequences evaluated
          minimum: 1
          maximum: 5
          default: 5
        best_of:
          type: integer
          description: Number of best sequences considered
          minimum: 1
          maximum: 5
          default: 5
        word_timestamps:
          type: boolean
          description: Include word-level timestamps
          default: false
        diarization:
          type: boolean
          description: Enable speaker diarization
          default: false
        vad_filter:
          type: boolean
          description: Enable voice activity detection filter
          default: true
        without_timestamps:
          type: boolean
          description: Exclude timestamps from output
          default: false
        streaming:
          type: boolean
          description: Enable streaming output
          default: false
        min_speakers:
          type: integer
          description: Minimum number of speakers to detect (0 for automatic)
          default: 0
          minimum: 0
        max_speakers:
          type: integer
          description: Maximum number of speakers to detect (0 for automatic)
          default: 0
          minimum: 0
        batch_size:
          type: integer
          description: Number of audio samples processed in one batch
          minimum: 0
          maximum: 24
          default: 24
        length_penalty:
          type: number
          description: Penalty for longer sequences (1.0 means no penalty)
          default: 1.0
          minimum: 0.0
        patience:
          type: number
          description: Beam search patience factor
          minimum: 0
          maximum: 1
          default: 1.0
        min_duration_off:
          type: number
          description: Minimum duration of silence for a break (seconds)
          default: 0.0
          minimum: 0.0
        min_duration_on:
          type: number
          description: Minimum duration for speech detection (seconds)
          default: 0.0
          minimum: 0.0
        vad_onset:
          type: number
          description: Voice activity detection onset threshold
          minimum: 0
          maximum: 1
          default: 0.5
        vad_offset:
          type: number
          description: Voice activity detection offset threshold
          minimum: 0
          maximum: 1
          default: 0.363
        pad_offset:
          type: number
          description: Additional padding at segment end (seconds)
          default: 0.0
          minimum: 0.0
        pad_onset:
          type: number
          description: Additional padding at segment start (seconds)
          default: 0.0
          minimum: 0.0
        max_duration:
          type: number
          description: Maximum duration to process (seconds)
          default: 30.0
          minimum: 0.0

    WhisperV3Response:
      type: object
      required:
        - transcription
        - request_time
        - language
      properties:
        transcription:
          type: array
          items:
            type: string
          description: Array of transcribed text segments
          example: ["Hello, this is a test.", "The audio quality is good."]
        segments:
          type: array
          items:
            type: object
            required:
              - start
              - end
              - text
            properties:
              start:
                type: number
                description: Start time of segment (seconds)
                example: 0.0
              end:
                type: number
                description: End time of segment (seconds)
                example: 2.5
              text:
                type: string
                description: Transcribed text
                example: "Hello, this is a test."
              words:
                type: array
                items:
                  type: object
                  required:
                    - word
                    - start
                    - end
                  properties:
                    word:
                      type: string
                      example: "Hello"
                    start:
                      type: number
                      example: 0.0
                    end:
                      type: number
                      example: 0.5
                description: Word-level timing information
        request_time:
          type: number
          description: Total processing time in seconds
          example: 2.5
        language:
          type: string
          description: Detected or specified language
          example: "en"

    Error:
      type: object
      required:
        - message
        - code
      properties:
        message:
          type: string
          description: Human-readable error message
        code:
          type: string
          description: Machine-readable error code
        data:
          type: object
          description: Additional error context

  responses:
    BadRequest:
      description: The request parameters were invalid or malformed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication failed or token is invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: An unexpected error occurred on the server
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'

  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token for authentication

security:
  - BearerAuth: [] 