SpyBara
Go Premium

Documentation 2026-10-11 23:58 UTC to 2026-10-12 23:02 UTC

24 files changed +187 −61. 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

31)31)

32 32 

33async def send_request(sem: Semaphore, request: str) -> dict:33async def send_request(sem: Semaphore, request: str) -> dict:

34 """Send a single request to xAI with semaphore control."""34 """Send a single request to SpaceXSI with semaphore control."""

35 # The 'async with sem' ensures only a limited number of requests run at once35 # The 'async with sem' ensures only a limited number of requests run at once

36 async with sem:36 async with sem:

37 return await client.chat.completions.create(37 return await client.chat.completions.create(

Details

13 13 

14> [!NOTE]14> [!NOTE]

15>15>

16> Treat `encrypted_content` as **opaque** — do not parse or modify it. You can store the blob in your own database and pass it back unchanged in later requests; it is only meaningful when sent back to xAI's API.16> Treat `encrypted_content` as **opaque** — do not parse or modify it. You can store the blob in your own database and pass it back unchanged in later requests; it is only meaningful when sent back to SpaceXSI's API.

17 17 

18## When to compact18## When to compact

19 19 

Details

153 -H "Authorization: Bearer $XAI_API_KEY"153 -H "Authorization: Bearer $XAI_API_KEY"

154```154```

155 155 

156A successful response confirms both your certificate and API key are working. If you see `403 Forbidden`, check that your certificate is signed by the CA you provided to SpaceXAI.156A successful response confirms both your certificate and API key are working. If you see `403 Forbidden`, check that your certificate is signed by the CA you provided to SpaceXSI.

Details

17response = client.chat.completions.create(17response = client.chat.completions.create(

18 model="grok-4.7",18 model="grok-4.7",

19 messages=[19 messages=[

20 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by xAI."},20 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by SpaceXSI."},

21 {"role": "user", "content": "What is prompt caching?"},21 {"role": "user", "content": "What is prompt caching?"},

22 ],22 ],

23 extra_headers={23 extra_headers={


37 -d '{37 -d '{

38 "model": "grok-4.7",38 "model": "grok-4.7",

39 "messages": [39 "messages": [

40 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by xAI."},40 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by SpaceXSI."},

41 {"role": "user", "content": "What is prompt caching?"}41 {"role": "user", "content": "What is prompt caching?"}

42 ]42 ]

43 }'43 }'


58 {58 {

59 role: 'system',59 role: 'system',

60 content:60 content:

61 'You are Grok, a helpful and truthful AI assistant built by xAI.',61 'You are Grok, a helpful and truthful AI assistant built by SpaceXSI.',

62 },62 },

63 { role: 'user', content: 'What is prompt caching?' },63 { role: 'user', content: 'What is prompt caching?' },

64 ],64 ],


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

141 model: 'grok-4.7',141 model: 'grok-4.7',

142 input: 'What is prompt caching?',142 input: 'What is prompt caching?',

143 // @ts-expect-error -- xAI-specific field143 // @ts-expect-error -- SpaceXSI-specific field

144 prompt_cache_key: 'b79ad29b-b3f9-463c-bca6-041d5058d366',144 prompt_cache_key: 'b79ad29b-b3f9-463c-bca6-041d5058d366',

145});145});

146 146 


164)164)

165 165 

166chat = client.chat.create(model="grok-4.7")166chat = client.chat.create(model="grok-4.7")

167chat.append(system("You are Grok, a helpful and truthful AI assistant built by xAI."))167chat.append(system("You are Grok, a helpful and truthful AI assistant built by SpaceXSI."))

168chat.append(user("What is prompt caching?"))168chat.append(user("What is prompt caching?"))

169 169 

170response = chat.sample()170response = chat.sample()

Details

27 27 

28conversation_id = "conv_abc123"28conversation_id = "conv_abc123"

29messages = [29messages = [

30 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by xAI."},30 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by SpaceXSI."},

31 {"role": "user", "content": "What is prompt caching?"},31 {"role": "user", "content": "What is prompt caching?"},

32]32]

33 33 


61 -d '{61 -d '{

62 "model": "grok-4.7",62 "model": "grok-4.7",

63 "messages": [63 "messages": [

64 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by xAI."},64 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by SpaceXSI."},

65 {"role": "user", "content": "What is prompt caching?"},65 {"role": "user", "content": "What is prompt caching?"},

66 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."}66 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."}

67 ]67 ]


75 -d '{75 -d '{

76 "model": "grok-4.7",76 "model": "grok-4.7",

77 "messages": [77 "messages": [

78 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by xAI."},78 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by SpaceXSI."},

79 {"role": "user", "content": "What is prompt caching?"},79 {"role": "user", "content": "What is prompt caching?"},

80 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."},80 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."},

81 {"role": "user", "content": "Show me a code example."}81 {"role": "user", "content": "Show me a code example."}


96 {96 {

97 role: 'system',97 role: 'system',

98 content:98 content:

99 'You are Grok, a helpful and truthful AI assistant built by xAI.',99 'You are Grok, a helpful and truthful AI assistant built by SpaceXSI.',

100 },100 },

101 { role: 'user', content: 'What is prompt caching?' },101 { role: 'user', content: 'What is prompt caching?' },

102];102];


