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

# Audio

> POST /v1/audio/speech and /v1/audio/transcriptions

Turn text into speech, and speech into text. Both endpoints are synchronous.

## Text-to-speech

Generate spoken audio from text. The response body is the audio file itself.

```
POST https://api.heyaskr.ai/v1/audio/speech
```

<ParamField body="model" type="string" required>Audio model id, e.g. `elevenlabs-v3`.</ParamField>
<ParamField body="input" type="string" required>The text to speak.</ParamField>
<ParamField body="voice" type="string">Voice id, e.g. `rachel` (model dependent).</ParamField>
<ParamField body="format" type="string" default="mp3">Output format, e.g. `mp3`, `wav`.</ParamField>

```bash theme={null}
curl https://api.heyaskr.ai/v1/audio/speech \
  -H "Authorization: Bearer ASKR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "elevenlabs-v3",
    "voice": "rachel",
    "input": "Crypto in. Intelligence out."
  }' --output speech.mp3
```

The response is the raw audio file. The cost of the generation is returned in the
`X-Askr-Cost` response header.

## Speech-to-text

Transcribe an audio file to text. Send the file as `multipart/form-data`.

```
POST https://api.heyaskr.ai/v1/audio/transcriptions
```

<ParamField body="model" type="string" required>Transcription model id, e.g. `whisper-1`.</ParamField>
<ParamField body="file" type="file" required>The audio file to transcribe.</ParamField>
<ParamField body="language" type="string">ISO code to hint the language (optional).</ParamField>

```bash theme={null}
curl https://api.heyaskr.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer ASKR_API_KEY" \
  -F model="whisper-1" \
  -F file="@meeting.mp3"
```

## Response

<ResponseField name="text" type="string">The transcribed text (transcriptions only).</ResponseField>
<ResponseField name="cost" type="number">Cost of the request in USD.</ResponseField>

```json theme={null}
{ "text": "Welcome to the meeting...", "cost": 0.006 }
```

<Note>
  Model ids are examples, so confirm the exact id and current price against the live
  [`/v1/models`](/api-reference/list-models) list.
</Note>
