> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voxnexus.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Speech to Text

> Convert audio file to text, returns complete recognition result



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/stt
openapi: 3.0.0
info:
  title: VoxNexus API
  version: 1.0.0
  description: VoxNexus API Documentation
  contact:
    name: API Support
    url: https://voxnexus.ai/support
    email: support@voxnexus.ai
servers:
  - url: https://api.voxnexus.ai
security: []
paths:
  /v1/stt:
    post:
      tags:
        - stt
      summary: Speech to Text
      description: Convert audio file to text, returns complete recognition result
      operationId: speechToText
      parameters:
        - name: model_id
          in: query
          description: |
            Model identifier (required). Specifies which model to use for STT.
          required: true
          schema:
            type: string
            example: vn-stt-basic
        - name: language
          in: query
          description: >
            Language or locale code (optional, default: "en-US"). Supports both
            ISO 639-1 language codes (e.g. "en", "zh") 

            and BCP 47 locale codes (e.g. "en-US", "zh-CN"). When a language
            code is provided, 

            the system will automatically resolve it to the most common locale
            (e.g. "en" -> "en-US").

            Improves recognition performance if provided, otherwise
            auto-detected by service.
          required: false
          schema:
            type: string
            default: en-US
            example: en-US
        - name: sample_rate
          in: query
          description: 'Sample rate (required, unit: Hz, e.g. 16000, 22050, 44100, 48000)'
          required: true
          schema:
            type: integer
            minimum: 1
            example: 16000
        - name: enable_timestamps
          in: query
          description: Whether to return timestamps (optional, default false)
          required: false
          schema:
            type: boolean
            default: false
        - name: enable_speaker_diarization
          in: query
          description: Whether to enable speaker diarization (optional, default false)
          required: false
          schema:
            type: boolean
            default: false
        - name: enable_llm_transform
          in: query
          description: >
            Whether to enable LLM post-processing on the STT transcript
            (optional, default false).

            When enabled, the recognized `transcript` is passed to the LLM with
            the specified `llm_prompt`,

            and the transformed result is returned in the `text` field.

            If LLM transform fails, `text` falls back to the raw transcript (no
            error is returned).

            **This feature requires whitelist access. Contact
            support@voxnexus.ai to request access.**
          required: false
          schema:
            type: boolean
            default: false
        - name: llm_prompt
          in: query
          description: >
            LLM transform instruction (required when
            `enable_llm_transform=true`).

            Describes what the LLM should do with the transcript, e.g. "correct
            punctuation",

            "rewrite in a humorous tone", "translate to English", "summarize key
            points".

            The LLM applies this instruction freely — the service does not
            interpret its semantics.
          required: false
          schema:
            type: string
            example: Correct punctuation and remove filler words
        - name: llm_model_id
          in: query
          description: >
            LLM model ID (optional). Falls back to the server-configured default
            model when not specified.

            Routing is prefix-based: `claude-*` models route to Anthropic; all
            other model IDs route to OpenAI.

            Examples: `claude-haiku-4-5-20251001` (Anthropic), `gpt-4.1`
            (OpenAI).
          required: false
          schema:
            type: string
            example: claude-haiku-4-5-20251001
        - name: llm_max_tokens
          in: query
          description: >
            Maximum output tokens for LLM transform (optional). Falls back to
            the server default when not specified.
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 4096
            example: 1024
      requestBody:
        required: true
        content:
          audio/wav:
            schema:
              type: string
              format: binary
          audio/mpeg:
            schema:
              type: string
              format: binary
          audio/pcm:
            schema:
              type: string
              format: binary
          application/octet-stream:
            schema:
              type: string
              format: binary
      responses:
        '200':
          description: Successfully returns recognition result
          headers:
            X-Request-ID:
              schema:
                type: string
              description: Request ID
            X-Language:
              schema:
                type: string
              description: Detected language code
            X-Duration-Ms:
              schema:
                type: integer
              description: Audio duration in milliseconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/STTResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Insufficient credits or rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    STTResponse:
      type: object
      properties:
        request_id:
          type: string
          description: Request ID
          example: req_1234567890
        language:
          type: string
          description: Detected language code, e.g. en, en-US
          example: en
        transcript:
          type: string
          description: >
            Raw STT recognition output (original ASR text before any LLM
            processing).

            Always present; identical to `text` when LLM transform is not
            enabled.
          example: Hello this is a test message
        text:
          type: string
          description: >
            Final output text. When LLM transform is enabled and succeeds, this
            contains

            the LLM-transformed result; otherwise it equals `transcript`.
          example: Hello, this is a test message.
        duration_ms:
          type: integer
          description: Audio duration in milliseconds
          example: 2500
        words:
          type: array
          description: Word-level information (if timestamps are enabled)
          items:
            $ref: '#/components/schemas/STTWordInfo'
        speakers:
          type: array
          description: Speaker information (if speaker diarization is enabled)
          items:
            $ref: '#/components/schemas/STTSpeakerInfo'
        created_at:
          type: string
          format: date-time
          description: Creation time
          example: '2024-01-01T12:00:00Z'
      required:
        - request_id
        - transcript
        - text
        - duration_ms
        - created_at
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: Invalid request parameters
        code:
          type: string
          description: Error code
          example: INVALID_REQUEST
        details:
          type: string
          description: Detailed error information (optional)
          example: Detailed error information
        request_id:
          type: string
          description: Request ID (optional)
          example: req_1234567890
      required:
        - error
    STTWordInfo:
      type: object
      properties:
        word:
          type: string
          description: Word
          example: hello
        offset:
          type: integer
          description: Word offset in audio stream (milliseconds)
          example: 0
        duration:
          type: integer
          description: Word duration (milliseconds)
          example: 500
        confidence:
          type: number
          format: float
          description: Confidence score 0.0-1.0
          minimum: 0
          maximum: 1
          example: 0.98
      required:
        - word
    STTSpeakerInfo:
      type: object
      properties:
        speaker_id:
          type: string
          description: Speaker ID
          example: speaker_1
        text:
          type: string
          description: Text spoken by this speaker
          example: Hello, this is a test message.
        offset:
          type: integer
          description: Speaker text offset in audio stream (milliseconds)
          example: 0
        duration:
          type: integer
          description: Speaker text duration (milliseconds)
          example: 2500
      required:
        - speaker_id
        - text
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: Authenticate using X-Api-Key header

````