Skip to content

Introduction

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.

  • 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.

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.