SpyBara
Go Premium

Documentation 2026-11-23 23:59 UTC to 2026-11-24 23:59 UTC

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

8 8 

9> [!NOTE]9> [!NOTE]

10>10>

11> The US endpoint currently serves two models, `grok-4.7` and `grok-4.6`, and none of the image generation, video generation, or voice APIs. Token usage costs 10% more than on the global endpoint. The US guarantee covers API request handling, inference, moderation, and retained request data. It does not cover Files, Collections, server-side tools, or the network path from your systems to SpaceXSI. See [What the guarantee covers](#what-the-guarantee-covers).11> The US endpoint currently serves two models, `grok-4.7` and `grok-4.6`, and none of the image generation or video generation APIs. Token usage costs 10% more than on the global endpoint. The US guarantee covers API request handling, inference, moderation, and retained request data. It does not cover Files, Collections, server-side tools, or the network path from your systems to SpaceXSI. See [What the guarantee covers](#what-the-guarantee-covers).

12 12 

13## Using the US endpoint13## Using the US endpoint

14 14 


102}102}

103```103```

104 104 

105If a request for a globally available model returns this error, confirm that your client is calling the intended endpoint before troubleshooting model access. The image generation, video generation, and voice APIs are not served by the US endpoint; use the global endpoint for those.105If a request for a globally available model returns this error, confirm that your client is calling the intended endpoint before troubleshooting model access. The image generation and video generation APIs are not served by the US endpoint; use the global endpoint for those.

106 106 

107## Pricing107## Pricing

108 108 


117* Safety moderation of the request and the response.117* Safety moderation of the request and the response.

118* Storage of the request metadata, prompt inputs, and model outputs that SpaceXSI retains. The [Security FAQ](/developers/faq/security#does-spacexsi-train-on-customers-api-requests) describes what is retained and for how long.118* Storage of the request metadata, prompt inputs, and model outputs that SpaceXSI retains. The [Security FAQ](/developers/faq/security#does-spacexsi-train-on-customers-api-requests) describes what is retained and for how long.

119 119 

120The image generation, video generation, and voice APIs are not served by the US endpoint. [Files](/developers/files), [Collections](/developers/files/collections), and server-side tools such as [web search](/developers/tools/web-search), [X search](/developers/tools/x-search), and [code execution](/developers/tools/code-execution) still work on the US endpoint, but they are outside the US guarantee and may process data outside the United States. If your requirements cover these features as well, avoid them when calling the US endpoint, or contact [support@x.ai](mailto:support@x.ai) to discuss your configuration.120The image generation and video generation APIs are not served by the US endpoint. [Files](/developers/files), [Collections](/developers/files/collections), and server-side tools such as [web search](/developers/tools/web-search), [X search](/developers/tools/x-search), and [code execution](/developers/tools/code-execution) still work on the US endpoint, but they are outside the US guarantee and may process data outside the United States. If your requirements cover these features as well, avoid them when calling the US endpoint, or contact [support@x.ai](mailto:support@x.ai) to discuss your configuration.

121 121 

122The guarantee also does not cover the network path between your own users or infrastructure and the endpoint.122The guarantee also does not cover the network path between your own users or infrastructure and the endpoint.

123 123 

faq/security.md +1 −1

Details

94 94 

95## Can I keep my data in the United States?95## Can I keep my data in the United States?

96 96 

97The default endpoint, `https://api.x.ai`, does not guarantee a processing region. To keep API request handling, model inference, moderation, and retained request data in the United States, use the US regional endpoint, `https://us.api.x.ai/v1`. It currently serves only `grok-4.7` and `grok-4.6`, with no image generation, video generation, or voice APIs, and its token prices are 10% higher than global rates. Files, Collections, server-side tools, and the network path from your systems to the endpoint are outside the guarantee. See [Regional Endpoints](/developers/advanced-api-usage/regions) for details.97The default endpoint, `https://api.x.ai`, does not guarantee a processing region. To keep API request handling, model inference, moderation, and retained request data in the United States, use the US regional endpoint, `https://us.api.x.ai/v1`. It currently serves only `grok-4.7` and `grok-4.6`, with no image generation or video generation APIs, and its token prices are 10% higher than global rates. Files, Collections, server-side tools, and the network path from your systems to the endpoint are outside the guarantee. See [Regional Endpoints](/developers/advanced-api-usage/regions) for details.

98 98 

99## Is audio from the voice APIs watermarked?99## Is audio from the voice APIs watermarked?

100 100 

Details

213 baseURL: "https://api.x.ai/v1",213 baseURL: "https://api.x.ai/v1",

214});214});

