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

# Speech-to-Text

> Gegentica's AI gateway enables speech-to-text using models such as OpenAI Whisper.

## Using Transcription and Translation

Gegentica provides both `Transcription` and `Translation` options for speech-to-text (STT) models,
following the OpenAI API format. You can submit audio files in formats such as `flac`, `mp3`, `mp4`, `mpeg`, `mpga`, `m4a`, `ogg`, `wav`, or `webm` as part of your API request.

Example:

<Tabs>
  <Tab title="Python SDK">
    ```
    from pathlib import Path
    from gegentic import Gegentic

    # Initialize the Gegentic client
    client = Gegentic(
      gegentic_api_key="sk-obg***"   # Your Gegentic API key here
    )
    audio_file= open("/path/to/file.mp3", "rb")

    # Transcription
    transcription = client.audio.transcriptions.create(
      model="whisper-1",
      file=audio_file
    )
    print(transcription.text)

    # Translation
    translation = client.audio.translations.create(
      model="whisper-1",
      file=audio_file
    )
    print(translation.text)
    ```
  </Tab>

  <Tab title="OpenAI Python">
    ```
    from openai import OpenAI
    from gegentic import GEGENTIC_GATEWAY_URL, createHeaders

    client = OpenAI(
      api_key="dummy" #We are using the API key from Gegentic
      base_url=GEGENTIC_GATEWAY_URL,
      default_headers=createHeaders(
        api_key="sk-obg***",  # Your Gegentic API key here
      )
    )

    audio_file= open("/path/to/file.mp3", "rb")

    # Transcription
    transcription = client.audio.transcriptions.create(
      model="whisper-1",
      file=audio_file
    )
    print(transcription.text)

    # Translation
    translation = client.audio.translations.create(
      model="whisper-1",
      file=audio_file
    )
    print(translation.text)
    ```
  </Tab>

  <Tab title="cURL">
    For Transcriptions:

    ```
    curl "https://gateway.gegentic-ai.com/v1/audio/transcriptions" \
      -H "x-gegentic-api-key: $GEGENTIC_API_KEY" \
      -H "x-gegentic-provider: openai" \
      -H "Authorization: Bearer $OPENAI_API_KEY" \
      -H 'Content-Type: multipart/form-data' \
        --form file=@/path/to/file/audio.mp3 \
        --form model=whisper-1
    ```

    For Translations:

    ```
    curl "https://gateway.gegentic-ai.com/v1/audio/translations" \
    -H "x-gegentic-api-key: $GEGENTIC_API_KEY" \
    -H "x-gegentic-provider: openai" \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -H 'Content-Type: multipart/form-data' \
      --form file=@/path/to/file/audio.mp3 \
      --form model=whisper-1
    ```
  </Tab>
</Tabs>

After completion, your request will appear in the logs UI, displaying the transcribed or translated text, as well as the associated cost and latency.

## Supported Providers and Models

Currently, the following providers are supported for speech-to-text.
More providers will be added soon.

| Provider | Model     | Functions                  |
| -------- | --------- | -------------------------- |
| OpenAI   | whisper-1 | Transcription, Translation |
