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

# Voice Chat

For real-time voice chat, select a model that supports voice in your chat request. Filter the [model catalog](https://geekai.co/models) for real-time voice chat:

![Models that support voice chat](https://static.geekai.co/storage/2025/07/14/image-20250714102327597.png)

### OpenAI

This example uses an OpenAI real-time voice chat model:

```bash curl theme={null}
curl "https://geekai.co/api/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GEEKAI_API_KEY" \
-d '{
    "model": "gpt-4o-mini-audio-preview",
    "modalities": ["text", "audio"],
    "audio": { "voice": "alloy", "format": "wav" },
    "messages": [
        {
            "role": "user",
            "content": [
                { "type": "text", "text": "What is in this recording?" },
                {
                    "type": "input_audio",
                    "input_audio": {
                        "data": "<url or base64 bytes here>",
                        "format": "wav"
                    }
                }
            ]
        }
    ]
}'
```

```bash python theme={null}
import base64
import requests
from openai import OpenAI

client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1")

completion = client.chat.completions.create(
    model="gpt-4o-mini-audio-preview",
    modalities=["text", "audio"],
    audio={"voice": "alloy", "format": "wav"},
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What is in this recording?"
                },
                {
                    "type": "input_audio",
                    "input_audio": {
                        "data": "<url or base64 bytes here>",
                        "format": "wav"
                    }
                }
            ]
        },
    ]
)

print(completion.choices[0])

wav_bytes = base64.b64decode(completion.choices[0].message.audio.data)
with open("dog.wav", "wb") as f:
    f.write(wav_bytes)
```

```bash javascript theme={null}
import OpenAI from "openai";

const openai = new OpenAI({
    baseURL: 'https://geekai.co/api/v1',
    apiKey: '$GEEKAI_API_KEY'
});

const response = await openai.chat.completions.create({
  model: "gpt-4o-mini-audio-preview",
  modalities: ["text", "audio"],
  audio: { voice: "alloy", format: "wav" },
  messages: [
    {
      role: "user",
      content: [
        { type: "text", text: "What is in this recording?" },
        { type: "input_audio", input_audio: { data: "url or base64 bytes here", format: "wav" }}
      ]
    }
  ],
  store: true,
});

// Inspect returned data
console.log(response.choices[0]);

// Write audio data to a file
writeFileSync(
  "dog.wav",
  Buffer.from(response.choices[0].message.audio.data, 'base64'),
  { encoding: "utf-8" }
);
```

Include both `text` and `audio` in `modalities` for text and audio output, or just `text` for text only. Use `audio` to set the voice and audio format. OpenAI models use the same parameters as [text-to-speech](https://docs.geekai.co/en/docs/audio/tts.md).

### Chinese platforms

OpenAI's output voices may be less suitable for Chinese speech (this does not affect text-only output). Alternatives include Zhipu Qingyan and Qwen. Zhipu Qingyan does not require `modalities` or `audio`. Qwen uses the same `modalities` settings as OpenAI and supports the following Chinese voices (the `voice` field of `audio`):

* Cherry (not supported by open-source models)
* Serena (not supported by open-source models)
* Ethan
* Chelsie

The only supported output format (the `format` field of `audio`) is `wav`.

Example voice chat request with Qwen:

```bash curl theme={null}
curl "https://geekai.co/api/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GEEKAI_API_KEY" \
-d '{
    "model": "qwen-omni-turbo",
    "modalities": ["text", "audio"],
    "audio": { "voice": "Cherry", "format": "wav" },
    "messages": [
        {
            "role": "user",
            "content": [
                { "type": "text", "text": "What is in this recording?" },
                {
                    "type": "input_audio",
                    "input_audio": {
                        "data": "<url or base64 bytes here>",
                        "format": "wav"
                    }
                }
            ]
        }
    ]
}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.