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, evaluation, 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.
EvaluationScore shared state with typed Choice, Score, and Boolean questions.
RealtimeRun turn-based xAI or continuous OpenAI Live sessions 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. Realtime V4 includes a turn-based xAI adapter and a continuous OpenAI Live server-WebSocket adapter; browser WebRTC and other provider-specific realtime families remain explicit gaps. 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.