Audio

View as Markdown

Mesh API supports audio through POST /v1/chat/completions.

Use this page for:

  • audio input with input_audio
  • audio output with modalities and audio

Audio input

Send audio as a content part inside a chat message.

$curl https://api.meshapi.ai/v1/chat/completions \
> -H "Authorization: Bearer <YOUR_RSK_KEY>" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "google/gemini-3-flash-preview",
> "messages": [
> {
> "role": "user",
> "content": [
> { "type": "text", "text": "Transcribe this clip." },
> {
> "type": "input_audio",
> "input_audio": {
> "data": "<BASE64_AUDIO>",
> "format": "wav"
> }
> }
> ]
> }
> ]
> }'

Audio output

Request text and audio together when the model supports audio output.

$curl https://api.meshapi.ai/v1/chat/completions \
> -H "Authorization: Bearer <YOUR_RSK_KEY>" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "openai/gpt-4o-audio-preview",
> "messages": [
> { "role": "user", "content": "Read this back to me in a calm voice." }
> ],
> "modalities": ["text", "audio"],
> "audio": {
> "voice": "alloy",
> "format": "wav"
> }
> }'

The same request shape is available through all four SDKs by setting chat-completions fields for modalities and audio.

SDK coverage

  • Node: client.chat.completions.create(...)
  • Python: client.chat.completions.create(...)
  • Go: client.Chat.Completions.Create(...)
  • Java: client.chat().completions().create(...)

Notes

  • Audio payloads are base64 encoded in the request body.
  • Check GET /v1/models to find models that accept or produce audio.
  • Keep payload sizes reasonable, especially for browser-based clients.