Learning resourcesReviewed · xAI

x.ai API Quickstart

This is an API setup guide for developers starting with Grok text and image generation, but API use requires credits and the page gives no prices. It provides JavaScript, Python and HTTP examples using grok-4.7 and grok-imagine-image-2.0.

Researched 13 Nov 2026

In short.

This is an API setup guide for developers making their first Grok text and image requests, but it requires account credits without explaining request prices. It covers account creation, API keys, several SDK choices and direct HTTP requests. Its examples name grok-4.7 for text and grok-imagine-image-2.0 for images. No examples were executed, and successful requests, output quality, current model availability and SDK compatibility are not established.

Researched and written by an AI model and checked by a second AI model. How it works

The complete selected page at [https://docs.x.ai/developers/quickstart.md] is covered, including account and key setup, all SDK installation options, text and image examples, and references to further resources. Linked pages, including pricing, models, capability guides, Grok Build and Grok Bot, are excluded. No licence or terms notice appears in the supplied page. No installation, account creation, API request, compatibility check or output evaluation was performed.

The overview

Resource identity

The resource is the documentation page titled Quickstart at [https://docs.x.ai/developers/quickstart.md]. It introduces account setup and first requests for Grok text and image generation.

The page calls the service the SpaceXSI API while directing readers to [https://console.x.ai] and using [https://api.x.ai/v1] in its examples. It does not explain that naming.

Practical assessment

The guide gives developers concrete starting points: installation commands, model identifiers, authentication examples and response fields to print. Its multiple client options make it useful for choosing an initial integration approach.

Its depth is limited to getting started. It provides no returned model outputs, performance measurements or operational guidance sufficient to assess a production integration.

Intended users

The guide suits developers who are new to this API and can already run basic Python, JavaScript or terminal commands. Beginners receive a short setup sequence; experienced developers receive explicit endpoints and client configuration.

Developers already using an OpenAI SDK can inspect examples that configure it for this service. Compatibility beyond the calls shown is unknown.

What the guide covers

The text examples submit a coding question to grok-4.7 and show how to access response text. The image examples submit a scene description to grok-imagine-image-2.0 and access an image URL or base64 data, depending on the client.

The page links to multi-turn chat, reasoning, structured outputs, streaming, document retrieval, tools, image editing, Grok Build and Grok Bot. Those links identify further topics; their implementations and capabilities are not established by this page.

Using it

Requirements

The stated setup requires an account, loaded credits and an API key. Readers also need an environment capable of running their chosen SDK or curl and reaching the API.

The examples use XAI_API_KEY as an environment variable. Required Python, Node.js and package versions are not specified, and regional availability or account eligibility is not explained.

How requests work

The examples send authenticated requests to a remote API. The direct text request uses [https://api.x.ai/v1/responses] with model and input fields. The image request uses [https://api.x.ai/v1/images/generations] with model and prompt fields. Both HTTP examples authenticate with a bearer API key.

The OpenAI SDK examples configure [https://api.x.ai/v1] as their base URL. The JavaScript AI SDK uses its xAI provider, while the native Python SDK shows chat creation and sampling for text and image sampling for images. The page does not demonstrate equivalence across these interfaces.

Setup instructions

The documented sequence is to create an account, add credits, generate an API key, configure the key and install a client. Installation options are npm install ai @ai-sdk/xai zod, pip install openai, npm install openai, or pip install xai-sdk. Direct curl examples are also provided.

The guide shows exporting XAI_API_KEY or placing it in a .env file, but it does not configure a .env loader. The Python OpenAI text example passes a key placeholder directly; its image example reads XAI_API_KEY from the environment.

Example requests

The text example asks grok-4.7 to fix and explain this function: function median(a){a.sort();return a[a.length/2]}. Depending on the client, the snippet prints response.output_text, the AI SDK text result or sampled chat content. No generated correction is included, so coding accuracy is unknown.

The image example requests a futuristic city skyline at sunset using grok-imagine-image-2.0. The snippets access an image URL or base64 data, but no generated image is supplied for inspection.

Assessment & evidence

Limitations

The examples omit error handling, retries, timeouts and rate-limit handling. The page does not specify context limits, output limits, image constraints, URL lifetime or version-pinned dependencies.

No execution results or benchmarks are included. Reliability, latency, output quality and compatibility with currently available packages and models are not assessed.

Basis for the assessment

The guide's practical value comes from showing the configuration and request fields needed for an initial integration in several familiar clients. Concrete model identifiers and response-access examples help developers understand what to send and where to find the result.

Its missing prices, operational details and actual outputs limit the decisions it supports. It explains how an initial request is constructed; it does not establish whether the models meet a particular application's quality, reliability or budget requirements.

Integration alternatives

The page offers the JavaScript AI SDK with its xAI provider, the OpenAI SDK for Python or JavaScript, the native Python xai-sdk, and direct HTTP through curl. These are alternative clients for accessing the same service.

No comparison of other providers, model quality, client performance or total integration cost is supplied. A recommendation among competing services cannot be established from this page.

Source evidence

The evidence consists of the complete Quickstart page at [https://docs.x.ai/developers/quickstart.md]. It contains setup instructions and request snippets, with no returned API responses, generated images or runtime logs. No code or API requests were executed.

The captured source revision is sha256:db82f8978ddbe738a6d8e99a7cdda9f22203938b0b9d2f055fbb650942b28ca5.

Access & freshness

Costs

The page instructs readers to load their account with credits before using the API. It states no minimum funding amount, text or image request prices, billing units or free allowance. The cost of following either example is unknown.

A pricing page is linked at [https://docs.x.ai/developers/pricing], but its contents are outside the supplied evidence.

Rights and terms

The supplied page contains no explicit licence for its documentation or code examples. It also does not establish API contractual terms, commercial-use rights for generated outputs, or policies governing retention and training use of submitted data. These matters remain unknown from this resource.

Freshness

The page was captured on 2026-11-13 at 02:00:07.898 UTC. Its text supplies no publication date, update date or pinned SDK versions.

The model names grok-4.7 and grok-imagine-image-2.0 are documented in that capture. Their live availability, current pricing and compatibility with subsequently installed packages remain unverified.

Suggested next steps

For an initial integration, choose one client and follow its corresponding text or image example. Confirm the required package versions, model availability and exact request prices before allocating a budget.

For application use, establish the relevant service and output-use terms, add error handling, and evaluate generated results against your task. The linked text and image guides may provide further implementation detail, but their contents are not assessed here.

Evidence for this report

selected-page.txtselected · checked 2026-11-13