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

# Audio inputs

> Send audio inputs to the Responses API.

The OpenAI examples use its custom-request method for MKA1 extensions that are not part of the OpenAI Responses types.

## Audio input

Send audio for the model to process. The audio is automatically transcribed and the model responds to the spoken content.

Supported formats: **WAV** and **MP3** (max 25 MB).

<CodeGroup>
  ```ts TypeScript SDK theme={null}
  import { SDK } from '@meetkai/mka1';
  import { readFileSync } from 'fs';

  const sdk = new SDK({ bearerAuth: 'Bearer <mka1-api-key>' });

  const audioBase64 = readFileSync('recording.wav').toString('base64');

  const result = await sdk.llm.responses.create({
    xOnBehalfOf: '<end-user-id>',
    responsesCreateRequest: {
      model: 'auto',
      input: [
        {
          type: 'message',
          role: 'user',
          content: [
            {
              type: 'input_audio',
              inputAudio: {
                data: audioBase64,
                format: 'wav',
              },
            },
          ],
        },
      ],
    },
  });
  ```

  ```ts OpenAI SDK theme={null}
  import OpenAI from 'openai';
  import { readFileSync } from 'fs';

  const openai = new OpenAI({
    apiKey: '<mka1-api-key>',
    baseURL: 'https://apigw.mka1.com/api/v1/llm/',
    defaultHeaders: { 'X-On-Behalf-Of': '<end-user-id>' },
  });

  const audioBase64 = readFileSync('recording.wav').toString('base64');

  const response = await openai.post<OpenAI.Responses.Response>('/responses', { body: {
    model: 'auto',
    input: [
      {
        type: 'message',
        role: 'user',
        content: [
          {
            type: 'input_audio',
            input_audio: {
              data: audioBase64,
              format: 'wav',
            },
          },
        ],
      },
    ],
    stream: false,
  } });
  ```

  ```python Python SDK theme={null}
  import base64
  from meetkai_mka1 import SDK

  sdk = SDK(bearer_auth="Bearer <mka1-api-key>")

  with open("recording.wav", "rb") as f:
      audio_base64 = base64.b64encode(f.read()).decode()

  result = sdk.llm.responses.create(
      model="auto",
      input=[{
          "type": "message",
          "role": "user",
          "content": [
              {
                  "type": "input_audio",
                  "input_audio": {
                      "data": audio_base64,
                      "format": "wav",
                  },
              },
          ],
      }],
  )
  ```

  ```csharp C# SDK theme={null}
  using MeetKai.MKA1;
  using MeetKai.MKA1.Types.Components;
  using MeetKai.MKA1.Types.Requests;

  var sdk = new SDK(bearerAuth: "Bearer <mka1-api-key>");

  var audioBytes = System.IO.File.ReadAllBytes("recording.wav");
  var audioBase64 = Convert.ToBase64String(audioBytes);

  var res = await sdk.Llm.Responses.CreateAsync(new ResponsesCreateRequest()
  {
      Model = "auto",
      Input = ResponsesCreateRequestInput.CreateArrayOfItem(new List<Item>
      {
          Item.CreateInputMessage(new InputMessage()
          {
              Role = InputMessageRole.User,
              Content = InputMessageContent1.CreateArrayOfInputMessageContent(
                  new List<InputMessageContent>
                  {
                      InputMessageContent.CreateInputAudio(new InputAudio()
                      {
                          InputAudioValue = new InputAudioInputAudio()
                          {
                              Data = audioBase64,
                              Format = InputAudioFormat.Wav,
                          },
                      }),
                  }),
          }),
      }),
  });
  ```

  ```bash CLI theme={null}
  AUDIO_B64=$(base64 -i recording.wav)

  mka1 llm responses create \
    --body "{
      \"model\": \"auto\",
      \"input\": [
        {
          \"type\": \"message\",
          \"role\": \"user\",
          \"content\": [
            {
              \"type\": \"input_audio\",
              \"input_audio\": {
                \"data\": \"${AUDIO_B64}\",
                \"format\": \"wav\"
              }
            }
          ]
        }
      ]
    }"
  ```

  ```bash Bash theme={null}
  AUDIO_B64=$(base64 -i recording.wav)

  curl https://apigw.mka1.com/api/v1/llm/responses \
    --request POST \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <mka1-api-key>' \
    --header 'X-On-Behalf-Of: <end-user-id>' \
    --data "{
      \"model\": \"auto\",
      \"input\": [
        {
          \"type\": \"message\",
          \"role\": \"user\",
          \"content\": [
            {
              \"type\": \"input_audio\",
              \"input_audio\": {
                \"data\": \"${AUDIO_B64}\",
                \"format\": \"wav\"
              }
            }
          ]
        }
      ]
    }"
  ```
</CodeGroup>

The model automatically transcribes the audio and responds to the spoken content. For example, sending a WAV file containing "Hello, how are you today?" returns:

```json theme={null}
{
  "status": "completed",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Hello! I'm doing well, thank you for asking. I'm here and ready to help you with any questions or tasks you might have. How can I assist you today?"
        }
      ]
    }
  ]
}
```

## Combine input types

See [Multimodal input](/docs/multimodal-input#mixed-input) for a request containing several input types.
