Skip to content

john-rocky/coreai-kit

Repository files navigation

CoreAIKit

Build LLM and computer-vision apps on Apple's Core AI framework (macOS / iOS 27 beta) in a few lines of Swift.

Community package — not affiliated with Apple. Requires macOS 27 beta / iOS 27 beta (real device; the CoreAI framework is not in the iOS Simulator SDK).

import CoreAIKit

let chat = try await ChatSession(model: .qwen3_0_6B)
for try await event in chat.streamResponse(to: "Hello!") {
    if case .response(let delta) = event { print(delta, terminator: "") }
}

Models download automatically from the Hugging Face Hub on first use — no Python required.

What's inside

Product What it gives you
CoreAIKit ModelStore (download/cache), ModelCatalog (live model list), ChatSession (streaming chat + live stats + guided generation), KitLanguageModel (FoundationModels provider with tool calling + guided generation)
CoreAIKitVision GraphModel (run any .aimodel), ImageTextEncoder (CLIP), DepthEstimator, CameraFeed, image preprocessing
CoreAIKitEmbeddings TextEmbedder (EmbeddingGemma, 768-d normalized) for on-device search and RAG
CoreAIKitUI SwiftUI components: ModelPickerBar, ChatTranscriptView, StatsBar

Examples

  • Examples/ChatDemo — multiplatform chat app (~150 lines)
  • Examples/PhotoSearch — semantic photo search with CLIP (iOS)
  • Examples/DepthCamera — live camera depth with Depth Anything 3 (iOS)
  • Examples/DetectCamera — real-time object detection with RF-DETR, no NMS (iOS; nano 33–39 FPS end-to-end on iPhone 17 Pro via the zero-copy capture pipeline)
  • Examples/FMToolDemo — local tool calling behind LanguageModelSession (swift run)
  • Examples/GuidedDemo — guided generation: schema-valid JSON by construction (swift run)
  • Examples/DocChat — on-device RAG over your notes: embeddings + retrieval tool + local LLM (swift run)
  • Examples/SpotlightChat — local RAG with Apple's SpotlightSearchTool (WWDC26) behind your own model (swift run)

See docs/GETTING_STARTED.md.

Requirements

  • macOS 27 beta / iOS 27 beta, Xcode 27 beta
  • Models run fully on device

License

BSD-3-Clause. See LICENSE and NOTICE.txt (portions adapted from apple/coreai-models and john-rocky/coreai-model-zoo).

About

Run LLMs, VLMs, ASR, TTS, diarization and more fully on-device with Apple's Core AI framework (iOS/macOS 27) — one line of Swift per model, 45+ verified models from the Core AI model zoo

Topics

Resources

License

Stars

15 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages