Introduction
SwiftAISDK
Section titled “SwiftAISDK”SwiftAISDK is a SwiftPM port of the provider-facing parts of Vercel AI SDK. It gives Swift apps one facade for text, durable batches, structured output, embeddings, media, streaming audio, realtime sessions, reranking, files, skills, middleware, MCP tools, and typed tool execution.
Start with a provider, pick a model, and call Swift-native model methods such as generateText, streamText, and generateObject. Keep provider-specific behavior in provider settings and providerOptions; keep application behavior in Swift types, tools, and async sequences.
Choose Your Path
Section titled “Choose Your Path”Generate your first response with OpenAI or any registry-backed model.
ToolsLet a model call typed Swift functions and continue the conversation.
FilesUpload, inspect, stream, and delete provider-managed files.
ProvidersSee which upstream @ai-sdk/* providers and model families are covered.
Discover remote tools and pass them into text generation.
RealtimeRun an xAI audio, text, and tool session through the provider-neutral Realtime V4 lifecycle.
How the Docs Are Organized
Section titled “How the Docs Are Organized”- Getting Started explains installation, credentials, and the first request.
- Core covers common app workflows: text, streaming, structured output, tools, and middleware.
- Cookbook contains task-oriented recipes you can adapt into app code.
- Providers is generated from the package capability matrix.
- Reference is generated from Swift symbol graphs and is best used after a guide points you to a type.
Current Scope
Section titled “Current Scope”SwiftAISDK tracks the provider-facing AI SDK surface. xAI is the first full Realtime V4 adapter; full non-xAI realtime sessions remain an explicit gap. Web framework hooks and React Server Components are intentionally not the first thing you should look for here; SwiftUI-facing abstractions are expected to be Swift-native.