138 -d '{138 -d '{

139 "model": "grok-4.7",139 "model": "grok-4.7",

140 "messages": [140 "messages": [

141 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by xAI."},141 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by SpaceXSI."},

142 {"role": "user", "content": "What is prompt caching?"},142 {"role": "user", "content": "What is prompt caching?"},

143 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."},143 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."},

144 {"role": "assistant", "content": "It stores KV pairs."},144 {"role": "assistant", "content": "It stores KV pairs."},


162 -d '{162 -d '{

163 "model": "grok-4.7",163 "model": "grok-4.7",

164 "messages": [164 "messages": [

165 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by xAI."},165 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by SpaceXSI."},

166 {"role": "user", "content": "What is prompt caching?"},166 {"role": "user", "content": "What is prompt caching?"},

167 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."},167 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."},

168 {"role": "user", "content": "Show me a code example."}168 {"role": "user", "content": "Show me a code example."}


186 "model": "grok-4.7",186 "model": "grok-4.7",

187 "messages": [187 "messages": [

188 {"role": "user", "content": "What is prompt caching?"},188 {"role": "user", "content": "What is prompt caching?"},

189 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by xAI."},189 {"role": "system", "content": "You are Grok, a helpful and truthful AI assistant built by SpaceXSI."},

190 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."},190 {"role": "assistant", "content": "Prompt caching stores KV pairs from unchanged prompt prefixes so they can be reused on subsequent requests. This makes responses faster and cheaper."},

191 {"role": "user", "content": "Show me a code example."}191 {"role": "user", "content": "Show me a code example."}

192 ]192 ]

Details

2 2 

3# Regional Endpoints3# Regional Endpoints

4 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.5`https://api.x.ai` is the global endpoint. SpaceXSI may route requests between regions for capacity or reliability, so the processing location is not guaranteed.

6 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.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 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 SpaceXAI. 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, 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).

12 12 

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

14 14 


110 110 

111## What the guarantee covers111## What the guarantee covers

112 112 

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

114 114 

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

116* Inference for the model you request.116* Inference for the model you request.

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 SpaceXAI retains. The [Security FAQ](/developers/faq/security#does-spacexai-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, 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 121 

community.md +1 −1

Details

8 8 

9### LiteLLM9### LiteLLM

10 10 

11LiteLLM provides a simple SDK or proxy server for calling different LLM providers. If you're using LiteLLM, integrating SpaceXAI as your provider is straightforward—just swap out the model name and API key to SpaceXAI's Grok model in your configuration.11LiteLLM provides a simple SDK or proxy server for calling different LLM providers. If you're using LiteLLM, integrating SpaceXSI as your provider is straightforward—just swap out the model name and API key to SpaceXSI's Grok model in your configuration.

12 12 

13For latest information and more examples, visit [LiteLLM xAI Provider Documentation](https://docs.litellm.ai/docs/providers/xai).13For latest information and more examples, visit [LiteLLM xAI Provider Documentation](https://docs.litellm.ai/docs/providers/xai).

14 14 

Details

2 2 

3# Google Cloud Vertex AI3# Google Cloud Vertex AI

4 4 

5Access SpaceXAI’s Grok models through Google Cloud’s managed platform with enterprise security, governance, and unified billing.5Access SpaceXSI’s Grok models through Google Cloud’s managed platform with enterprise security, governance, and unified billing.

6 6 

7This guide walks through setting up and using Grok models on Google Cloud Vertex AI / Gemini Enterprise Agent Platform. Grok on Vertex AI is accessed as a partner model through the OpenAI-compatible API, including the Responses API and Chat Completions. Models are enabled through Model Garden.7This guide walks through setting up and using Grok models on Google Cloud Vertex AI / Gemini Enterprise Agent Platform. Grok on Vertex AI is accessed as a partner model through the OpenAI-compatible API, including the Responses API and Chat Completions. Models are enabled through Model Garden.

8 8 


181* Explore enabled models in Model Garden.181* Explore enabled models in Model Garden.

182* Build agentic applications that use Grok’s tool-calling strengths.182* Build agentic applications that use Grok’s tool-calling strengths.

183* Integrate with Google Cloud services such as Cloud Functions and Vertex AI Pipelines.183* Integrate with Google Cloud services such as Cloud Functions and Vertex AI Pipelines.

184* Review the full SpaceXAI Grok documentation and model cards for prompting tips and capabilities.184* Review the full SpaceXSI Grok documentation and model cards for prompting tips and capabilities.

Details

2 2 

3# Microsoft Foundry3# Microsoft Foundry

4 4 

5Access SpaceXAI’s frontier reasoning and agentic models through Azure AI Foundry with enterprise-grade security, governance, and unified billing.5Access SpaceXSI’s frontier reasoning and agentic models through Azure AI Foundry with enterprise-grade security, governance, and unified billing.

6 6 

7This guide walks through setting up and using Grok models on Microsoft Foundry. Grok models on Foundry give you strong reasoning, native tool use, enterprise authentication through Microsoft Entra ID, Azure-native monitoring, and an OpenAI-compatible API.7This guide walks through setting up and using Grok models on Microsoft Foundry. Grok models on Foundry give you strong reasoning, native tool use, enterprise authentication through Microsoft Entra ID, Azure-native monitoring, and an OpenAI-compatible API.

8 8 

9Usage is billed through the Azure Marketplace / your Azure subscription. Grok models are delivered through the SpaceXAI–Microsoft partnership with Azure-managed endpoints and optional Azure AI Content Safety layers. Review the specific model card in the Foundry catalog for the latest details on data processing, retention, and terms.9Usage is billed through the Azure Marketplace / your Azure subscription. Grok models are delivered through the SpaceXSI–Microsoft partnership with Azure-managed endpoints and optional Azure AI Content Safety layers. Review the specific model card in the Foundry catalog for the latest details on data processing, retention, and terms.

10 10 

11Grok on Foundry works with the official OpenAI Python/TypeScript SDKs, `azure-ai-projects`, LangChain, Semantic Kernel, LlamaIndex, and most OpenAI-compatible frameworks. Streaming, tool calling, and structured outputs are supported.11Grok on Foundry works with the official OpenAI Python/TypeScript SDKs, `azure-ai-projects`, LangChain, Semantic Kernel, LlamaIndex, and most OpenAI-compatible frameworks. Streaming, tool calling, and structured outputs are supported.

12 12 


200```python customLanguage="pythonOpenAISDK"200```python customLanguage="pythonOpenAISDK"

201stream = client.responses.create(201stream = client.responses.create(

202 model="grok-4.3",202 model="grok-4.3",

203 input="Write a short, helpful onboarding guide for a new engineer joining xAI.",203 input="Write a short, helpful onboarding guide for a new engineer joining SpaceXSI.",

204 max_output_tokens=600,204 max_output_tokens=600,

205 stream=True,205 stream=True,

206)206)


216 216 

217## Correlation IDs and debugging217## Correlation IDs and debugging

218 218 

219Foundry includes standard Azure request identifiers in response headers, such as `request-id`, `apim-request-id`, and `x-ms-request-id`. When contacting Microsoft or SpaceXAI support, include these IDs with your deployment name and approximate timestamp.219Foundry includes standard Azure request identifiers in response headers, such as `request-id`, `apim-request-id`, and `x-ms-request-id`. When contacting Microsoft or SpaceXSI support, include these IDs with your deployment name and approximate timestamp.

220 220 

221## Feature support and capabilities221## Feature support and capabilities

222 222 


231 231 

232## Safety and responsible AI232## Safety and responsible AI

233 233 

234Grok models include SpaceXAI’s safety training and alignment. On Foundry, Azure AI Content Safety is available and often enabled by default or easily integrated.234Grok models include SpaceXSI’s safety training and alignment. On Foundry, Azure AI Content Safety is available and often enabled by default or easily integrated.

235 235 

236Before production deployment:236Before production deployment:

237 237 


247* Validate vision/multimodal support and exact parameter availability for your chosen model/deployment.247* Validate vision/multimodal support and exact parameter availability for your chosen model/deployment.

248* Rate limits and quotas are managed at the Azure resource level.248* Rate limits and quotas are managed at the Azure resource level.

249 249 

250For the authoritative list of supported parameters and behaviors, consult the model card inside Azure AI Foundry and SpaceXAI Grok documentation linked from the catalog.250For the authoritative list of supported parameters and behaviors, consult the model card inside Azure AI Foundry and SpaceXSI Grok documentation linked from the catalog.

251 251 

252## Best practices for production252## Best practices for production

253 253 

Details

242 242 

243response = client.responses.create(243response = client.responses.create(

244 model="grok-4.7",244 model="grok-4.7",

245 input="What are people saying about xAI's latest announcement?",245 input="What are people saying about SpaceXSI's latest announcement?",

246 tools=[246 tools=[

247 {"type": "web_search"},247 {"type": "web_search"},

248 {"type": "x_search"},248 {"type": "x_search"},


263 -d '{263 -d '{

264 "model": "grok-4.7",264 "model": "grok-4.7",

265 "tools": [{"type": "web_search"}, {"type": "x_search"}],265 "tools": [{"type": "web_search"}, {"type": "x_search"}],

266 "input": "What are people saying about xAI'\''s latest announcement?"266 "input": "What are people saying about SpaceXSI'\''s latest announcement?"

267 }' | jq '{tools_used: .usage.num_server_side_tools_used, cost_in_usd_ticks: .usage.cost_in_usd_ticks}'267 }' | jq '{tools_used: .usage.num_server_side_tools_used, cost_in_usd_ticks: .usage.cost_in_usd_ticks}'

268```268```

269 269 


279 model="grok-4.7",279 model="grok-4.7",

280 tools=[web_search(), x_search()],280 tools=[web_search(), x_search()],

281)281)

282chat.append(user("What are people saying about xAI's latest announcement?"))282chat.append(user("What are people saying about SpaceXSI's latest announcement?"))

283 283 

284response = chat.sample()284response = chat.sample()

285print(response.content)285print(response.content)

docs-mcp.md +1 −1

Details

2 2 

3# Docs MCP Server3# Docs MCP Server

4 4 

5SpaceXAI hosts a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that gives AI assistants and agents direct access to the SpaceXAI documentation. Instead of copy-pasting docs into a prompt, you can point any MCP-compatible client at the server and let it pull the information it needs.5SpaceXSI hosts a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that gives AI assistants and agents direct access to the SpaceXSI documentation. Instead of copy-pasting docs into a prompt, you can point any MCP-compatible client at the server and let it pull the information it needs.

6 6 

7You can use this with all popular IDEs/Editors of your choice.7You can use this with all popular IDEs/Editors of your choice.

8 8 

faq/accounts.md +3 −3

Details

43 43 

44You can visit [xAI Accounts](https://accounts.x.ai) to manage your account.44You can visit [xAI Accounts](https://accounts.x.ai) to manage your account.

45 45 

46Please note the xAI account is different from the X account, and SpaceXAI cannot assist you with X account issues. Please46Please note the xAI account is different from the X account, and SpaceXSI cannot assist you with X account issues. Please

47contact X via [X Help Center](https://help.x.com/) or Premium Support if you encounter any issues with your X account.47contact X via [X Help Center](https://help.x.com/) or Premium Support if you encounter any issues with your X account.

48 48 

49## I received an email of someone logging into my xAI account49## I received an email of someone logging into my xAI account

50 50 

51SpaceXAI will send an email to you when someone logs into your xAI account. The login location is an approximation based on your IP address, which is dependent on your network setup and ISP and might not reflect exactly where the login happened.51SpaceXSI will send an email to you when someone logs into your xAI account. The login location is an approximation based on your IP address, which is dependent on your network setup and ISP and might not reflect exactly where the login happened.

52 52 

53If you think the login is not you, please [reset your password](https://accounts.x.ai/request-reset-password) and [clear your login sessions](https://accounts.x.ai/sessions). We also recommend all users to [add a multi-factor authentication method](https://accounts.x.ai/security).53If you think the login is not you, please [reset your password](https://accounts.x.ai/request-reset-password) and [clear your login sessions](https://accounts.x.ai/sessions). We also recommend all users to [add a multi-factor authentication method](https://accounts.x.ai/security).

54 54 


58 58 

59You can visit [xAI Accounts](https://accounts.x.ai/account) to delete your account. You can restore your account by logging in again and confirming restoration within 30 days.59You can visit [xAI Accounts](https://accounts.x.ai/account) to delete your account. You can restore your account by logging in again and confirming restoration within 30 days.

60 60 

61You can cancel the deletion within 30 days by logging in again to any SpaceXAI websites and following the prompt to confirm restoring the account.61You can cancel the deletion within 30 days by logging in again to any SpaceXSI websites and following the prompt to confirm restoring the account.

62 62 

63For privacy requests, please go to: https://privacy.x.ai.63For privacy requests, please go to: https://privacy.x.ai.

faq/general.md +2 −2

Details

20 20 

21Please refer to our [Legal Resources](https://x.ai/legal) for our Enterprise Terms of Service and Data Processing Addendum.21Please refer to our [Legal Resources](https://x.ai/legal) for our Enterprise Terms of Service and Data Processing Addendum.

22 22 

23### Does SpaceXAI sell crypto tokens?23### Does SpaceXSI sell crypto tokens?

24 24 

25SpaceXAI is not affiliated with any cryptocurrency. We are aware of several scam websites that unlawfully use our name and logo.25SpaceXSI is not affiliated with any cryptocurrency. We are aware of several scam websites that unlawfully use our name and logo.

faq/security.md +13 −13

Details

2 2 

3# Security3# Security

4 4 

5## Does SpaceXAI train on customers' API requests?5## Does SpaceXSI train on customers' API requests?

6 6 

7> [!NOTE]7> [!NOTE]

8>8>

9> SpaceXAI never trains on your API inputs or outputs without your explicit permission.9> SpaceXSI never trains on your API inputs or outputs without your explicit permission.

10 10 

11By default, all API requests and responses are stored on our servers (encrypted at rest) for 30 days for auditing purposes in the event of suspected abuse or misuse. SpaceXAI does not train on this data, and it is automatically deleted after 30 days.11By default, all API requests and responses are stored on our servers (encrypted at rest) for 30 days for auditing purposes in the event of suspected abuse or misuse. SpaceXSI does not train on this data, and it is automatically deleted after 30 days.

12 12 

13For teams that require stricter data handling, see [Zero Data Retention (ZDR)](#what-is-zero-data-retention-zdr) below.13For teams that require stricter data handling, see [Zero Data Retention (ZDR)](#what-is-zero-data-retention-zdr) below.

14 14 

15## How do I identify which of my end users caused a policy violation?15## How do I identify which of my end users caused a policy violation?

16 16 

17Send a `safety_identifier` with each request. It is an opaque, stable string that your application assigns to the end user behind the request; end users never choose it themselves. When a request violates our usage policies, SpaceXAI can attribute it to that identifier instead of to your whole API key, and reference that identifier when it contacts you. The field is the same as OpenAI's `safety_identifier`.17Send a `safety_identifier` with each request. It is an opaque, stable string that your application assigns to the end user behind the request; end users never choose it themselves. When a request violates our usage policies, SpaceXSI can attribute it to that identifier instead of to your whole API key, and reference that identifier when it contacts you. The field is the same as OpenAI's `safety_identifier`.

18 18 

19Hash it: send a hash of your internal user ID or another opaque value, never an email address, phone number, or display name. SpaceXAI does not validate the format.19Hash it: send a hash of your internal user ID or another opaque value, never an email address, phone number, or display name. SpaceXSI does not validate the format.

20 20 

21```bash21```bash

22curl https://api.x.ai/v1/responses \22curl https://api.x.ai/v1/responses \


37 37 

38> [!WARNING]38> [!WARNING]

39>39>

40> **For most customers, we do not recommend enabling ZDR**. ZDR disables important API features that depend on stored data, including the stateful Responses API, Files and Collections, and the Batch API (see the full list below). Because content deleted under ZDR can never be recovered or produced by SpaceXAI, only enable it when your compliance requirements truly demand it. For most teams, the default 30-day retention is the better choice.40> **For most customers, we do not recommend enabling ZDR**. ZDR disables important API features that depend on stored data, including the stateful Responses API, Files and Collections, and the Batch API (see the full list below). Because content deleted under ZDR can never be recovered or produced by SpaceXSI, only enable it when your compliance requirements truly demand it. For most teams, the default 30-day retention is the better choice.

41 41 

42* **No storage of prompts:** ZDR ensures that API request inputs (i.e., your prompt) and outputs (i.e., the tokens generated by the LLM) are never persisted to disk. The 30-day audit retention described above does not apply to ZDR-enabled teams.42* **No storage of prompts:** ZDR ensures that API request inputs (i.e., your prompt) and outputs (i.e., the tokens generated by the LLM) are never persisted to disk. The 30-day audit retention described above does not apply to ZDR-enabled teams.

43* **Applied at a team level:** If enabled, ZDR is team-wide. There is no ability to enable ZDR for specific API keys.43* **Applied at a team level:** If enabled, ZDR is team-wide. There is no ability to enable ZDR for specific API keys.


45 45 

46### Features not supported with ZDR46### Features not supported with ZDR

47 47 

48Any capability that relies on SpaceXAI storing data is unavailable while ZDR is enabled:48Any capability that relies on SpaceXSI storing data is unavailable while ZDR is enabled:

49 49 

50| Feature | Why it is unavailable under ZDR |50| Feature | Why it is unavailable under ZDR |

51| --- | --- |51| --- | --- |

52| **Per-API-key request logging** | Recording the full request and response for each API key so you can review them in the Console. Under ZDR, request and response logs are not retained, and any existing per-key request-logging flags are cleared when ZDR is enabled. |52| **Per-API-key request logging** | Recording the full request and response for each API key so you can review them in the Console. Under ZDR, request and response logs are not retained, and any existing per-key request-logging flags are cleared when ZDR is enabled. |

53| **[Stateful Responses API](/developers/model-capabilities/text/generate-text#chaining-the-conversation)** | A mode where SpaceXAI stores your conversation server-side so you can continue it later by referencing a previous response. That history cannot be stored under ZDR (`store_messages`, `previous_response_id`), so the client must store conversation history on the client side instead. Please remember to enable `use_encrypted_content` for [agentic tool-calling state](/developers/tools/advanced-usage#append-the-encrypted-agentic-tool-calling-states). |53| **[Stateful Responses API](/developers/model-capabilities/text/generate-text#chaining-the-conversation)** | A mode where SpaceXSI stores your conversation server-side so you can continue it later by referencing a previous response. That history cannot be stored under ZDR (`store_messages`, `previous_response_id`), so the client must store conversation history on the client side instead. Please remember to enable `use_encrypted_content` for [agentic tool-calling state](/developers/tools/advanced-usage#append-the-encrypted-agentic-tool-calling-states). |

54| **[Files API](/developers/files)** | Lets you upload a file to SpaceXAI once and reference it by `file_id` across later requests. Uploaded files are stored server-side, so under ZDR new uploads and `file_id` attachments are blocked. Existing files can still be viewed and deleted. |54| **[Files API](/developers/files)** | Lets you upload a file to SpaceXSI once and reference it by `file_id` across later requests. Uploaded files are stored server-side, so under ZDR new uploads and `file_id` attachments are blocked. Existing files can still be viewed and deleted. |

55| **[Collections API](/developers/files/collections)** | Stores your documents on SpaceXAI so Grok can search and retrieve from them (RAG). Those documents must be stored to be retrieved, which ZDR does not allow. Existing collections can still be viewed and deleted. |55| **[Collections API](/developers/files/collections)** | Stores your documents on SpaceXSI so Grok can search and retrieve from them (RAG). Those documents must be stored to be retrieved, which ZDR does not allow. Existing collections can still be viewed and deleted. |

56| **[Batch API](/developers/advanced-api-usage/batch-api)** | Processes large sets of requests asynchronously at a discounted price. Batched requests are stored until they are processed, so the Batch API is unavailable under ZDR. |56| **[Batch API](/developers/advanced-api-usage/batch-api)** | Processes large sets of requests asynchronously at a discounted price. Batched requests are stored until they are processed, so the Batch API is unavailable under ZDR. |

57| **[Deferred completions](/developers/advanced-api-usage/deferred-chat-completions)** | Return a request ID right away and let you fetch the result later instead of holding the connection open. That result is stored until you retrieve it, which ZDR does not permit. Concurrent client-side requests (for example via `AsyncClient`) are unaffected. |57| **[Deferred completions](/developers/advanced-api-usage/deferred-chat-completions)** | Return a request ID right away and let you fetch the result later instead of holding the connection open. That result is stored until you retrieve it, which ZDR does not permit. Concurrent client-side requests (for example via `AsyncClient`) are unaffected. |

58| **Stored [image](/developers/model-capabilities/images/generation) and [video](/developers/model-capabilities/video/generation) outputs** | Image and video generation can have SpaceXAI host the generated media and return it as a `file_id` or URL. Under ZDR there is no SpaceXAI-side output storage: no `file_id` inputs and no stored outputs. For images, return base64 or supply your own pre-signed upload URLs in `output.upload_urls` (one per image, required for deferred image requests). For video, you must supply your own `output.upload_url`. In both cases SpaceXAI uploads the result to your URL via HTTP `PUT` and stores nothing itself. Image generation is also limited to `grok-imagine` models and excludes agentic image generation. The Console video playground asks for a pre-signed upload URL before each video it generates, plus an optional pre-signed view URL to watch the video. |58| **Stored [image](/developers/model-capabilities/images/generation) and [video](/developers/model-capabilities/video/generation) outputs** | Image and video generation can have SpaceXSI host the generated media and return it as a `file_id` or URL. Under ZDR there is no SpaceXSI-side output storage: no `file_id` inputs and no stored outputs. For images, return base64 or supply your own pre-signed upload URLs in `output.upload_urls` (one per image, required for deferred image requests). For video, you must supply your own `output.upload_url`. In both cases SpaceXSI uploads the result to your URL via HTTP `PUT` and stores nothing itself. Image generation is also limited to `grok-imagine` models and excludes agentic image generation. The Console video playground asks for a pre-signed upload URL before each video it generates, plus an optional pre-signed view URL to watch the video. |

59| **Voice agent conversation history** | Voice agent conversations are not persisted when ZDR is enabled. |59| **Voice agent conversation history** | Voice agent conversations are not persisted when ZDR is enabled. |

60 60 

61### How to enable ZDR61### How to enable ZDR


100 100 

101To 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.101To 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.

102 102 

103## Is SpaceXAI GDPR and SOC II compliant?103## Is SpaceXSI GDPR and SOC II compliant?

104 104 

105We are SOC 2 Type 2 compliant. Customers with a signed NDA can refer to our [Trust Center](https://trust.x.ai/) for up-to-date information on our certifications and data governance.105We are SOC 2 Type 2 compliant. Customers with a signed NDA can refer to our [Trust Center](https://trust.x.ai/) for up-to-date information on our certifications and data governance.

106 106 


118 118 

119Rotate keys regularly for added security. If you suspect a compromise, log into the xAI console first. Ensure you are viewing the correct team, as API keys are tied to specific teams. Navigate to the "API Keys" section via the sidebar. In the API Keys table, click the vertical ellipsis (three dots) next to the key. Select "Disable key" to deactivate it temporarily or "Delete key" to remove it permanently. Then, click the "Create API Key" button to generate a new one and update your applications.119Rotate keys regularly for added security. If you suspect a compromise, log into the xAI console first. Ensure you are viewing the correct team, as API keys are tied to specific teams. Navigate to the "API Keys" section via the sidebar. In the API Keys table, click the vertical ellipsis (three dots) next to the key. Select "Disable key" to deactivate it temporarily or "Delete key" to remove it permanently. Then, click the "Create API Key" button to generate a new one and update your applications.

120 120 

121SpaceXAI partners with GitHub's Secret Scanning program to detect leaked keys. If a leak is found, we disable the key and notify you via email. Monitor your account for unusual activity to stay protected.121SpaceXSI partners with GitHub's Secret Scanning program to detect leaked keys. If a leak is found, we disable the key and notify you via email. Monitor your account for unusual activity to stay protected.

Details

4 4 

5## What are teams?5## What are teams?

6 6 

7Teams are the level at which SpaceXAI tracks API usage, processes billing, and issues invoices.7Teams are the level at which SpaceXSI tracks API usage, processes billing, and issues invoices.

8 8 

9* If you’re the team creator and don’t need a new team, you can rename your Personal Team and add members instead of creating a new one.9* If you’re the team creator and don’t need a new team, you can rename your Personal Team and add members instead of creating a new one.

10* Each team has **roles**:10* Each team has **roles**:


14 14 

15## Which team am I on?15## Which team am I on?

16 16 

17When you sign up for SpaceXAI, you’re automatically assigned to a **Personal Team**, which you can view the top bar of [xAI Console](https://console.x.ai?utm_source=docs\&utm_medium=referral\&utm_campaign=developers-faq-team-management\&utm_content=console-home).17When you sign up for SpaceXSI, you’re automatically assigned to a **Personal Team**, which you can view the top bar of [xAI Console](https://console.x.ai?utm_source=docs\&utm_medium=referral\&utm_campaign=developers-faq-team-management\&utm_content=console-home).

18 18 

19## How can I manage teams and team members?19## How can I manage teams and team members?

20 20 

Details

727| `created_at` | integer | Upload time as a Unix timestamp (seconds). |727| `created_at` | integer | Upload time as a Unix timestamp (seconds). |

728| `expires_at` | integer or null | Unix timestamp at which the file will be deleted. `null` for permanent files; set when the file was uploaded with `expires_after`. |728| `expires_at` | integer or null | Unix timestamp at which the file will be deleted. `null` for permanent files; set when the file was uploaded with `expires_after`. |

729| `object` | string | Always `"file"`. Returned for OpenAI compatibility. |729| `object` | string | Always `"file"`. Returned for OpenAI compatibility. |

730| `purpose` | string | Echoes the `purpose` value sent at upload time. SpaceXAI does not enforce or interpret this field; it is stored for OpenAI SDK compatibility. Setting `"assistants"` is the conventional choice. |730| `purpose` | string | Echoes the `purpose` value sent at upload time. SpaceXSI does not enforce or interpret this field; it is stored for OpenAI SDK compatibility. Setting `"assistants"` is the conventional choice. |

731 731 

732## Limitations and Considerations732## Limitations and Considerations

733 733 

Details

2 2 

3# Public URLs3# Public URLs

4 4 

5Every file you upload through the [Files API](/developers/files/managing-files) lives in private storage by default — fetching it requires your API key. **Public URLs** turn a stored file into a permanent, shareable link on the SpaceXAI CDN that anyone can open — no API key required.5Every file you upload through the [Files API](/developers/files/managing-files) lives in private storage by default — fetching it requires your API key. **Public URLs** turn a stored file into a permanent, shareable link on the SpaceXSI CDN that anyone can open — no API key required.

6 6 

7You stay in control after creation:7You stay in control after creation:

8 8 

grok-4-7.md +1 −1

Details

2 2 

3# Grok 4.73# Grok 4.7

4 4 

5Grok 4.7 is SpaceXAI's frontier model built for coding, agentic tasks, and knowledge work.5Grok 4.7 is SpaceXSI's frontier model built for coding, agentic tasks, and knowledge work.

6 6 

7## Using the API7## Using the API

8 8 

Details

82 82 

83* [Image Generation](/developers/model-capabilities/images/generation) — Generate images from text prompts83* [Image Generation](/developers/model-capabilities/images/generation) — Generate images from text prompts

84* [Multi-Image Editing](/developers/model-capabilities/images/multi-image-editing) — Edit with multiple source images84* [Multi-Image Editing](/developers/model-capabilities/images/multi-image-editing) — Edit with multiple source images

85* [Image Prompting Guide](/developers/model-capabilities/images/prompting-guide) — When to edit, and how to phrase an edit prompt

85* [API Reference](/developers/rest-api-reference) — Full endpoint documentation86* [API Reference](/developers/rest-api-reference) — Full endpoint documentation

86* [Imagine API Landing Page](https://x.ai/api/imagine) — Showcase of the Imagine API in action87* [Imagine API Landing Page](https://x.ai/api/imagine) — Showcase of the Imagine API in action

Details

586 586 

587* [Models](/developers/models) — Available image models587* [Models](/developers/models) — Available image models

588* [Image Editing](/developers/model-capabilities/images/editing) — Edit images with natural language588* [Image Editing](/developers/model-capabilities/images/editing) — Edit images with natural language

589* [Image Prompting Guide](/developers/model-capabilities/images/prompting-guide) — Write prompts that keep the subject recognizable

589* [Image Generation Tool](/developers/tools/image-generation) — Let Grok generate and edit images inside a conversation590* [Image Generation Tool](/developers/tools/image-generation) — Let Grok generate and edit images inside a conversation

590* [Video Generation](/developers/model-capabilities/video/generation) — Generate videos from text prompts591* [Video Generation](/developers/model-capabilities/video/generation) — Generate videos from text prompts

591* [API Reference](/developers/rest-api-reference) — Full endpoint documentation592* [API Reference](/developers/rest-api-reference) — Full endpoint documentation

Details

1#### Imagine API

2 

3# Image Prompting Guide

4 

5This guide covers prompts for `grok-imagine-image-2.0` stills: a new image from text, or an edit of an existing one.

6 

7The score that matters is whether the subject in the picture matches the subject in the prompt. Palette, film grain, and styling come after that.

8 

9## Request settings

10 

11Generate a new image with [`/v1/images/generations`](/developers/model-capabilities/images/generation):

12 

13```bash

14curl -X POST https://api.x.ai/v1/images/generations \

15 -H "Authorization: Bearer $XAI_API_KEY" \

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

17 -d '{

18 "model": "grok-imagine-image-2.0",

19 "prompt": "...",

20 "aspect_ratio": "3:2",

21 "resolution": "2k",

22 "quality": "medium",

23 "response_format": "b64_json",

24 "n": 1

25 }'

26```

27 

28Use [`/v1/images/edits`](/developers/model-capabilities/images/editing) when a picture already has the right subject and layout:

29 

30```bash

31curl -X POST https://api.x.ai/v1/images/edits \

32 -H "Authorization: Bearer $XAI_API_KEY" \

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

34 -d '{

35 "model": "grok-imagine-image-2.0",

36 "prompt": "...",

37 "image": {"url": "data:image/jpeg;base64,...", "type": "image_url"},

38 "aspect_ratio": "3:2",

39 "resolution": "2k",

40 "quality": "medium",

41 "response_format": "b64_json"

42 }'

43```

44 

45Lock `aspect_ratio` across a series so the images sit together; `3:2` suits most photographs. [`quality`](/developers/model-capabilities/images/generation#quality) accepts `low`, `medium`, or `auto`, and `auto` currently serves `low` on generation and `medium` on edit. Pin `medium` and `2k` when fine detail has to be recognizable. Generated URLs are temporary, so request `b64_json` when you plan to keep the file, or store it with [Imagine outputs](/developers/model-capabilities/imagine/files/outputs).

46 

47## Write the subject first

48 

49Open with one sentence that names the subject, the state or form it is in, what holds or supports it, and the setting.

50 

51> A matte sage-green ceramic pour-over dripper sitting on a glass carafe half full of coffee, on a pale oak counter against white square tile.

52 

53Then describe the subject as something you could point at and recognize:

54 

55* Every key element, by name, in the form it takes in the picture. A wool coat is heavy twill with a visible weave. Coffee in a glass carafe is dark amber, lighter at the edges. A paperback has a creased spine. Feta in a salad is irregular crumbles.

56* How many. Two mugs. One open notebook. One person, seen from the waist up. One wedge pulled a finger-width aside.

57* Where the eye enters. A 45-degree three-quarter view at counter height, or a straight-down overhead of the desk. State it once in the subject paragraph, and repeat it in the composition paragraph in the same words.

58 

59A prompt that leads with mood, film stock, or a list of things to avoid produces a styled scene whose subject is a stand-in.

60 

61## Shape of a prompt

62 

63Keep the same order in every prompt of a series:

64 

651. **Subject.** What it is, its form, what holds or supports it, the setting.

662. **Details and focal point.** Key elements, materials, count, and the camera angle, written as one cluster that fills the frame.

673. **Art direction.** The color fields and the two or three props, each named: oak counter, white tile, linen towel, one brass spoon.

684. **Light.** The source, its direction, and how hard it is, for example hard afternoon sun from the left with on-camera fill flash. Say what the highlights and shadows look like, and ask for an exposure bright enough to read the subject.

695. **Color.** The subject's colors and the background colors as separate fields: sage green, dark amber, pale oak, white.

706. **Composition.** Crop, what the frame cuts off, and what stays sharp. One scene.

71 

72Write prose that describes one photograph. A line that reads like an instruction ("make the coat darker") describes an attribute of that single picture; the model has no before-and-after to work from.

73 

74## Say the thing you want to see

75 

76Describe the material. "Brushed steel with fine horizontal grain" gives the model a surface to render, while "not shiny" gives it nothing to draw.

77 

78A long avoid list is easy to ignore, and it spends the prompt on objects that then show up anyway. Keep a constraint only when it is a count or a specific object, and pair it with the thing you want: "one stainless spoon resting on the saucer."

79 

80Name each object as what it is. A plate, a bowl, and an enameled skillet are different things, and so are a tote, a satchel, and a backpack. When the distinction matters, describe the feature that makes it that object: for a skillet, a cream enamel wall rising around the food and a handle cropped by the frame. A thin brown line on a ceramic rim reads as a plate.

81 

82State texture once, physically. Repeated texture words get painted onto the wrong surface: cottage-cheese curds turn into a pebbled skin on the wrap that holds them, Parmesan flakes turn into paper squares, and potato chunks climb out of a frittata to sit on top as garnish.

83 

84Ask for light that leaves the subject readable. "Bright and vivid, hard sun, flash, warm shadows with texture" holds. "Slightly underexposed" and "crushed shadows" pull the same picture dark. Leave out chromatic fringing, dust, and scratches; the model draws them as defects.

85 

86## Generate, then edit

87 

88Generate when there is no picture yet, or when the subject itself is wrong: it is a different object, a key element is missing, or the count is off.

89 

90Edit when the subject and the layout are already right and one to three details need to change. Lead with those changes. Follow with one sentence that keeps the same subject, angle, crop, and prop placement.

91 

92> Replace the metal watch strap with a brown leather strap with cream stitching. Keep the same wrist, the same shirt cuff, the same angle, and the same desk.

93 

94An edit that opens with "keep everything" barely moves. An edit that pastes in a full new prompt restages the scene: the subject drifts, a second copy of a prop appears, and one object turns into a similar one, such as a plate into a pan.

95 

96Change the words when a fix does not land. Repeating "more realistic" turns into a new texture on the wrong part of the picture. Point at the part instead: "the cut face shows separate russet potato chunks in moist egg," or "the leather shows creases where the strap bends."

97 

98## How to tell a prompt worked

99 

100Judge each picture against the original prompt, even after several rounds of edits. The question is whether this subject matches that prompt:

101 

102* The subject is the one named.

103* Each element named in the prompt is visible, in the form the prompt describes.

104* The count matches.

105* Each object is the object the prompt named.

106* The picture is bright enough to see the subject.

107 

108A matching background with the wrong subject is a miss. Save the prompt next to the image. On the next pass, change only the detail that failed and leave the rest of the original prompt in place, so the subject and the layout stay put.

109 

110## Short prompts

111 

112A single still outside a series needs four to six sentences: subject and details, then setting, then light, then crop.

113 

114> A pair of white leather low-top sneakers with gum rubber soles, shot from a low three-quarter angle. The laces are loosely tied, the toe boxes show soft creases, and the left shoe sits slightly ahead of the right. They stand on pale gray concrete against a warm off-white wall. Hard morning sun from the right casts long, sharp shadows, with soft fill on the shaded side. 50mm product photograph, both shoes sharp, cropped just above the heel tabs.

115 

116> A woman in her sixties with short silver hair and reading glasses pushed up on her head, laughing while she pots a small olive tree at a wooden workbench. Her hands are dusted with dark soil and her sleeves are rolled to the elbow. Terracotta pots and a steel trowel sit on the bench beside her. Soft window light from the left, bright and warm, with gentle shadows. 35mm photograph at eye level, framed from the waist up, her face in sharp focus.

117 

118> A vegetarian Greek salad in a warm cream ceramic bowl, shot from a slight overhead angle. Cucumber, tomato, thick red onion, irregular feta crumbles, and wrinkled Kalamata olives overlap in olive oil, with oregano on the tomatoes. The bowl sits on butter-yellow linen over terracotta. A warm pita is partly visible at the right edge and a fork rests on the rim. Hard summer sun and on-camera flash, bright and vivid, with warm shadows. 35mm photograph, food filling the bowl, one frame.

119 

120## Related

121 

122* [Image Generation](/developers/model-capabilities/images/generation): request parameters for aspect ratio, resolution, and quality

123* [Image Editing](/developers/model-capabilities/images/editing): edit an existing image with a prompt

124* [Multi-Image Editing](/developers/model-capabilities/images/multi-image-editing): edit with several source images

Details

2 2 

3# Comparison with Chat Completions API3# Comparison with Chat Completions API

4 4 

5The Responses API is the recommended way to interact with SpaceXAI models. Here's how it compares to the legacy Chat Completions API:5The Responses API is the recommended way to interact with SpaceXSI models. Here's how it compares to the legacy Chat Completions API:

6 6 

7| Feature | Responses API | Chat Completions API (Deprecated) |7| Feature | Responses API | Chat Completions API (Deprecated) |

8|---------|---------------|-----------------------------------|8|---------|---------------|-----------------------------------|

quickstart.md +3 −3

Details

2 2 

3# Quickstart3# Quickstart

4 4 

5Welcome! In this guide, we'll walk you through the basics of using the SpaceXAI API, from creating an account to making your first request.5Welcome! In this guide, we'll walk you through the basics of using the SpaceXSI API, from creating an account to making your first request.

6 6 

7## Step 1: Create a SpaceXAI account7## Step 1: Create a SpaceXSI account

8 8 

9Sign up for an account at [console.x.ai](https://console.x.ai/login?mode=sign-up\&utm_source=docs\&utm_medium=referral\&utm_campaign=quickstart), then load it with credits to start using the API.9Sign up for an account at [console.x.ai](https://console.x.ai/login?mode=sign-up\&utm_source=docs\&utm_medium=referral\&utm_campaign=quickstart), then load it with credits to start using the API.

10 10 


44 44 

45## Step 4: Make your first request45## Step 4: Make your first request

46 46 

47Send a coding prompt to [Grok Build](/build/overview) (`grok-4.7`) and get a response. The same model powers agentic coding in Grok Build and is available on the SpaceXAI API:47Send a coding prompt to [Grok Build](/build/overview) (`grok-4.7`) and get a response. The same model powers agentic coding in Grok Build and is available on the SpaceXSI API:

48 48 

49```javascript customLanguage="javascriptAISDK"49```javascript customLanguage="javascriptAISDK"

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

Details

24 24 

25* `max_tokens` (integer | null) — \\\[DEPRECATED\\] The maximum number of tokens that can be generated in the chat completion. Deprecated in favor of \`max\_completion\_tokens\`.25* `max_tokens` (integer | null) — \\\[DEPRECATED\\] The maximum number of tokens that can be generated in the chat completion. Deprecated in favor of \`max\_completion\_tokens\`.

26 26 

27* `messages` (array\<object | object | object | object | object>) — A list of messages that make up the chat conversation. Different models support different message types, such as image and text.27* `messages` (array\<object | object | object | object | object | object>) — A list of messages that make up the chat conversation. Different models support different message types, such as image and text.

28 28 

29* `model` (string) — Model name for the model to use. Obtainable from \<https://console.x.ai/team/default/models> or \<https://docs.x.ai/docs/models>.29* `model` (string) — Model name for the model to use. Obtainable from \<https://console.x.ai/team/default/models> or \<https://docs.x.ai/docs/models>.

30 30