> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# Overview

<blockquote>
  For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
</blockquote>

xAI's Grok Voice Agent API is available in Voximplant as a native **VoxEngine** connector,
so you can build real-time voice agents with telephony-grade audio streaming and call control.

## Benefits

* **Built-in WebSocket connector**: Voximplant handles WebSocket media, audio formatting, sample rate, and packet sizing so you can focus on call logic.
  [https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant](https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant)
* **Real-time voice interactions**: Grok streams responses as they're generated for low-latency conversations.
  [https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant](https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant)
* **All-in-one speech stack**: STT and TTS are part of the Grok Voice Agent API (no separate providers required).
  [https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant](https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant)
* **Context-aware responses** with `file_search`, `web_search`, and `x_search`.
  [https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant](https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant)

## Prerequisites

* xAI account with Voice Agent API access.
* xAI API key from your xAI account.

## Demo video

Outbound calling with xAI's Grok Voice API demo:

Video link: [How to Use Grok Voice Agent for Outbound Calls](https://www.youtube.com/watch?v=GxPJ2Yrl7DM)

## Architecture

Voximplant's Grok Voice Agent API integration uses a WebSocket connection to stream audio between VoxEngine and Grok.
The Voice AI connector handles connection establishment, media conversion, playback, and audio capture.

```mermaid
graph LR
  Caller[PSTN/SIP/WhatsApp/WebRTC] <-->|Media & call control| VoxEngine[VoxEngine Scenario]
  VoxEngine <-->|WebSocket:  Config, Audio & Events| Grok[Grok Voice Agent API]
```

Tool calls detected by Grok are signaling in events where you can implement custom logic and provide a response in your VoxEngine scenario.

## Development notes

* The Grok Voice Agent API uses WebSockets only; Voximplant manages the connection.
  [https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant](https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant)
* Load the module with `require(Modules.Grok)` and create a `VoiceAgentAPIClient` inside VoxEngine.
  [https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant](https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant)
* Use `VoxEngine.sendMediaBetween(call, client)` to bridge call audio to Grok.
  [https://voximplant.com/docs/voice-ai/xai/grok](https://voximplant.com/docs/voice-ai/xai/grok)
* For barge-in, clear the media buffer on `InputAudioBufferSpeechStarted`.
  [https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant](https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant)
* Store your API key in Voximplant [Secrets](/platform/voxengine/secrets) (for example under `GROK_API_KEY`).
  [https://voximplant.com/docs/voice-ai/xai/grok](https://voximplant.com/docs/voice-ai/xai/grok)

## Links

* Blog post: [https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant](https://voximplant.com/blog/grok-voice-agent-api-now-available-in-voximplant)
* Grok Voice Agent API client guide: [https://voximplant.com/docs/voice-ai/xai/grok](https://voximplant.com/docs/voice-ai/xai/grok)
* Grok VoxEngine module reference: [https://voximplant.com/docs/references/voxengine/grok](https://voximplant.com/docs/references/voxengine/grok)
* xAI Grok Voice Agent API announcement: [https://x.ai/blog/grok-voice-agent](https://x.ai/blog/grok-voice-agent)
* xAI Voice Agent API docs: [https://docs.x.ai/docs/guides/voice/agent](https://docs.x.ai/docs/guides/voice/agent)
* Example repository: [https://github.com/voximplant/grok-voice-agent-example](https://github.com/voximplant/grok-voice-agent-example)