SpyBara
Go Premium

Documentation 2026-10-25 22:58 UTC to 2026-10-26 22:57 UTC

7 files changed +61 −15. View all changes and history on the product overview
2026
Sat 31 23:59 Fri 30 23:58 Thu 29 23:01 Wed 28 23:01 Tue 27 23:58 Mon 26 22:57 Sun 25 22:58 Sat 24 23:59 Fri 23 23:57 Thu 22 23:59 Wed 21 23:02 Tue 20 23:01 Mon 19 23:59 Sun 18 23:57 Sat 17 23:58 Fri 16 22:57 Thu 15 23:58 Wed 14 23:01 Tue 13 23:59 Mon 12 23:02 Sun 11 23:58 Sat 10 23:59 Fri 9 23:59 Thu 8 23:58 Wed 7 23:59 Tue 6 22:57 Mon 5 22:59 Sun 4 23:58 Sat 3 23:58 Fri 2 23:57 Thu 1 23:57
Details

101 101 

102With your batch created, you can now add requests to it. Each request will be processed asynchronously.102With your batch created, you can now add requests to it. Each request will be processed asynchronously.

103 103 

104**With the xAI SDK, adding batch requests is simple:** use `chat.create()` for text, `image.prepare()` for images, `video.prepare()` for videos, or `video.prepare_extension()` for video extensions, then pass them as a list. You can also upload a [JSONL file](#jsonl-file-upload) if you prefer.104With the xAI SDK, build each request with the method for its type, then pass them as a list:

105 105 

106**Important:** Assign a unique `batch_request_id` to each request. This ID lets you match results back to their original requests, which becomes important when you're processing hundreds or thousands of items. If you don't provide an ID, we generate a UUID for you. Using your own IDs is useful for idempotency (ensuring a request is only processed once) and for linking batch requests to records in your own system.106| Request type | SDK method |

107|---|---|

108| Text | `chat.create()` |

109| Image | `image.prepare()` |

110| Video | `video.prepare()` |

111| Video extension | `video.prepare_extension()` |

112 

113You can also upload a [JSONL file](#jsonl-file-upload) if you prefer.

114 

115**Important:** Assign a unique `batch_request_id` to each request.

116 

117* The ID lets you match results back to their original requests. This matters when you process hundreds or thousands of items.

118* If you don't provide an ID, we generate a UUID for you.

119* Your own IDs are useful for idempotency (ensuring a request is only processed once).

120* They also let you link batch requests to records in your own system.

107 121 

108```bash122```bash

109curl -X POST https://api.x.ai/v1/batches/{batch_id}/requests \\123curl -X POST https://api.x.ai/v1/batches/{batch_id}/requests \\


419 433 

420You can retrieve results at any time, even before the entire batch completes. Results are available as soon as individual requests finish processing, so you can start consuming completed results while other requests are still in progress.434You can retrieve results at any time, even before the entire batch completes. Results are available as soon as individual requests finish processing, so you can start consuming completed results while other requests are still in progress.

421 435 

422Each result is linked to its original request via the `batch_request_id` you assigned earlier. For chat completions, use `result.response` which has the familiar fields: `.content`, `.usage`, `.finish_reason`, and more. For image requests, use `result.image_response` which provides `.url`, `.base64`, `.usage`, and `.model`. For video requests, use `result.video_response` which provides `.url`, `.duration`, `.usage`, and `.model`. These are the same response types returned by the regular `client.image.sample()` and `client.video.generate()` methods.436Each result is linked to its original request via the `batch_request_id` you assigned earlier. Read the response from the accessor for its request type:

437 

438| Request type | Accessor | Fields |

439|---|---|---|

440| Chat completion | `result.response` | `.content`, `.usage`, `.finish_reason`, and more |

441| Image | `result.image_response` | `.url`, `.base64`, `.usage`, `.model` |

442| Video | `result.video_response` | `.url`, `.duration`, `.usage`, `.model` |

443 

444These are the same response types returned by the regular `client.image.sample()` and `client.video.generate()` methods.

423 445 

424The SDK provides convenient `.succeeded` and `.failed` properties to separate successful responses from errors.446The SDK provides convenient `.succeeded` and `.failed` properties to separate successful responses from errors.

425 447 


864 886 

865As an alternative to adding requests via the SDK, you can create batches by uploading a JSONL file. This is useful when generating requests from scripts, pipelines, or external tools.887As an alternative to adding requests via the SDK, you can create batches by uploading a JSONL file. This is useful when generating requests from scripts, pipelines, or external tools.

866 888 

867Each line in the file is a JSON object with four fields: `custom_id` (unique identifier, maps to `batch_request_id`), `method` (always `"POST"`), `url` (API endpoint path), and `body` (the JSON request payload matching the [REST API reference](/developers/rest-api-reference) for that endpoint).889Each line in the file is a JSON object with four fields:

890 

891| Field | Description |

892|---|---|

893| `custom_id` | Unique identifier. Maps to `batch_request_id`. |

894| `method` | Always `"POST"`. |

895| `url` | API endpoint path. |

896| `body` | The JSON request payload, matching the [REST API reference](/developers/rest-api-reference) for that endpoint. |

868 897 

869```json898```json

870{"custom_id": "chat-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "grok-4.3", "messages": [{"role": "user", "content": "Classify this as positive, negative, or neutral: The product exceeded my expectations!"}]}}899{"custom_id": "chat-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "grok-4.3", "messages": [{"role": "user", "content": "Classify this as positive, negative, or neutral: The product exceeded my expectations!"}]}}


891| `/v1/videos/edits` | [Video editing](/developers/model-capabilities/video/editing) |920| `/v1/videos/edits` | [Video editing](/developers/model-capabilities/video/editing) |

892| `/v1/videos/extensions` | [Video extension](/developers/model-capabilities/video/extension) |921| `/v1/videos/extensions` | [Video extension](/developers/model-capabilities/video/extension) |

893 922 

894Only batch-enabled models are accepted. Refer to the relevant [model pages](/developers/models) for the most up-to-date information; models that are not batch-enabled are rejected with "not supported for batch processing".923Only batch-enabled models are accepted. Refer to the relevant [model pages](/developers/models) for the most up-to-date information; models that are not batch-enabled are rejected with `not supported for batch processing`.

895 924 

896Upload the file via the [Files API](/developers/files), then create a batch referencing it:925Upload the file via the [Files API](/developers/files), then create a batch referencing it:

897 926 


959 988 

960The file is processed asynchronously in the background. If any line is invalid, the batch is cancelled with an error message. Monitor progress and retrieve results the same way as inline batches.989The file is processed asynchronously in the background. If any line is invalid, the batch is cancelled with an error message. Monitor progress and retrieve results the same way as inline batches.

961 990 

962File-based batches are sealed after creation — you cannot add more requests via `AddBatchRequests`. Maximum file size is **200 MB** with up to **50,000** requests. Each `custom_id` must be unique within the file.991File-based batch limits:

992 

993* The batch is sealed after creation. You cannot add more requests via `AddBatchRequests`.

994* Maximum file size is **200 MB**.

995* A file can hold up to **50,000** requests.

996* Each `custom_id` must be unique within the file.

963 997 

964## Limitations998## Limitations

965 999 

Details

16 16 

17 17 

18 18 

19SpaceXSI accepts SIP signaling over TLS on port 5061, and over TCP or UDP on port 5060. Use `;transport=tls` if your provider supports it. Otherwise use `;transport=tcp`, or omit the transport parameter for UDP.

20 

19If you provide `allowed_addresses`, make sure the list contains your provider's SIP signaling CIDR ranges. If you provide SIP digest credentials, configure your carrier with the same username and password; SpaceXSI never returns the password after creation.21If you provide `allowed_addresses`, make sure the list contains your provider's SIP signaling CIDR ranges. If you provide SIP digest credentials, configure your carrier with the same username and password; SpaceXSI never returns the password after creation.

20 22 

21### 2. Handle the incoming-call webhook23### 2. Handle the incoming-call webhook


171 173 

172 174 

173 175 

174Replace `{number}` with your Direct SIP phone number. If you configured `allowed_addresses` when registering the number, include your provider's SIP signaling CIDR ranges.176Replace `{number}` with your Direct SIP phone number. Use `;transport=tls` if your provider supports it. Otherwise use `;transport=tcp`, or omit the transport parameter for UDP. If you configured `allowed_addresses` when registering the number, include your provider's SIP signaling CIDR ranges.

175 177 

176### Twilio178### Twilio

177 179 


1803. Assign a Twilio phone number to the trunk, or purchase a new number and attach it.1823. Assign a Twilio phone number to the trunk, or purchase a new number and attach it.

1814. If your application transfers calls mid-session, enable call transfer on the trunk.1834. If your application transfers calls mid-session, enable call transfer on the trunk.

182 184 

185### Bandwidth

186 

1871. In the Bandwidth Console, go to **SIP Trunking** and create a SIP trunk.

1882. Choose **UDP** without credentials.

1893. Link an existing phone number to the trunk, or buy a new number and attach it.

1904. Set the destination to `sip:{number}@sip.voice.x.ai`.

191 

183### Telnyx192### Telnyx

184 193 

1851. In the Telnyx Portal, go to **Voice Suite** → **SIP Trunking** and create an FQDN SIP Connection.1941. In the Telnyx Portal, go to **Voice Suite** → **SIP Trunking** and create an FQDN SIP Connection.

Details

2 2 

3# Speech to Text3# Speech to Text

4 4 

5Transcribe audio files into text with a single API call, or stream audio in real time over WebSocket. The API supports 12 audio formats, word-level timestamps, multichannel transcription, and text formatting.5Transcribe audio files into text with a single API call, or stream audio in real time over WebSocket. The API supports 15 audio formats, word-level timestamps, multichannel transcription, and text formatting.

6 6 

7## Quick Start7## Quick Start

8 8 


217| MP4 | `.mp4` | MPEG-4 container |217| MP4 | `.mp4` | MPEG-4 container |

218| M4A | `.m4a` | MPEG-4 Audio — Apple ecosystem standard |218| M4A | `.m4a` | MPEG-4 Audio — Apple ecosystem standard |

219| MKV | `.mkv` | Matroska container — supports MP3, AAC, and FLAC audio codecs |219| MKV | `.mkv` | Matroska container — supports MP3, AAC, and FLAC audio codecs |

220| WebM | `.webm` | WebM container — typically Opus audio from browsers |

221| AVI | `.avi` | Audio Video Interleave |

222| MOV | `.mov` | QuickTime container |

220 223 

221### Raw formats (require `audio_format` and `sample_rate`)224### Raw formats (require `audio_format` and `sample_rate`)

222 225 

Details

132 132 

133## Speech to Text133## Speech to Text

134 134 

135Transcribe audio files in a single call or stream over WebSocket. The default is `grok-voice-transcribe-2.0`. 12 audio formats, word-level timestamps, multichannel, speaker diarization, Smart Turn end-of-turn detection, and 38+ languages.135Transcribe audio files in a single call or stream over WebSocket. The default is `grok-voice-transcribe-2.0`. 15 audio formats, word-level timestamps, multichannel, speaker diarization, Smart Turn end-of-turn detection, and 38+ languages.

136 136 

137```bash137```bash

138curl -X POST https://api.x.ai/v1/stt \138curl -X POST https://api.x.ai/v1/stt \

rate-limits.md +2 −2

Details

41| grok-4.20-0309-non-reasoning | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |41| grok-4.20-0309-non-reasoning | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |

42| grok-build-0.1 | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |42| grok-build-0.1 | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |

43| grok-4.20-multi-agent-0309 | T0: 9, T1: 12, T2: 18, T3: 31, T4: 56 | T0: 2.5M, T1: 3.7M, T2: 6.2M, T3: 11M, T4: 21M |43| grok-4.20-multi-agent-0309 | T0: 9, T1: 12, T2: 18, T3: 31, T4: 56 | T0: 2.5M, T1: 3.7M, T2: 6.2M, T3: 11M, T4: 21M |

44| grok-imagine-image | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |

44| grok-imagine-image-2.0 | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |45| grok-imagine-image-2.0 | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |

45| grok-imagine-image-quality | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |46| grok-imagine-image-quality | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |

46| grok-imagine-image | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |

47| grok-imagine-video-1.5 | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |

48| grok-imagine-video-1.5-lite | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |47| grok-imagine-video-1.5-lite | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |

49| grok-imagine-video | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |48| grok-imagine-video | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |

49| grok-imagine-video-1.5 | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |

50 50 

51**Voice & Audio**51**Voice & Audio**

52 52 

Details

10 10 

11### Request Body11### Request Body

12 12 

13* `file` (string) — Audio file to transcribe. Maximum size: 500 MB. Supported container formats (auto-detected): \`wav\`, \`mp3\`, \`ogg\`, \`opus\`, \`flac\`, \`aac\`, \`mp4\`, \`m4a\`, \`mkv\` (MP3/AAC/FLAC codecs only). Supported raw formats (requires \`audio\_format\` and \`sample\_rate\`): \`pcm\`, \`mulaw\`, \`alaw\`. Must be the last field in the multipart form.13* `file` (string) — Audio file to transcribe. Maximum size: 500 MB. Supported container formats (auto-detected): \`wav\`, \`mp3\`, \`ogg\`, \`opus\`, \`flac\`, \`aac\`, \`mp4\`, \`m4a\`, \`mkv\` (MP3/AAC/FLAC codecs only), \`webm\`, \`avi\`, \`mov\`. Supported raw formats (requires \`audio\_format\` and \`sample\_rate\`): \`pcm\`, \`mulaw\`, \`alaw\`. Must be the last field in the multipart form.

14 14 

15* `url` (string) — URL of an audio file to download and transcribe (server-side). Either \`file\` or \`url\` must be provided.15* `url` (string) — URL of an audio file to download and transcribe (server-side). Either \`file\` or \`url\` must be provided.

16 16 

17* `audio_format` ("pcm" | "mulaw" | "alaw" | "wav" | "mp3" | "ogg" | "opus" | "flac" | "aac" | "mp4" | "m4a" | "mkv") — Audio format hint. \*\*Only required for raw/headerless formats\*\* (\`pcm\`, \`mulaw\`, \`alaw\`). For container formats (MP3, WAV, OGG, etc.) the server auto-detects the format from the file header — do not set this field.17* `audio_format` ("pcm" | "mulaw" | "alaw" | "wav" | "mp3" | "ogg" | "opus" | "flac" | "aac" | "mp4" | "m4a" | "mkv" | "webm" | "avi" | "mov") — Audio format hint. \*\*Only required for raw/headerless formats\*\* (\`pcm\`, \`mulaw\`, \`alaw\`). For container formats (MP3, WAV, OGG, etc.) the server auto-detects the format from the file header — do not set this field.

18 18 

19* `sample_rate` ("8000" | "16000" | "22050" | "24000" | "44100" | "48000") — Audio sample rate in Hz. \*\*Required when \`audio\_format\` is a raw format\*\* (\`pcm\`, \`mulaw\`, \`alaw\`). Ignored for container formats. Either \`sample\_rate\` or \`sample\_rate\_hertz\` may be used.19* `sample_rate` ("8000" | "16000" | "22050" | "24000" | "44100" | "48000") — Audio sample rate in Hz. \*\*Required when \`audio\_format\` is a raw format\*\* (\`pcm\`, \`mulaw\`, \`alaw\`). Ignored for container formats. Either \`sample\_rate\` or \`sample\_rate\_hertz\` may be used.

20 20 

Details

1008 1008 

1009### Request Body1009### Request Body

1010 1010 

1011* `file` (string) — Audio file to transcribe. Maximum size: 500 MB. Supported container formats (auto-detected): \`wav\`, \`mp3\`, \`ogg\`, \`opus\`, \`flac\`, \`aac\`, \`mp4\`, \`m4a\`, \`mkv\` (MP3/AAC/FLAC codecs only). Supported raw formats (requires \`audio\_format\` and \`sample\_rate\`): \`pcm\`, \`mulaw\`, \`alaw\`. Must be the last field in the multipart form.1011* `file` (string) — Audio file to transcribe. Maximum size: 500 MB. Supported container formats (auto-detected): \`wav\`, \`mp3\`, \`ogg\`, \`opus\`, \`flac\`, \`aac\`, \`mp4\`, \`m4a\`, \`mkv\` (MP3/AAC/FLAC codecs only), \`webm\`, \`avi\`, \`mov\`. Supported raw formats (requires \`audio\_format\` and \`sample\_rate\`): \`pcm\`, \`mulaw\`, \`alaw\`. Must be the last field in the multipart form.

1012 1012 

1013* `url` (string) — URL of an audio file to download and transcribe (server-side). Either \`file\` or \`url\` must be provided.1013* `url` (string) — URL of an audio file to download and transcribe (server-side). Either \`file\` or \`url\` must be provided.

1014 1014 

1015* `audio_format` ("pcm" | "mulaw" | "alaw" | "wav" | "mp3" | "ogg" | "opus" | "flac" | "aac" | "mp4" | "m4a" | "mkv") — Audio format hint. \*\*Only required for raw/headerless formats\*\* (\`pcm\`, \`mulaw\`, \`alaw\`). For container formats (MP3, WAV, OGG, etc.) the server auto-detects the format from the file header — do not set this field.1015* `audio_format` ("pcm" | "mulaw" | "alaw" | "wav" | "mp3" | "ogg" | "opus" | "flac" | "aac" | "mp4" | "m4a" | "mkv" | "webm" | "avi" | "mov") — Audio format hint. \*\*Only required for raw/headerless formats\*\* (\`pcm\`, \`mulaw\`, \`alaw\`). For container formats (MP3, WAV, OGG, etc.) the server auto-detects the format from the file header — do not set this field.

1016 1016 

1017* `sample_rate` ("8000" | "16000" | "22050" | "24000" | "44100" | "48000") — Audio sample rate in Hz. \*\*Required when \`audio\_format\` is a raw format\*\* (\`pcm\`, \`mulaw\`, \`alaw\`). Ignored for container formats. Either \`sample\_rate\` or \`sample\_rate\_hertz\` may be used.1017* `sample_rate` ("8000" | "16000" | "22050" | "24000" | "44100" | "48000") — Audio sample rate in Hz. \*\*Required when \`audio\_format\` is a raw format\*\* (\`pcm\`, \`mulaw\`, \`alaw\`). Ignored for container formats. Either \`sample\_rate\` or \`sample\_rate\_hertz\` may be used.

1018 1018