SpyBara
Go Premium

Documentation 2026-09-14 06:00 UTC to 2026-09-15 17:00 UTC

10 files changed +152 −277. View all changes and history on the product overview
2026
Wed 30 23:57 Tue 29 23:59 Mon 28 23:57 Sun 27 22:59 Sat 26 23:59 Fri 25 23:01 Thu 24 23:59 Wed 23 23:59 Tue 22 23:58 Mon 21 23:00 Sun 20 23:01 Sat 19 23:59 Fri 18 23:59 Thu 17 10:04 Wed 16 19:01 Tue 15 17:00 Mon 14 06:00 Sun 13 05:00 Fri 11 21:00 Tue 8 21:00 Mon 7 22:57 Thu 3 16:59 Wed 2 22:03
Details

132 132 

133### Can I use regional endpoints with mTLS?133### Can I use regional endpoints with mTLS?

134 134 

135mTLS is currently available on the global `mtls.api.x.ai` endpoint. If you need mTLS with regional endpoints, contact [support@x.ai](mailto:support@x.ai).135mTLS is currently available on the global `mtls.api.x.ai` endpoint. If you need mTLS with [regional endpoints](/developers/advanced-api-usage/regions), contact [support@x.ai](mailto:support@x.ai).

136 136 

137### What certificate format do I need?137### What certificate format do I need?

138 138 

advanced-api-usage/regions.md +140 −0 created

Details

1#### Advanced API Usage

2 

3# Regional Endpoints

4 

5`https://api.x.ai` is the global endpoint. SpaceXAI may route requests between regions for capacity or reliability, so the processing location is not guaranteed.

6 

7If you need API request handling and model inference to happen in the United States, use the US regional endpoint, `https://us.api.x.ai/v1`. It is available to every team, and your existing API keys work on both endpoints.

8 

9> [!NOTE]

10>

11> The US endpoint currently serves one model, `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 SpaceXAI. See [What the guarantee covers](#what-the-guarantee-covers).

12 

13## Using the US endpoint

14 

15Point your client at `https://us.api.x.ai/v1`; the Python SDK (`xai_sdk`) takes the bare host, `us.api.x.ai`.

16 

17```javascript customLanguage="javascriptAISDK"

18import { createXai } from '@ai-sdk/xai';

19import { generateText } from 'ai';

20 

21const xai = createXai({

22 apiKey: process.env.XAI_API_KEY,

23 baseURL: 'https://us.api.x.ai/v1',

24});

25 

26const { text } = await generateText({

27 model: xai.responses('grok-4.6'),

28 prompt: 'Explain latency versus throughput in two sentences.',

29});

30 

31console.log(text);

32```

33 

34```python customLanguage="pythonXAI"

35import os

36 

37from xai_sdk import Client

38from xai_sdk.chat import user

39 

40client = Client(

41 api_key=os.getenv("XAI_API_KEY"),

42 api_host="us.api.x.ai",

43)

44 

45chat = client.chat.create(model="grok-4.6")

46chat.append(user("Explain latency versus throughput in two sentences."))

47 

48print(chat.sample().content)

49```

50 

51```python customLanguage="pythonOpenAISDK"

52import os

53from openai import OpenAI

54 

55client = OpenAI(

56 api_key=os.getenv("XAI_API_KEY"),

57 base_url="https://us.api.x.ai/v1",

58)

59 

60response = client.responses.create(

61 model="grok-4.6",

62 input="Explain latency versus throughput in two sentences.",

63)

64 

65print(response.output_text)

66```

67 

68```javascript customLanguage="javascriptOpenAISDK"

69import OpenAI from 'openai';

70 

71const client = new OpenAI({

72 apiKey: process.env.XAI_API_KEY,

73 baseURL: 'https://us.api.x.ai/v1',

74});

75 

76const response = await client.responses.create({

77 model: 'grok-4.6',

78 input: 'Explain latency versus throughput in two sentences.',

79});

80 

81console.log(response.output_text);

82```

83 

84```bash customLanguage="bash"

85curl https://us.api.x.ai/v1/responses \

86 -H "Authorization: Bearer $XAI_API_KEY" \

87 -H "Content-Type: application/json" \

88 -d '{

89 "model": "grok-4.6",

90 "input": "Explain latency versus throughput in two sentences."

91 }'

92```

