Open Source Radar
zaidmukaddam/

swift-ai-sdk

GitHubWebsite

Swift AI SDK for iOS/macOS provides generateText/streamText/generateObject, tool calling, swappable transports, and an Observable chat session for SwiftUI, with on-device and cloud support.

26stars
1forks
0issues
MITlicense
2026since
Star historydaily snapshots by VibeCrowd

Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (2 so far).

Reviewgenerated from repository data · Jul 18, 2026

What it is

The Swift AI SDK is a provider-agnostic AI toolkit for Swift, built on the Vercel AI SDK's design. It offers generateText, streamText, and generateObject, tool calling with an agentic loop, a swappable transport layer that speaks Vercel's UI message stream protocol, and an @Observable chat session for SwiftUI. It emphasizes Swift 6 strict concurrency and Sendable throughout.

How it works

Providers implement a single method protocol:

protocol LanguageModel: Sendable {
    func stream(_ request: LanguageModelRequest) async throws -> AsyncThrowingStream<StreamPart, Error>
}

generateText, streamText, generateObject, and the chat transports consume that stream. The toolkit supports multiple providers (OpenAI, Anthropic, FoundationModels, etc.) and enables swapping models with a uniform surface. A transport layer (e.g., HTTPChatTransport) speaks the UI message stream protocol exactly, enabling a shared backend route for web and iOS clients.

The library includes tools for tours, structured output, chat for SwiftUI, and multiple provider packs that map to provider-specific quirks and knobs. It also covers embeddings, multimodal messages, and route layers such as UIMessage, HTTPChatTransport, and ChatSession.

Getting started

Install:

.package(url: "https://github.com/zaidmukaddam/swift-ai-sdk.git", from: "0.2.0")

Then add "AI" to your target's dependencies. Requires Swift 6 / Xcode 16+. The Foundation Models provider activates automatically when built with the iOS 26 / macOS 26 SDK.

Test and run:

swift test      # 376 tests: loop, wire-format goldens, reducer, transports. No API keys needed.
swift run demo  # live smoke test; set ANTHROPIC_API_KEY, OPENAI_API_KEY, or OLLAMA_MODEL

Getting started (continued)

Usage examples in README show how to construct models, use generateText with tools, and leverage the streaming interface for step boundaries and tool results. It also documents embeddings and provider packs for OpenAI, Anthropic, xAI, Google Gemini, Ollama, and many others, along with route and transport details for wire compatibility.

Recent releases

Latest releases are:

  • 0.2.0 0.2.0 (2026-07-15): See the changelog for what shipped in this release.
  • 0.1.1 0.1.1 (2026-07-14): See the changelog for what shipped in this release.
  • 0.1.0 0.1.0 (2026-07-13): See the changelog for what shipped in this release.

Traction

26 stars, 1 fork, 0 open issues.

Behind the repo

The repository appears to be focused on providing a Swift-based AI SDK with multiple provider integrations and an on-device/offline capability via FoundationModelsModel, designed for Swift 6 concurrency and SwiftUI integration.

Caveats

License: MIT. Created 2026-07-13; last_push 2026-07-14. Open issues: 0. The README notes multiple prerequisites including Swift 6 / Xcode 16+, and an environment for provider keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.). The install snippet requires the exact from-version string, which is provided as "0.2.0" in the Install section.

SharePost on XLinkedIn
All trending reposRevenue-verified startups →