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

# Speech-to-text

> POST /v1/audio/transcriptions — transcribe audio to text.

We accept **both multipart and JSON base64** for STT, so the OpenAI SDK works out of the box.

## Multipart (OpenAI SDK default)

```python theme={null}
from openai import OpenAI
client = OpenAI(api_key=API_KEY, base_url="https://api.infery.ai/v1")
tr = client.audio.transcriptions.create(
    model="whisper-1",
    file=open("meeting.mp3", "rb"),
    response_format="verbose_json",
)
print(tr.text)
```

## JSON base64 (light HTTP clients)

```bash theme={null}
curl https://api.infery.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $INFERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "whisper-1",
    "file_base64": "<base64 audio>",
    "filename": "meeting.mp3",
    "response_format": "json"
  }'
```

## Response formats

`json` (default), `text`, `srt`, `verbose_json` (with segments + word timestamps), `vtt`.

## Limits

* Max 25 MB audio per request
* Formats: MP3, MP4, M4A, WAV, WebM, OGG, FLAC


## OpenAPI

````yaml openapi.json POST /v1/audio/transcriptions
openapi: 3.0.0
info:
  title: Infery Gateway
  description: >-
    Infery Inference Gateway — OpenAI-compatible API for LLMs, embeddings,
    images, audio, and video
  version: '1.0'
  contact: {}
servers:
  - url: https://api.infery.ai
    description: Production
  - url: http://localhost:3001
    description: Local
security: []
tags: []
paths:
  /v1/audio/transcriptions:
    post:
      tags:
        - Audio
      summary: Speech-to-text
      operationId: createTranscription
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - audio
              properties:
                model:
                  type: string
                  description: Model ID to use for STT
                audio:
                  type: string
                  description: Base64-encoded audio data
                language:
                  type: string
                  description: Language of the audio (ISO-639-1)
                response_format:
                  type: string
                  enum:
                    - json
                    - text
                    - srt
                    - verbose_json
                    - vtt
                  default: json
      responses:
        '200':
          description: >-
            Transcription result. Shape depends on `response_format`: JSON
            (`json`, `verbose_json`) or plain text (`text`, `srt`, `vtt`).
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: 'response_format: json (default) or verbose_json'
                    properties:
                      text:
                        type: string
                        example: Hello, this is a test transcription.
                      language:
                        type: string
                        example: en
                        description: Detected language (verbose_json only)
                      duration:
                        type: number
                        example: 12.5
                        description: Audio duration in seconds (verbose_json only)
                      segments:
                        type: array
                        description: Time-stamped segments (verbose_json only)
                        items:
                          type: object
                          properties:
                            id:
                              type: integer
                            start:
                              type: number
                              description: Segment start time in seconds
                            end:
                              type: number
                              description: Segment end time in seconds
                            text:
                              type: string
                            avg_logprob:
                              type: number
                            compression_ratio:
                              type: number
                            no_speech_prob:
                              type: number
                      credits_used:
                        type: integer
                        example: 3
                  - type: string
                    description: 'response_format: text | srt | vtt'
                    example: Hello, this is a test transcription.
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '401':
          description: Unauthorized — invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '404':
          description: Model not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      security:
        - ApiKey: []
components:
  schemas:
    ErrorResponseDto:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetailDto'
      required:
        - error
    ErrorDetailDto:
      type: object
      properties:
        message:
          type: string
          example: Model not found
          description: Human-readable error message
        type:
          type: string
          example: invalid_request_error
          description: Error category
          enum:
            - invalid_request_error
            - authentication_error
            - permission_error
            - quota_exceeded
            - rate_limit_error
            - server_error
        code:
          type: object
          example: model_not_found
          nullable: true
          description: Stable machine-readable error code
        param:
          type: object
          example: model
          nullable: true
          description: >-
            Name of the request parameter that triggered the error, if
            applicable
      required:
        - message
        - type
        - code
        - param
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: 'API key in format: Bearer inf_***'

````