215 215 

216// Keys are sent in declaration order; expires_after must come before file.

216const file = await client.files.create({217const file = await client.files.create({

217 file: fs.createReadStream("/path/to/document.pdf"),

218 purpose: "assistants",218 purpose: "assistants",

219 expires_after: { anchor: "created_at", seconds: 86400 }, // 24 hours219 expires_after: { anchor: "created_at", seconds: 86400 }, // 24 hours

220 file: fs.createReadStream("/path/to/document.pdf"),

220});221});

221 222 

222console.log("File ID: " + file.id);223console.log("File ID: " + file.id);

rate-limits.md +0 −1

Details

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

40| grok-4.20-0309-reasoning | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |40| grok-4.20-0309-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 |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 |

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 |42| 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 | — |43| grok-imagine-image | 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 | — |44| grok-imagine-image-2.0 | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |

Details

270 )270 )

271 elif item.type in (271 elif item.type in (

272 "web_search_call",272 "web_search_call",

273 "x_search_call",273 "custom_tool_call", # X search arrives as custom_tool_call

274 "code_interpreter_call",274 "code_interpreter_call",

275 "file_search_call",275 "file_search_call",

276 "mcp_call",276 "mcp_call",


332 )332 )

333 elif item.type in (333 elif item.type in (

334 "web_search_call",334 "web_search_call",

335 "x_search_call",335 "custom_tool_call", # X search arrives as custom_tool_call

336 "code_interpreter_call",336 "code_interpreter_call",

337 "file_search_call",337 "file_search_call",

338 "mcp_call",338 "mcp_call",

Details

80 tools=tools,80 tools=tools,

81)81)

82 82 

83# Handle function calls83# Handle function calls, then send all results in one request

84outputs = []

84for item in response.output:85for item in response.output:

85 if item.type == "function_call":86 if item.type == "function_call":

86 args = json.loads(item.arguments)87 args = json.loads(item.arguments)

87 result = {"location": args["location"], "temperature": 59, "unit": args.get("unit", "fahrenheit")}88 result = {"location": args["location"], "temperature": 59, "unit": args.get("unit", "fahrenheit")}

89 outputs.append({"type": "function_call_output", "call_id": item.call_id, "output": json.dumps(result)})

88 90 

91if outputs:

89 response = client.responses.create(92 response = client.responses.create(

90 model="grok-4.7",93 model="grok-4.7",

91 input=[{"type": "function_call_output", "call_id": item.call_id, "output": json.dumps(result)}],94 input=outputs,

92 tools=tools,95 tools=tools,

93 previous_response_id=response.id,96 previous_response_id=response.id,

94 )97 )


164 args = json.loads(tc.function.arguments)167 args = json.loads(tc.function.arguments)

165 # Execute your function168 # Execute your function

166 result = {"location": args["location"], "temperature": 59, "unit": args.get("unit", "fahrenheit")}169 result = {"location": args["location"], "temperature": 59, "unit": args.get("unit", "fahrenheit")}

167 chat.append(tool_result(json.dumps(result)))170 chat.append(tool_result(json.dumps(result), tool_call_id=tc.id))

168 171 

169 response = chat.sample()172 response = chat.sample()

170 173 


242 245 

243tools_map = {"get_temperature": get_temperature}246tools_map = {"get_temperature": get_temperature}

244 247 

245# Process function calls248# Process function calls, then send all results in one request

249outputs = []

246for item in response.output:250for item in response.output:

247 if item.type == "function_call":251 if item.type == "function_call":

248 name = item.name252 name = item.name


253 else:257 else:

254 output = json.dumps(tools_map[name](**args))258 output = json.dumps(tools_map[name](**args))

255 259 

260 outputs.append({"type": "function_call_output", "call_id": item.call_id, "output": output})

261 

262if outputs:

