xai
Package
Section titled “Package”@ai-sdk/xai
Factories
Section titled “Factories”AIProviders.xAI
Capabilities
Section titled “Capabilities”- Language
- Image
- Transcription
- Speech
- Video
- Files
xAI mirrors upstream 4.0.54: XAI_API_KEY, custom base URL and headers, versioned user-agent suffix, callable/language Responses default, chat/responses/image/video/files aliases, no-argument speech/speechModel and transcription/transcriptionModel aliases, Responses provider options and hosted tools with blocked-domain filters and complete unsupported-sampling warnings, Grok 4.6 xhigh reasoning and priority service-tier metadata, streamed/generated Responses image-generation calls with prompt and failure results, image generation/editing, Imagine Video 1.5 generation/edit/extend/reference modes with 1080p, reference voices, resilient polling, and terminal moderation/missing-URL errors, /tts speech generation with voice/language/output_format, timestamps, pronunciation replacements, trace/usage metadata, and provider options, /stt multipart batch transcription with options and word segments, Files API provider references, response metadata, and xAI error schema. Responses Batch uploads requests, forwards callback URLs, paginates durable results, preserves full content/counts, and isolates provider errors or cancellations per item; current parity also preserves complete raw usage, web-search action data, encoded follow-up identifiers, dot-segment-safe IDs, and typed stream failures. The provider-neutral Realtime V4 contract and duplex session are implemented with xAI ephemeral-secret creation, expiry metadata, authenticated WebSocket configuration, session/audio/text/tool/custom event serialization and parsing, pre-open queuing, health replies, cancellation, and close metadata. OpenAI and Google realtime adapters, ProviderV4 type names, ESM-only packaging, Node 22 engines, and workflow serialization helpers remain deferred or JS-only concerns. The 4.0.54 pass adds complete Files V4 metadata/download/delete and cancellable streaming uploads with expiry validation, plus Batch tool content, input-file expiry/metadata, final-assistant finish data, and raw provider finish reasons.
Factory argument requirements are defined by the public Swift factory signatures. Use Public symbols when you need the exact initializer or factory declaration.
Return to the provider matrix.