Developer 3s Key Decision Metrics
On 2026-10-02 xAI published the official TypeScript SDK @xai-official/sdk (repo xai-org/xai-sdk-ts, Apache-2.0). The same day, 0.2.0 renamed the client to SpaceXAI; npm latest at fetch was 0.2.1. One ESM package covers Grok text, voice, image and video, plus hosted web search, X search, code execution, and remote MCP. Zero runtime dependencies, Node 22.13+, and browser use blocked by default. No public benchmark.
Key Takeaways
- ✓Package:
@xai-official/sdkin xai-org/xai-sdk-ts, Apache-2.0, zero runtime deps. npm latest at fetch was 0.2.1 (2026-10-02 22:18 UTC); the post cited 0.2.0 - ✓0.2.0 breaking rename: client class
xAItoSpaceXAI(changelog). 0.2.1 addstoJson(schema), streaming partial JSON, andretryBeforeOutput - ✓Node.js 22.13+, ESM only; browser and Worker use blocked by default. Hosted tools include web search, X search, code execution, and remote MCP; functions and shell run locally
- ✓No public SDK latency or coding score. About 27 GitHub stars and 312 npm weekly downloads at fetch time. Sample model
grok-4.7is not a benchmark - ✓Not the same package as Vercel
@ai-sdk/xai. Keep the API key on the server. Interfaces may change before 1.0; outside PRs are not accepted yet
Finished reading? Explore benchmark rankings & pricing
Real-world SWE-bench scores & $20/mo vs API cost break-even calculator
Project Links & Resources
Direct AccessIn-Depth Technical Analysis
Why a first-party client
TypeScript apps calling Grok have mostly used the OpenAI SDK with a custom base URL, or Vercel's @ai-sdk/xai. Voice, image, video, batch, and hosted tools were separate integrations. On 2026-10-02 the repo xai-org/xai-sdk-ts published @xai-official/sdk (Apache-2.0, npm author SpaceXAI). The same day shipped 0.1.0, 0.2.0, and 0.2.1. 0.2.0 renamed the client class from xAI to SpaceXAI. A community post cited 0.2.0; npm latest at fetch time was 0.2.1 (2026-10-02 22:18 UTC). The README marks the SDK experimental: interfaces may change before 1.0, and outside PRs are not accepted yet.
How the client is built
No runtime dependencies. ESM only. Node.js 22.13+. The client reads XAI_API_KEY and blocks browser and Worker use by default so a secret is not shipped to clients. responses.create targets the Responses API and streams under the hood even when stream is omitted, so long reasoning is not cut off by Node fetch waiting about five minutes for headers. The SDK sends store: false unless you opt in (unlike the wire default) and uses toInput() to carry encrypted reasoning into the next turn. responses.compact() folds a long thread into one encrypted item. Helpers in @xai-official/sdk/tools cover web search, X search, Python code execution, collections search, remote MCP, in-response image generation, and deferred tool search. Function tools and shell run in your process.
Benchmarks
There is no published SDK latency, time-to-first-token, or coding score in the repo, changelog, or npm page. What is measurable is the release clock on 2026-10-02 UTC: 0.1.0 at 16:58, 0.2.0 at 18:28, 0.2.1 at 22:18. 0.2.1 adds toJson(schema) for Standard Schema validators (Zod 3.24+, Valibot 1, ArkType 2, and others), a streaming "json" event plus parsePartialJson(), and retryBeforeOutput for failures before any model output. A 429 without Retry-After now backs off from 1 second (cap 30s), not 250ms. At fetch time the GitHub page showed about 27 stars and npm reported 312 weekly downloads. README samples use grok-4.7; that is not a score. About 2,100 views on the post measure attention only.
Try it
Create a key at console.x.ai, export XAI_API_KEY, then npm install @xai-official/sdk. import { SpaceXAI } from "@xai-official/sdk", new SpaceXAI(), then client.responses.create({ model: "grok-4.7", input }) and toText(). For streaming set stream: true, listen for text, and await stream.done(). Keep the key on the server. Browser realtime voice should use a short-lived client secret against wss://api.x.ai/v1/realtime. Pin a version and read the changelog: the 0.2.0 rename is breaking. This package is not @ai-sdk/xai.

Discussion & Comments
0Sign in to join the discussion
Connect with AI developers to exchange benchmark insights.