local-ai-models
БесплатноБез исполняемых скриптовНе проверенWHEN building iOS features on on-device models with Foundation Models or MLX Swift: local LLM inference, chat, Vision Language Models (VLMs), text embeddings…
от mintuz★ 38 звёзд на GitHubОб этом скилле
iOS On-Device AI Models
On-device AI in iOS apps with Apple's Foundation Models framework and MLX Swift.
Core Principles
- Compatibility Gate - Foundation Models requires iOS 26, iPadOS 26, or macOS 26 or later, on an Apple Intelligence-capable device with Apple Intelligence enabled. Before you select a framework, compare this floor with the deployment target and with every device the feature must support. A runtime check reports one device's state; it cannot make the feature available below the OS or device floor. At runtime, check
SystemLanguageModel.default.availabilitybefore you create a session, and show a fallback UI for each unavailable state:.modelNotReady(for example, a download in progress),.appleIntelligenceNotEnabled(disabled in Settings), and.deviceNotEligible(hardware cannot run the model). - Single-Flight Streaming - Give one isolation boundary ownership of each conversation's session, transcript, and generation task. While
isRespondingis true, reject or queue the new send; never call the session, soGenerationError.concurrentRequestsnever occurs in normal use. Stop and teardown cancel the owned task and await it before a new send starts. CheckTask.checkCancellation()while consuming the stream. Commit a transcript turn only when the response completes (principle-separate-before-serializing-shared-state). - Session Persistence - Reuse
LanguageModelSessionacross completed turns; keep partial streaming text separate from committed history. - Memory Awareness - Use quantised models and monitor memory. iOS limits one app to a fraction of the device's total RAM, so reject any model whose weight files approach or exceed the total RAM of the lowest-memory required device: it cannot load. Pick the smallest model that meets quality on that device and measure peak memory there. Give one
@Observableowner the load state, the loaded model, and generation. For a multi-gigabyte download: ask for consent, default to Wi-Fi, make it resumable, and keep the feature in an explicit "not downloaded" state until the files are complete. - Async Everything - Load models asynchronously; never block the main thread.
- Device Proof - Before calling the design viable, exercise support boundaries and generation lifecycle in focused tests, then verify a Release build on the oldest or lowest-memory required physical device, including offline operation when the product promises on-device behaviour (
principle-prove-it-works). - Locale Support - Before you create a session, call
supportsLocale(_:)for each user locale. Treat an unsupported locale as an unavailable state; never work around it with a prompt instruction such as "answer in". For a supported locale, put the locale in the session instructions, not in each prompt. Test each locale branch on a physical device set to that locale. - Typed Tools and Outputs - For structured output, define a
@Generabletype and callrespond(to:generating:); never parse free text with regular expressions. For an app action the model needs, implement the Foundation ModelsToolprotocol with@Generablearguments and pass the tool when you create the session. The session invokes the tool; the view never calls the service on the model's behalf. A tool error surfaces from the session call asLanguageModelSession.ToolCallError: catch it and show the user a normal failure state, never a crash or an empty result.
Quick Reference
Framework Comparison
| Topic | Guide |
|---|---|
| Framework comparison and selection | framework-selection.md |
Foundation Models (Apple's Framework)
| Topic | Guide |
|---|---|
| Setup and configuration | foundation-models/setup.md |
| Chat patterns and conversations | foundation-models/chat-patterns.md |
MLX Swift (Advanced Features)
| Topic | Guide |
|---|---|
| Setup and configuration | mlx-swift/setup.md |
| Chat patterns with custom models | mlx-swift/chat-patterns.md |
| Vision Language Models (VLMs) | [mlx-swift/vision-patterns.md](references/mlx-swift/vis |
Установить local-ai-models в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл local-ai-models?
WHEN building iOS features on on-device models with Foundation Models or MLX Swift: local LLM inference, chat, Vision Language Models (VLMs), text embeddings, image generation, tool calling, multi-turn conversations, custom models, or structured generation; NOT for cloud-hosted model APIs, Core ML or coremltools model conversion, or Vision framework classifiers; returns framework selection, compatibility gates, session and streaming patterns, and device-proof verification plans.
Как установить скилл local-ai-models?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл local-ai-models запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic