# Grok Voice

> Run Grok Voice by xai online or via API. $0.08/min session audio + $0.004/text input, no setup.

**URL:** https://inference.sh/apps/xai/grok-voice
**Last updated:** 2026-09-24

---

Talk with Grok. Stream microphone audio over a socket and hear xAI's speech-to-speech model answer as it speaks, with both sides transcribed; the conversation is the task's output.

- app: `xai/grok-voice`
- maker: [xai](https://inference.sh/apps/xai.md)
- category: [audio](https://inference.sh/apps/category/audio.md)
- input → output: speech → speech
- tasks: [speech to speech](https://inference.sh/apps/tag/speech-to-speech.md), [realtime](https://inference.sh/apps/tag/realtime.md)
- price: $0.08/min session audio + $0.004/text input
- runs via: api, javascript and python sdk, belt cli, mcp

## grok-voice API Guide

### About
talk with grok. stream microphone audio over a socket and hear xai's speech-to-speech model answer as it speaks, with both sides transcribed; the conversation is the task's output.

### Get an API Key
Create one in [settings → api keys](https://app.inference.sh/settings/keys). The examples read it from `INFERENCE_API_KEY`.

```bash
export INFERENCE_API_KEY="inf_your_key"
```

### 1. Calling the API

#### Install the Client

```bash
pip install inferencesh
```

#### Run and Get Result
Submit a request and wait for the final result.

```python
import os
from inferencesh import inference

client = inference(api_key=os.environ["INFERENCE_API_KEY"])

## version @1kd4e3ce pinned
result = client.run({
        "app": "xai/grok-voice@1kd4e3ce",
        "input": {
            "events": [
                {
                    "text": "text"
                }
            ]
        }
    })

print(result["output"])
```

#### Stream Live Updates
Get real-time progress updates as the task runs.

```python
import os
from inferencesh import inference

client = inference(api_key=os.environ["INFERENCE_API_KEY"])

## version @1kd4e3ce pinned
## stream=True yields updates as they arrive
for update in client.run({
        "app": "xai/grok-voice@1kd4e3ce",
        "input": {
            "events": [
                {
                    "text": "text"
                }
            ]
        }
    }, stream=True):
    if update.get("progress"):
        print(f"progress: {update['progress']}%")
    if update.get("output"):
        print(f"output: {update['output']}")
```

#### Run in the Background
Start the task and get its id back right away, then check on it with `GET /tasks/{id}`. It is done when `status` is 10 (completed), 11 (failed) or 12 (cancelled).

```python
import os
from inferencesh import inference, TaskStatus

client = inference(api_key=os.environ["INFERENCE_API_KEY"])

## returns as soon as the task is created
task = client.run({
        "app": "xai/grok-voice@1kd4e3ce",
        "input": {
            "events": [
                {
                    "text": "text"
                }
            ]
        }
    }, wait=False)

## later: read its current state
state = client.tasks.get(task["id"]).data
if state["status"] == TaskStatus.COMPLETED:
    print(state["output"])
```

### 2. Files

#### Automatic Upload

```python
## local file paths are automatically uploaded
result = client.run({
    "app": "xai/grok-voice@1kd4e3ce",
    "input": {
        "image": "/path/to/local/image.png",  # detected & uploaded
        "audio": "https://example.com/audio.mp3",  # url passed through
    }
})
```

#### Manual Upload

```python
## upload and get a hosted URL
file = client.files.upload("/path/to/file.png")
print(file.uri)  # https://cloud.inference.sh/...
```

### 3. Schema

#### Input
- **audio** (array): Microphone audio, a frame every 20 ms or so
- **events** (array): Typed messages: text from the user, or words for the assistant
- **instructions** (string): System prompt. Grok's voice models take plain instructions; workarounds written for other models are unnecessary.
- **voice** (string): A built-in voice; `voices` lists them with what xAI says about each
- **custom_voice** (string): The id of a voice cloned with xAI's Custom Voices API. Set, it is used instead of voice.
- **model** (string): grok-voice-latest follows the newest model; pin a versioned name such as grok-voice-think-fast-2.0 for stability
- **reasoning** (string): Whether the model thinks before it answers. 'none' answers faster.
- **language** (string): BCP-47 hint for what the user speaks, such as en, ja or es-MX (Spanish and Portuguese need a region). Left empty it is detected.
- **speed** (number): Playback speed of the assistant's voice
- **idle_minutes** (number): End the session after this long with nobody speaking or typing (0: never). Grok bills every minute the session is open, silent or not.
- **silence_ms** (integer): Silence that ends the user's turn, in ms. Left empty Grok decides.
- **web_search** (boolean): Let the assistant search the web
- **x_search** (boolean): Let the assistant search X

#### Output
- **assistant_text** (string): What the assistant is saying, as it says it
- **audio** (array): The assistant's voice
- **end_reason** (string): Why the session ended, on the result: the caller closed it, or Grok did (for example after 15 minutes without audio)
- **messages** (array): The conversation so far, a message per turn
- **partial** (boolean): True while the conversation goes on; False on the result
- **seconds** (number): How long the session has run
- **user_text** (string): What Grok hears the user saying, refined as they speak

## other audio apps

- [Fish Audio Drama 3](https://inference.sh/apps/fish-audio/drama-3.md): $50.00/1M UTF-8 bytes
- [Eleven Flash v2.5](https://inference.sh/apps/elevenlabs/eleven-flash-v2-5.md): $0.04/1K characters
- [Eleven Multilingual v2](https://inference.sh/apps/elevenlabs/eleven-multilingual-v2.md): $0.08/1K characters
- [Eleven v3](https://inference.sh/apps/elevenlabs/eleven-v3.md): $0.08/1K characters
- [Eleven v4 Turbo](https://inference.sh/apps/elevenlabs/eleven-v4-turbo.md): $0.04/1K characters

## faq

### how much does Grok Voice cost?

$0.08/min session audio + $0.004/text input. you pay per run from your inference shell credits. no subscription is required.

### how do I run Grok Voice via api?

call xai/grok-voice with the javascript or python sdk, the rest api, or `belt app run xai/grok-voice` from a terminal. the api reference on this page lists every input.

### who makes Grok Voice?

Grok Voice is made by xai and runs on inference shell. every xai app is listed at https://inference.sh/apps/xai.

### can my agent use Grok Voice?

yes. agents call it as a tool through the inference shell mcp server (https://api.inference.sh/mcp), the belt cli or the sdk, and pay per run like you do.

### what are the alternatives to Grok Voice?

other audio apps on inference shell include Fish Audio Drama 3, Eleven Flash v2.5, Eleven Multilingual v2, Eleven v3. they run through the same api, so switching is a one-line change.
