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

# Speech to Text (Beta)

> <b>Transcribe audio files to text using AI models</b>

Converts audio files to text using Uplift's speech recognition models optimized for Urdu language.

**Model Selection:**
- **scribe**: Full accuracy model - 40 credits per minute
- **scribe-mini**: Cost-effective model - 20 credits per minute (50% cheaper)

**Domain Optimization:**
Use the `domain` parameter for improved accuracy in specialized contexts:
- **phone-commerce**: Optimized for e-commerce conversations
- **farming**: Optimized for agricultural terminology


<Note>
  This API is currently in beta. Features and pricing may change.
</Note>

<ResponseExample>
  ```json Response theme={null}
  {
    "text": "آج کا موسم کیسا ہے؟ میں نے سنا ہے کہ بارش ہونے والی ہے۔"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /transcribe/speech-to-text
openapi: 3.1.0
info:
  title: UpliftAI API
  version: 1.0.0
  description: >
    API for UpliftAI messaging, media handling, and text-to-speech capabilities.
    This API enables real-time communication

    with AI assistants, supporting various content types including text, images,
    audio,

    and documents. It provides both synchronous and asynchronous messaging
    capabilities

    with webhook support for real-time updates. The API also supports
    text-to-speech synthesis

    and phrase replacement configuration.
servers:
  - url: https://api.upliftai.org/v1
    description: Version 1 API
security: []
paths:
  /transcribe/speech-to-text:
    post:
      summary: Speech to Text (Beta)
      description: >
        <b>Transcribe audio files to text using AI models</b>


        Converts audio files to text using Uplift's speech recognition models
        optimized for Urdu language.


        **Model Selection:**

        - **scribe**: Full accuracy model - 40 credits per minute

        - **scribe-mini**: Cost-effective model - 20 credits per minute (50%
        cheaper)


        **Domain Optimization:**

        Use the `domain` parameter for improved accuracy in specialized
        contexts:

        - **phone-commerce**: Optimized for e-commerce conversations

        - **farming**: Optimized for agricultural terminology
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: Audio file to transcribe (max 25MB)
                model:
                  type: string
                  enum:
                    - scribe
                    - scribe-mini
                  default: scribe
                  description: AI model to use
                language:
                  type: string
                  enum:
                    - ur
                  default: ur
                  description: Language of the audio
                domain:
                  type: string
                  enum:
                    - phone-commerce
                    - farming
                  description: Domain-specific optimization
      responses:
        '200':
          description: Successful transcription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TranscribeSpeechResponse'
        '400':
          description: Invalid file format or parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: 'Invalid model. Supported models: scribe, scribe-mini'
        '402':
          description: Payment required or billing limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  rejectReasonCode:
                    type: string
        '413':
          description: File too large
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: File exceeds 25MB limit
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Rate limit exceeded, please try again later
      security:
        - apiKeyAuth: []
      x-codeSamples:
        - lang: cURL
          label: Transcribe audio file
          source: >
            curl -X POST "https://api.upliftai.org/v1/transcribe/speech-to-text"
            \
              -H "Authorization: Bearer YOUR_API_KEY" \
              -F "file=@/path/to/audio.mp3" \
              -F "model=scribe" \
              -F "language=ur"
        - lang: Python
          label: Python example
          source: >
            import requests


            url = "https://api.upliftai.org/v1/transcribe/speech-to-text"


            files = {'file': open('audio.mp3', 'rb')}

            data = {
                'model': 'scribe-mini',  # Use cost-effective model
                'language': 'ur',
                'domain': 'phone-commerce'  # Optimize for e-commerce
            }

            headers = {
                'Authorization': 'Bearer YOUR_API_KEY'
            }


            response = requests.post(url, files=files, data=data,
            headers=headers)

            result = response.json()


            print(f"Transcription: {result['text']}")
components:
  schemas:
    TranscribeSpeechResponse:
      type: object
      description: Response from speech-to-text transcription
      properties:
        text:
          type: string
          description: Transcribed text from the audio
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: API key with format "Bearer sk_api_..."

````