256 response = client.responses.create(263 response = client.responses.create(

257 model="grok-4.7",264 model="grok-4.7",

258 input=[{"type": "function_call_output", "call_id": item.call_id, "output": output}],265 input=outputs,

259 tools=tools,266 tools=tools,

260 previous_response_id=response.id,267 previous_response_id=response.id,

261 )268 )


293 args = json.loads(tool_call.function.arguments)300 args = json.loads(tool_call.function.arguments)

294 301 

295 result = tools_map[name](**args)302 result = tools_map[name](**args)

296 chat.append(tool_result(json.dumps(result)))303 chat.append(tool_result(json.dumps(result), tool_call_id=tool_call.id))

297 304 

298 response = chat.sample()305 response = chat.sample()

299 306 


354* **Built-in tools** execute automatically on SpaceXSI servers361* **Built-in tools** execute automatically on SpaceXSI servers

355* **Custom tools** pause execution and return to you for handling362* **Custom tools** pause execution and return to you for handling

356 363 

364With the xAI SDK, `response.tool_calls` also lists the built-in calls the server already ran. Execute only the client-side ones: check `get_tool_call_type(tool_call) == "client_side_tool"` (from `xai_sdk.tools`) before looking a call up in your own functions.

365 

357See [Advanced Usage](/developers/tools/advanced-usage#mixing-server-side-and-client-side-tools) for complete examples with tool loops.366See [Advanced Usage](/developers/tools/advanced-usage#mixing-server-side-and-client-side-tools) for complete examples with tool loops.

358 367 

359## Tool Choice368## Tool Choice


365| `"auto"` | Model decides whether to call a tool (default) |374| `"auto"` | Model decides whether to call a tool (default) |

366| `"required"` | Model must call at least one tool |375| `"required"` | Model must call at least one tool |

367| `"none"` | Disable tool calling |376| `"none"` | Disable tool calling |

368| `{"type": "function", "function": {"name": "..."}}` | Force a specific tool |377| `{"type": "function", "name": "..."}` | Force a specific tool |

378 

379On the legacy Chat Completions API, force a specific tool with `{"type": "function", "function": {"name": "..."}}` instead. Each endpoint rejects the other's shape.

369 380 

370## Parallel Function Calling381## Parallel Function Calling

371 382 

372By default, parallel function calling is enabled — the model can request multiple tool calls in a single response. Process all of them before continuing:383By default, parallel function calling is enabled — the model can request multiple tool calls in a single response. Process all of them before continuing:

373 384 

374```pythonWithoutSDK385```pythonOpenAISDK

386# response.output may contain multiple function_call items

387outputs = []

388for item in response.output:

389 if item.type == "function_call":

390 result = tools_map[item.name](**json.loads(item.arguments))

391 outputs.append({"type": "function_call_output", "call_id": item.call_id, "output": json.dumps(result)})

392response = client.responses.create(

393 model="grok-4.7",

394 input=outputs,

395 tools=tools,

396 previous_response_id=response.id,

397)

398```

399 

400```pythonXAI

375# response.tool_calls may contain multiple calls401# response.tool_calls may contain multiple calls

402chat.append(response)

376for tool_call in response.tool_calls:403for tool_call in response.tool_calls:

377 result = tools_map[tool_call.function.name](**json.loads(tool_call.function.arguments))404 result = tools_map[tool_call.function.name](**json.loads(tool_call.function.arguments))

378 # Append each result...405 chat.append(tool_result(json.dumps(result), tool_call_id=tool_call.id))

406response = chat.sample()

379```407```

380 408 

381Disable with `parallel_tool_calls: false` in your request.409Disable with `parallel_tool_calls: false` in your request.


384 412 

385| Field | Required | Description |413| Field | Required | Description |

386|-------|----------|-------------|414|-------|----------|-------------|

387| `name` | Yes | Unique identifier (max 350 tools per request) |415| `name` | Yes | Unique identifier for the tool |

388| `description` | No | What the tool does. Treated as empty if omitted; a clear description helps the model decide when to use it |416| `description` | No | What the tool does. Treated as empty if omitted; a clear description helps the model decide when to use it |

389| `parameters` | Yes | JSON Schema defining function inputs |417| `parameters` | Yes | JSON Schema defining function inputs |

390 418 

419A request can include up to a maximum of 1,000 tools. Requests over the limit are rejected with a `400` error.

420 

391### Parameter Schema421### Parameter Schema

392 422 

393```json423```json