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

# Audio API

> Convert text to speech and turn audio into text with transcription and translation endpoints.

Use the `Audio API` when you need speech synthesis, transcription, or translation as direct audio workflows.

## Audio Operations

* `POST /v1/audio/speech` converts text into audio output
* `POST /v1/audio/transcriptions` converts uploaded audio into text
* `POST /v1/audio/translations` translates uploaded audio into text

These are separate operations with different request and response contracts:

* text-to-speech returns streamed audio bytes
* transcription returns JSON text
* translation returns JSON text

<CardGroup cols={2}>
  <Card title="Text to Speech" icon="volume-high" href="/api/audio/text-to-speech">
    Convert text into streamed audio output.
  </Card>

  <Card title="Speech to Text" icon="waveform-lines" href="/api/audio/speech-to-text">
    Transcribe uploaded audio into text.
  </Card>

  <Card title="Speech Translation" icon="language" href="/api/audio/speech-translation">
    Translate uploaded audio into text.
  </Card>

  <Card title="Formats and Uploads" icon="file-arrow-up" href="/api/audio/file-formats-and-uploads">
    Check supported file formats and upload guidance.
  </Card>
</CardGroup>

## Quick Example

<CodeGroup>
  ```python Python theme={null}
  from pathlib import Path
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.naga.ac/v1",
      api_key="YOUR_API_KEY",
  )

  transcription = client.audio.transcriptions.create(
      model="whisper-1",
      file=Path("sample.mp3"),
  )

  print(transcription.text)
  ```

  ```javascript Node.js theme={null}
  import fs from 'fs';
  import OpenAI from 'openai';

  const client = new OpenAI({
    baseURL: 'https://api.naga.ac/v1',
    apiKey: 'YOUR_API_KEY',
  });

  const transcription = await client.audio.transcriptions.create({
    model: 'whisper-1',
    file: fs.createReadStream('sample.mp3'),
  });

  console.log(transcription.text);
  ```

  ```bash cURL theme={null}
  curl https://api.naga.ac/v1/audio/transcriptions \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "model=whisper-1" \
    -F "file=@sample.mp3"
  ```
</CodeGroup>

## Related Docs

* [Text to Speech](/api/audio/text-to-speech)
* [Speech to Text](/api/audio/speech-to-text)
* [Speech Translation](/api/audio/speech-translation)
* [File Formats and Uploads](/api/audio/file-formats-and-uploads)
* [Error Handling](/build/error-handling)

## Reference

* [Create speech](/api-reference/endpoints/audio/speech)
* [Create transcription](/api-reference/endpoints/audio/transcriptions)
* [Create translation](/api-reference/endpoints/audio/translations)