93 

94### Model availability

95 

96`grok-4.6` is currently the only model available on the US endpoint; the [models page in the console](https://console.x.ai/team/default/models?cluster=us-central-1\&utm_source=docs\&utm_medium=referral\&utm_campaign=developers-advanced-api-usage-regions\&utm_content=models) and `GET https://us.api.x.ai/v1/models` always show the current list. Requesting a model that is not on that list, including `grok-latest`, fails with `404 Not Found`:

97 

98```json customLanguage="json"

99{

100 "code": "not-found",

101 "error": "The model grok-4-1-fast-reasoning does not exist or your team <team_id> does not have access to it. If you believe this is a mistake, please contact support and quote your team ID and the model name."

102}

103```

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.

106 

107## Pricing

108 

109Token usage on the US endpoint costs 10% more than on the global endpoint. The premium applies to input, output, and cached input tokens, including long-context rates, and [prompt caching](/developers/advanced-api-usage/prompt-caching) discounts still apply. The current per-token rates are on each model's detail page, reached from the [models page](/developers/models), and on the [Pricing](/developers/pricing) page.

110 

111## What the guarantee covers

112 

113When you call `https://us.api.x.ai/v1`, SpaceXAI guarantees that the following happen in the United States:

114 

115* Handling of the request by SpaceXAI's API servers.

116* Inference for the model you request.

117* Safety moderation of the request and the response.

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

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.

121 

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

123 

124> [!WARNING]

125>

126> A regional endpoint is not, by itself, a comprehensive data-residency guarantee. If you have contractual requirements about where your data is processed or stored, contact [sales@x.ai](mailto:sales@x.ai) before relying on the US endpoint for compliance.

127 

128## FAQ

129 

130### Does the US endpoint support tools, files, and structured outputs?

131 

132Yes. Requests to the US endpoint accept the same parameters as the global endpoint, including function calling, server-side tools, file attachments, and structured outputs. However, server-side tools and files are outside the US guarantee; see [What the guarantee covers](#what-the-guarantee-covers).

133 

134### Do prompt caches carry over between endpoints?

135 

136Prompt cache hits are not guaranteed across endpoints. Keep each conversation on one endpoint and set a [`prompt_cache_key`](/developers/advanced-api-usage/prompt-caching/maximizing-cache-hits) so its requests are routed together.

137 

138### Does Zero Data Retention apply on the US endpoint?

139 

140Yes. [Zero Data Retention](/developers/faq/security#what-is-zero-data-retention-zdr) is a team-level setting, so it applies to every request your team makes regardless of the endpoint.

faq/security.md +4 −0

Details

71 71 

72If the "improve the model" toggle is enabled from grok.com or mobile data controls settings, these chats via Build mode and build sessions, including data from created apps, may be used for product and model improvements.72If the "improve the model" toggle is enabled from grok.com or mobile data controls settings, these chats via Build mode and build sessions, including data from created apps, may be used for product and model improvements.

73 73 

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

75 

76The 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.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.

77 

74## Is the xAI API HIPAA compliant?78## Is the xAI API HIPAA compliant?

75 79 

76To inquire about a Business Associate Agreement (BAA), please complete our [BAA Questionnaire](https://x.ai/legal/baa). A member of our team will review your responses and reach out with next steps.80To inquire about a Business Associate Agreement (BAA), please complete our [BAA Questionnaire](https://x.ai/legal/baa). A member of our team will review your responses and reach out with next steps.

Details

232* **Maximum file size: 50 MiB.** Larger files remain available through the authenticated Files API but cannot be made public.232* **Maximum file size: 50 MiB.** Larger files remain available through the authenticated Files API but cannot be made public.

233* **Restricted content types.** Only the following are eligible:233* **Restricted content types.** Only the following are eligible:

234 * `image/png` (`.png`)234 * `image/png` (`.png`)

235 * `image/jpeg` (`.jpg`)235 * `image/jpeg` (`.jpg`, `.jpeg`)

236 * `image/gif` (`.gif`)

237 * `image/webp` (`.webp`)

236 * `video/mp4` (`.mp4`)238 * `video/mp4` (`.mp4`)

239 * `video/webm` (`.webm`)

237 * `application/pdf` (`.pdf`)240 * `application/pdf` (`.pdf`)

238* **Expiry must be between 1 hour and 30 days**, and a public URL can never outlive its file.241* **Expiry must be between 1 hour and 30 days**, and a public URL can never outlive its file.

239* **Deleting the file revokes the public URL** automatically. You cannot keep a public URL alive after the file is deleted (manually or by expiration).242* **Deleting the file revokes the public URL** automatically. You cannot keep a public URL alive after the file is deleted (manually or by expiration).

grok-4-6.md +1 −0

Details

96## Where it runs96## Where it runs

97 97 

98* **xAI API**: get a key from the [console](https://console.x.ai/?utm_source=docs\&utm_medium=referral\&utm_campaign=developers-grok-4-6\&utm_content=console-home)98* **xAI API**: get a key from the [console](https://console.x.ai/?utm_source=docs\&utm_medium=referral\&utm_campaign=developers-grok-4-6\&utm_content=console-home)

99* **US regional endpoint**: currently the only model served at `https://us.api.x.ai/v1`, which keeps inference in the United States, with token usage priced at a 10% premium; see [Regional Endpoints](/developers/advanced-api-usage/regions)

99* **Grok Build**: the default model of the [coding agent](/build/overview), on the API and CLI100* **Grok Build**: the default model of the [coding agent](/build/overview), on the API and CLI

100* **Cursor**: available on all plans101* **Cursor**: available on all plans

101* **Model gateways**: OpenRouter, Vercel, and Cloudflare102* **Model gateways**: OpenRouter, Vercel, and Cloudflare

rate-limits.md +1 −1

Details

40| 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 |40| 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-build-0.1 | T0: 37, T1: 50, T2: 75, T3: 125, T4: 208 | T0: 10M, T1: 15M, T2: 25M, T3: 45M, T4: 85M |41| 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-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 |

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

45| grok-imagine-image | T0: 6, T1: 12, T2: 25, T3: 50, T4: 100 | — |44| grok-imagine-image | 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-video | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |46| grok-imagine-video | T0: 10, T1: 20, T2: 39, T3: 79, T4: 158 | — |

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

48 48 

Details

8 8 

9| API | Base URL | Authenticate with |9| API | Base URL | Authenticate with |

10| --- | --- | --- |10| --- | --- | --- |

11| Inference (responses, chat completions, embeddings, images, videos, voice, files, batches, models) | `https://api.x.ai` | `Authorization: Bearer <xAI API key>` |11| Inference (responses, chat completions, images, videos, voice, files, batches, models) | `https://api.x.ai` | `Authorization: Bearer <xAI API key>` |

12| Collections management | `https://management-api.x.ai` | `Authorization: Bearer <xAI Management API key>` |12| Collections management | `https://management-api.x.ai` | `Authorization: Bearer <xAI Management API key>` |

13| Collections search | `https://api.x.ai` | `Authorization: Bearer <xAI API key>` |13| Collections search | `https://api.x.ai` | `Authorization: Bearer <xAI API key>` |

14| Management (API keys, teams, billing, audit) | `https://management-api.x.ai` | `Authorization: Bearer <xAI Management API key>` |14| Management (API keys, teams, billing, audit) | `https://management-api.x.ai` | `Authorization: Bearer <xAI Management API key>` |


19 19 

20* [Responses](/developers/rest-api-reference/inference/responses)20* [Responses](/developers/rest-api-reference/inference/responses)

21* [Chat Completions](/developers/rest-api-reference/inference/chat-completions)21* [Chat Completions](/developers/rest-api-reference/inference/chat-completions)

22* [Embeddings](/developers/rest-api-reference/inference/embeddings)

23* [Images](/developers/rest-api-reference/inference/images)22* [Images](/developers/rest-api-reference/inference/images)

24* [Videos](/developers/rest-api-reference/inference/videos)23* [Videos](/developers/rest-api-reference/inference/videos)

25* [Voice](/developers/rest-api-reference/inference/voice)24* [Voice](/developers/rest-api-reference/inference/voice)

rest-api-reference/inference/embeddings.md +0 −188 deleted

File Deleted View Diff

1#### Inference API

2 

3# Embeddings

4 

5***

6 

7## POST /v1/embeddings

8 

9Create an embedding vector representation corresponding to the input text. This is the endpoint for making requests to embedding models.

10 

11### Request Body

12 

13* `dimensions` (integer | null) — The number of dimensions the resulting output embeddings should have.

14 

15* `encoding_format` (string | null) — The format to return the embeddings in. Can be either \`float\` or \`base64\`.

16 

17* `input` (object | object | object | object)

18 

19 * `String` (string, required) — A strings to be embedded. For best performance, prepend "query: " in front of query content and prepend "passage: " in front of passage/text

20 

21 * `StringArray` (array\<string>, required) — An array of strings to be embedded

22 

23 * `Ints` (array\<integer>, required) — A token in integer to be embedded

24 

25 * `IntsArray` (array\<array\<integer>>, required) — An array of tokens in integers to be embedded

26 

27* `model` (string) — ID of the model to use.

28 

29* `preview` (boolean | null) — Flag to use the new format of the API.

30 

31* `user` (string | null) — A unique identifier representing your end-user, which can help xAI to monitor and detect abuse.

32 

33### Response Body

34 

35* `data` (array\<object>, required) — A list of embedding objects.

36 

37 * `embedding` (string | array\<number>, required)

38 

39 * `index` (integer, required) — Index of the embedding object in the data list.

40 

41 * `object` (string, required) — The object type, which is always \`"embedding"\`.

42 

43* `model` (string, required) — Model ID used to create embedding.

44 

45* `object` (string, required) — The object type of \`data\` field, which is always \`"list"\`.

46 

47* `usage` (object)

48 

49 * `prompt_tokens` (integer, required) — Prompt token used.

50 

51 * `total_tokens` (integer, required) — Total token used.

52 

53\*\*Request example:\*\*

54 

55```json

56"{\n \"input\": [\"This is an example content to embed...\"],\n \"model\": \"v1\",\n \"encoding_format\": \"float\"\n }"

57```

58 

59\*\*Response example:\*\*

60 

61```json

62{

63 "object": "list",

64 "model": "v1",

65 "data": [

66 {

67 "index": 0,

68 "embedding": [

69 0.01567895,

70 0.063257694,

71 0.045925662

72 ],

73 "object": "embedding"

74 }

75 ],

76 "usage": {

77 "prompt_tokens": 1,

78 "total_tokens": 1

79 }

80}

81```

82 

83***

84 

85## GET /v1/embedding-models

86 

87List all embedding models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, fingerprint and alias(es).

88 

89### Response Body

90 

91* `models` (array\<object>, required) — Array of available embedding models.

92 

93 * `aliases` (array\<string>, required) — Alias ID(s) of the model that user can use in a request's model field.

94 

95 * `created` (integer, required) — Model creation time in Unix timestamp.

96 

97 * `fingerprint` (string, required) — Fingerprint of the xAI system configuration hosting the model.

98 

99 * `id` (string, required) — Model ID. Obtainable from \<https://console.x.ai/team/default/models> or \<https://docs.x.ai/docs/models>.

100 

101 * `input_modalities` (array\<string>, required) — The input modalities supported by the model.

102 

103 * `object` (string, required) — Object type, should be model.

104 

105 * `output_modalities` (array\<string>, required) — The output modalities supported by the model.

106 

107 * `owned_by` (string, required) — Owner of the model.

108 

109 * `prompt_image_token_price` (integer, required) — Price of the prompt image token in USD cents per million token.

110 

111 * `prompt_text_token_price` (integer, required) — Price of the prompt text token in USD cents per million token.

112 

113 * `version` (string, required) — Version of the model.

114 

115\*\*Response example:\*\*

116 

117```json

118{

119 "models": [

120 {

121 "id": "v1",

122 "fingerprint": "fp_df37966059",

123 "created": 1725148800,

124 "object": "model",

125 "owned_by": "xai",

126 "version": "0.1.0",

127 "input_modalities": [

128 "text"

129 ],

130 "prompt_text_token_price": 100,

131 "prompt_image_token_price": 0,

132 "aliases": []

133 }

134 ]

135}

136```

137 

138***

139 

140## GET /v1/embedding-models/\{model\_id}

141 

142Get full information about an embedding model with its model\_id.

143 

144### Path Parameters

145 

146* `model_id` (string, required) — ID of the model to get.

147 

148### Response Body

149 

150* `aliases` (array\<string>, required) — Alias ID(s) of the model that user can use in a request's model field.

151 

152* `created` (integer, required) — Model creation time in Unix timestamp.

153 

154* `fingerprint` (string, required) — Fingerprint of the xAI system configuration hosting the model.

155 

156* `id` (string, required) — Model ID. Obtainable from \<https://console.x.ai/team/default/models> or \<https://docs.x.ai/docs/models>.

157 

158* `input_modalities` (array\<string>, required) — The input modalities supported by the model.

159 

160* `object` (string, required) — Object type, should be model.

161 

162* `output_modalities` (array\<string>, required) — The output modalities supported by the model.

163 

164* `owned_by` (string, required) — Owner of the model.

165 

166* `prompt_image_token_price` (integer, required) — Price of the prompt image token in USD cents per million token.

167 

168* `prompt_text_token_price` (integer, required) — Price of the prompt text token in USD cents per million token.

169 

170* `version` (string, required) — Version of the model.

171 

172\*\*Response example:\*\*

173 

174```json

175{

176 "id": "v1",

177 "created": 1725148800,

178 "object": "model",

179 "owned_by": "xai",

180 "version": "0.1.0",

181 "input_modalities": [

182 "text"

183 ],

184 "prompt_text_token_price": 10,

185 "prompt_image_token_price": 0,

186 "aliases": []

187}

188```

Details

4 4 

5***5***

6 6 

7## GET /v1/me

8 

9Get information about the currently authenticated caller.

10Works with both API keys and OAuth tokens. Returns identity, team, and ZDR status.

11 

12### Response Body

13 

14* `api_key` (object)

15 

16 * `api_key_id` (string, required) — The API key ID.

17 

18 * `blocked` (boolean, required) — Whether the API key is blocked.

19 

20 * `disabled` (boolean, required) — Whether the API key is disabled.

21 

22 * `redacted_api_key` (string, required) — The redacted API key.

23 

24* `oauth` (object)

25 

26 * `client_id` (string, required) — The OAuth client\_id of the application.

27 

28* `team_blocked` (boolean, required) — Whether the team is blocked from making API requests.

29 

30* `team_id` (string, required) — Team ID associated with the credentials.

31 

32* `user_id` (string, required) — User ID associated with the credentials.

33 

34* `zdr_status` ("no\_zdr" | "zdr" | "pii\_scrubbing", required) — Zero Data Retention status for a team.

35 

36\*\*Response example:\*\*

37 

38```json

39{

40 "user_id": "59fbe5f2-040b-46d5-8325-868bb8f23eb2",

41 "team_id": "5ea6f6bd-7815-4b8a-9135-28b2d7ba6722",

42 "zdr_status": "no_zdr",

43 "team_blocked": false,

44 "api_key": {

45 "redacted_api_key": "xai-...b14o",

46 "api_key_id": "ae1e1841-4326-4b36-a8a9-8a1a7237db11",

47 "blocked": false,

48 "disabled": false

49 }

50}

51```

52 

53***

54 

55## GET /v1/api-key7## GET /v1/api-key

56 8 

57Get information about an API key, including name, status, permissions and users who created or modified this key.9Get information about an API key, including name, status, permissions and users who created or modified this key.

Details

555 555 

556***556***

557 557 

558## GET /v1/responses/\{response\_id}/input\_items

559 

560List input items for a previously generated response.

561 

562### Path Parameters

563 

564* `response_id` (string, required) — The response id returned by a previous create response request.

565 

566### Query Parameters

567 

568* `limit` (integer) — Maximum number of items to return (1-100, default 20).

569 

570* `order` ("asc" | "desc") — Sort order: asc or desc. Default asc.

571 

572* `after` (string) — Cursor for pagination. Returns items after this item ID.

573 

574### Response Body

575 

576* `data` (array\<object>, required) — The list of input items.

577 

578* `first_id` (string | null) — The ID of the first item in the list.

579 

580* `has_more` (boolean, required) — Whether there are more items beyond this page.

581 

582* `last_id` (string | null) — The ID of the last item in the list.

583 

584* `object` (string, required) — The object type, always \`list\`.

585 

586\*\*Response example:\*\*

587 

588```json

589{}

590```

591 

592***

593 

594## DELETE /v1/responses/\{response\_id}558## DELETE /v1/responses/\{response\_id}

595 559 

596Delete a previously generated response.560Delete a previously generated response.