xAI has published an official TypeScript SDK for Grok. The package, @xai-official/sdk, hit npm at version 0.1.0 on October 2, 2026, with source under the xai-org organization on GitHub (xai-sdk-ts) and an Apache 2.0 license. Eric Zakariasson, an AI engineer at SpaceXAI who previously worked on Cursor, announced the release the same day.
The SDK is a typed ESM client built on xAI's REST API, covering the full product surface in one install: chat-style responses with streaming and multi-turn conversation, image input, structured JSON Schema output, function tools and shell tools; image generation and editing through models such as grok-imagine-image-2.0; asynchronous video jobs through grok-imagine-video-1.5 with generate, edit and extend operations; plus file upload and batch processing.
Hosted tools are a notable part of the package. The client exposes real-time X search, web search, code execution and remote MCP support, all executed server-side, while custom functions and shell commands run locally. The README draws an explicit distinction between the two: built-in tools run on xAI's infrastructure, developer tools run wherever the application does, and the SDK simply routes each call to the right place.
Engineering constraints are deliberately conservative. The package has zero runtime dependencies, requires Node.js 22.13 or later, is ESM-only, and blocks browser and Worker use by default so that XAI_API_KEY never lands in client-side code. A quickstart is short enough to read at a glance: install, export the key, instantiate the client, call responses.create with a model — grok-4.7 is the default in examples — and print the text.
Iteration has been fast enough to matter. Version 0.2.0 shipped the same day and renamed the client class from xAI to SpaceXAI, a breaking change flagged in the changelog; 0.2.1 followed hours later, adding toJson(schema), streaming partial JSON and a retryBeforeOutput option. At the time of writing the repository sat near 27 stars with roughly 312 weekly npm downloads, and the README keeps an experimental badge, advising developers to pin exact versions and read the changelog before every upgrade until a stable 1.0 lands.
The SDK is a developer-experience play rather than a new capability. The same REST surface was previously reachable only by hand-rolled requests or through the community-typed Vercel @ai-sdk/xai package, which remains a separate project. xAI's mature Python SDK uses gRPC; this new TypeScript path is the first official REST-first option for Node applications, sitting alongside Grok Bot, the Grok Build coding agent and the Grok 4.7 API that prices at $2 per million input tokens and $6 per million output tokens.
The significance is less about features than about where xAI is spending effort. Official SDKs with typed clients, streaming event helpers and schema-validated structured output are table stakes for winning framework and platform integrations — exactly the layer where OpenAI and Anthropic have accumulated years of developer goodwill. If xAI wants Grok to appear by default inside agent frameworks and enterprise tooling, a stable, dependency-free official client is the entry ticket. The warning that interfaces may change before 1.0 is honest, but it also sets the deadline by which the company will need to stop moving them.
Comments (0)
Log in to join the discussion
Log InNo comments yet