{
  "@context": "https://schema.org",
  "@id": "https://aggr.aymericbeaumet.com/items/huggingface-co/2025-11-20-introducing-anylanguagemodel-one-api-for-local-and-remote/#webpage",
  "@type": [
    "WebPage",
    "ArchiveComponent"
  ],
  "articleBody": "LLMs have become essential tools for building software. But for Apple developers, integrating them remains unnecessarily painful.\n\nDevelopers building AI-powered apps typically take a hybrid approach, adopting some combination of:\n\n- Local models using Core ML or MLX for privacy and offline capability\n- Cloud providers like OpenAI or Anthropic for frontier capabilities\n- Apple's Foundation Models as a system-level fallback\n\nEach comes with different APIs, different requirements, different integration patterns. It's a lot, and it adds up quickly. When I interviewed developers about building AI-powered apps, friction with model integration came up immediately. One developer put it bluntly:\n\n> I thought I'd quickly use the demo for a test and maybe a quick and dirty build but instead wasted so much time. Drove me nuts.\n\nThe cost to experiment is high, which discourages developers from discovering that local, open-source models might actually work great for their use case.\n\nToday we're announcing [AnyLanguageModel](https://github.com/mattt/AnyLanguageModel), a Swift package that provides a drop-in replacement for Apple's Foundation Models framework with support for multiple model providers. Our goal is to reduce the friction of working with LLMs on Apple platforms and make it easier to adopt open-source models that run locally.\n\n## The Solution\n\nThe core idea is simple: Swap your `import` statement, keep the same API.\n\n```diff\n- import FoundationModels\n+ import AnyLanguageModel\n```\n\nHere's what that looks like in practice. Start with Apple's built-in model:\n\n```swift\nlet model = SystemLanguageModel.default\nlet session = LanguageModelSession(model: model)\n\nlet response = try await session.respond(to: \"Explain quantum computing in one sentence\")\nprint(response.content)\n```\n\nNow try an open-source model running locally via [MLX](https://huggingface.co/docs/hub/en/mlx):\n\n```swift\nlet model = MLXLanguageModel(modelId: \"mlx-community/Qwen3-4B-4bit\")\nlet session = LanguageModelSession(model: model)\n\nlet response = try await session.respond(to: \"Explain quantum computing in one sentence\")\nprint(response.content)\n```\n\nAnyLanguageModel supports a range of providers:\n\n- **Apple Foundation Models**: Native integration with Apple's system model (macOS 26+ / iOS 26+)\n- **Core ML**: Run converted models with Neural Engine acceleration\n- **MLX**: Run quantized models efficiently on Apple Silicon\n- **llama.cpp**: Load GGUF models via the llama.cpp backend\n- **Ollama**: Connect to locally-served models via Ollama's HTTP API\n- **OpenAI, Anthropic, Google Gemini**: Cloud providers for comparison and fallback\n- **Hugging Face Inference Providers**: Hundreds of cloud models powered by world-class [inference providers](https://huggingface.co/docs/inference-providers/en/index).\n\nThe focus is on local models that you can download from the [Hugging Face Hub](https://huggingface.co/docs/hub/). Cloud providers are included to lower the barrier to getting started and to provide a migration path. Make it work, then make it right.\n\n## Why Foundation Models as the Base API\n\nWhen designing AnyLanguageModel, we faced a choice: create a new abstraction that tries to capture everything, or build on an existing API. We chose the latter, using [Apple's Foundation Models framework](https://developer.apple.com/documentation/FoundationModels) as the template.\n\nThis might seem counterintuitive. Why tie ourselves to Apple's choices? A few reasons:\n\n1. Foundation Models is genuinely well-designed. It leverages Swift features like macros for an ergonomic developer experience, and its abstractions around sessions, tools, and generation map well to how LLMs actually work.\n\n2. It's intentionally limited. Foundation Models represents something like a lowest common denominator for language model capabilities. Rather than seeing this as a weakness, we treat it as a stable foundation (*hyuk hyuk*). Every Swift developer targeting Apple platforms will encounter this API, so building on it directly means less conceptual overhead.\n\n3. It keeps us grounded. Each additional layer of abstraction takes you further from the problem you're actually solving. Abstractions are powerful, but stack too many and they become a problem in themselves.\n\nThe result is that switching between providers requires minimal code changes, and the core abstractions remain clean and predictable.\n\n## Package Traits: Include Only What You Need\n\nOne challenge with multi-backend libraries is dependency bloat. If you only want to run MLX models, you shouldn't have to pull in llama.cpp and all *its* dependencies.\n\nAnyLanguageModel uses Swift 6.1 package traits to solve this. You opt in to only the backends you need:\n\n```swift\ndependencies: [\n    .package(\n        url: \"https://github.com/mattt/AnyLanguageModel.git\",\n        from: \"0.4.0\",\n        traits: [\"MLX\"]  // Pull in MLX dependencies only\n    )\n]\n```\n\nAvailable traits include `CoreML`, `MLX`, and `Llama` (for llama.cpp / [llama.swift](https://github.com/mattt/llama.swift)). By default, no heavy dependencies are included. You get the base API plus cloud providers, which only require standard `URLSession` networking.\n\nFor Xcode projects (which don't yet support trait declarations directly), you can create a small internal Swift package that depends on AnyLanguageModel with the traits you need, then add that package as a local dependency. The [README](https://github.com/mattt/AnyLanguageModel#using-traits-in-xcode-projects) has detailed instructions.\n\n## Image Support (and API Design Trade-offs)\n\n[Vision-language models](https://huggingface.co/blog/vlms-2025) are incredibly capable and widely used. They can describe images, extract text from screenshots, analyze charts, and answer questions about visual content. Unfortunately, Apple's Foundation Models framework doesn't currently support sending images with prompts.\n\nBuilding on an existing API means accepting its constraints. Apple will likely add image support in a future release (iOS 27, perhaps?), but vision-language models are too useful to wait for. So we've extended beyond what Foundation Models offers today.\n\nHere's an example sending an image to Claude:\n\n```swift\nlet model = AnthropicLanguageModel(\n    apiKey: ProcessInfo.processInfo.environment[\"ANTHROPIC_API_KEY\"]!,\n    model: \"claude-sonnet-4-5-20250929\"\n)\n\nlet session = LanguageModelSession(model: model)\nlet response = try await session.respond(\n    to: \"What's in this image?\",\n    image: .init(url: URL(fileURLWithPath: \"/path/to/image.png\"))\n)\n```\n\nWe're taking a calculated risk here; we might design something that conflicts with Apple's eventual implementation. But that's what deprecation warnings are for. Sometimes you have to write the API for the framework that doesn't exist yet.\n\n## Try It Out: chat-ui-swift\n\n[![Screenshot of chat-ui-swift app](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/any-swift-llm/chat-ui-swift.png)](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/any-swift-llm/chat-ui-swift.png)\n\nTo see AnyLanguageModel in action, check out [chat-ui-swift](https://github.com/mattt/chat-ui-swift), a SwiftUI chat application that demonstrates the library's capabilities.\n\nThe app includes:\n\n- Apple Intelligence integration via Foundation Models (macOS 26+)\n- Hugging Face OAuth authentication for accessing gated models\n- Streaming responses\n- Chat persistence\n\nIt's meant as a starting point: Fork it, extend it, swap in different models. See how the pieces fit together and adapt it to your needs.\n\n## What's Next\n\nAnyLanguageModel is currently pre-1.0. The core API is stable, but we're actively working on bringing the full feature set of Foundation Models to all adapters, namely:\n\n- **Tool calling** across all providers\n- **MCP integration** for tools and elicitations\n- **Guided generation** for structured outputs\n- Performance optimizations for local inference\n\nThis library is the first step toward something larger. A unified inference API provides the scaffolding needed to build seamless agentic workflows on Apple platforms — applications where models can use tools, access system resources, and accomplish complex tasks. More on that soon. 🤫\n\n## Get Involved\n\nWe'd love your help making this better:\n\n- **Try it out** — Build something, kick the tires\n- **Share your experiences** — What works? What's frustrating? We want to hear about the challenges you face integrating AI into your apps\n- **Open issues** — Feature requests, bug reports, questions\n- **Contribute** — PRs are welcome\n\n## Links\n\n- [AnyLanguageModel on GitHub](https://github.com/mattt/AnyLanguageModel)\n- [chat-ui-swift on GitHub](https://github.com/mattt/chat-ui-swift)\n\nWe're excited to see what you build 🦾\n",
  "authors": [],
  "captured_at": "2026-10-04T12:50:30.804479567+00:00",
  "category": "ai",
  "content_html": "<p>LLMs have become essential tools for building software. But for Apple developers, integrating them remains unnecessarily painful.</p>\n<p>Developers building AI-powered apps typically take a hybrid approach, adopting some combination of:</p>\n<ul>\n<li>Local models using Core ML or MLX for privacy and offline capability</li>\n<li>Cloud providers like OpenAI or Anthropic for frontier capabilities</li>\n<li>Apple's Foundation Models as a system-level fallback</li>\n</ul>\n<p>Each comes with different APIs, different requirements, different integration patterns. It's a lot, and it adds up quickly. When I interviewed developers about building AI-powered apps, friction with model integration came up immediately. One developer put it bluntly:</p>\n<blockquote>\n<p>I thought I'd quickly use the demo for a test and maybe a quick and dirty build but instead wasted so much time. Drove me nuts.</p>\n</blockquote>\n<p>The cost to experiment is high, which discourages developers from discovering that local, open-source models might actually work great for their use case.</p>\n<p>Today we're announcing <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/mattt/AnyLanguageModel\">AnyLanguageModel</a>, a Swift package that provides a drop-in replacement for Apple's Foundation Models framework with support for multiple model providers. Our goal is to reduce the friction of working with LLMs on Apple platforms and make it easier to adopt open-source models that run locally.</p>\n<h2>The Solution</h2>\n<p>The core idea is simple: Swap your <code>import</code> statement, keep the same API.</p>\n<pre><code class=\"language-diff\"><span class=\"code-snippet\" data-language=\"Diff\"><span class=\"syntax-source syntax-diff\"><span class=\"syntax-markup syntax-deleted syntax-diff\"><span class=\"syntax-punctuation syntax-definition syntax-deleted syntax-diff\">-</span> import FoundationModels\n</span><span class=\"syntax-markup syntax-inserted syntax-diff\"><span class=\"syntax-punctuation syntax-definition syntax-inserted syntax-diff\">+</span> import AnyLanguageModel\n</span></span></span></code></pre>\n<p>Here's what that looks like in practice. Start with Apple's built-in model:</p>\n<pre><code class=\"language-swift\"><span class=\"code-snippet\" data-language=\"Swift\">let model = SystemLanguageModel.default\nlet session = LanguageModelSession(model: model)\n\nlet response = try await session.respond(to: &quot;Explain quantum computing in one sentence&quot;)\nprint(response.content)\n</span></code></pre>\n<p>Now try an open-source model running locally via <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/docs/hub/en/mlx\">MLX</a>:</p>\n<pre><code class=\"language-swift\"><span class=\"code-snippet\" data-language=\"Swift\">let model = MLXLanguageModel(modelId: &quot;mlx-community/Qwen3-4B-4bit&quot;)\nlet session = LanguageModelSession(model: model)\n\nlet response = try await session.respond(to: &quot;Explain quantum computing in one sentence&quot;)\nprint(response.content)\n</span></code></pre>\n<p>AnyLanguageModel supports a range of providers:</p>\n<ul>\n<li><strong>Apple Foundation Models</strong>: Native integration with Apple's system model (macOS 26+ / iOS 26+)</li>\n<li><strong>Core ML</strong>: Run converted models with Neural Engine acceleration</li>\n<li><strong>MLX</strong>: Run quantized models efficiently on Apple Silicon</li>\n<li><strong>llama.cpp</strong>: Load GGUF models via the llama.cpp backend</li>\n<li><strong>Ollama</strong>: Connect to locally-served models via Ollama's HTTP API</li>\n<li><strong>OpenAI, Anthropic, Google Gemini</strong>: Cloud providers for comparison and fallback</li>\n<li><strong>Hugging Face Inference Providers</strong>: Hundreds of cloud models powered by world-class <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/docs/inference-providers/en/index\">inference providers</a>.</li>\n</ul>\n<p>The focus is on local models that you can download from the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/docs/hub/\">Hugging Face Hub</a>. Cloud providers are included to lower the barrier to getting started and to provide a migration path. Make it work, then make it right.</p>\n<h2>Why Foundation Models as the Base API</h2>\n<p>When designing AnyLanguageModel, we faced a choice: create a new abstraction that tries to capture everything, or build on an existing API. We chose the latter, using <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://developer.apple.com/documentation/FoundationModels\">Apple's Foundation Models framework</a> as the template.</p>\n<p>This might seem counterintuitive. Why tie ourselves to Apple's choices? A few reasons:</p>\n<ol>\n<li>\n<p>Foundation Models is genuinely well-designed. It leverages Swift features like macros for an ergonomic developer experience, and its abstractions around sessions, tools, and generation map well to how LLMs actually work.</p>\n</li>\n<li>\n<p>It's intentionally limited. Foundation Models represents something like a lowest common denominator for language model capabilities. Rather than seeing this as a weakness, we treat it as a stable foundation (<em>hyuk hyuk</em>). Every Swift developer targeting Apple platforms will encounter this API, so building on it directly means less conceptual overhead.</p>\n</li>\n<li>\n<p>It keeps us grounded. Each additional layer of abstraction takes you further from the problem you're actually solving. Abstractions are powerful, but stack too many and they become a problem in themselves.</p>\n</li>\n</ol>\n<p>The result is that switching between providers requires minimal code changes, and the core abstractions remain clean and predictable.</p>\n<h2>Package Traits: Include Only What You Need</h2>\n<p>One challenge with multi-backend libraries is dependency bloat. If you only want to run MLX models, you shouldn't have to pull in llama.cpp and all <em>its</em> dependencies.</p>\n<p>AnyLanguageModel uses Swift 6.1 package traits to solve this. You opt in to only the backends you need:</p>\n<pre><code class=\"language-swift\"><span class=\"code-snippet\" data-language=\"Swift\">dependencies: [\n    .package(\n        url: &quot;https://github.com/mattt/AnyLanguageModel.git&quot;,\n        from: &quot;0.4.0&quot;,\n        traits: [&quot;MLX&quot;]  // Pull in MLX dependencies only\n    )\n]\n</span></code></pre>\n<p>Available traits include <code>CoreML</code>, <code>MLX</code>, and <code>Llama</code> (for llama.cpp / <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/mattt/llama.swift\">llama.swift</a>). By default, no heavy dependencies are included. You get the base API plus cloud providers, which only require standard <code>URLSession</code> networking.</p>\n<p>For Xcode projects (which don't yet support trait declarations directly), you can create a small internal Swift package that depends on AnyLanguageModel with the traits you need, then add that package as a local dependency. The <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/mattt/AnyLanguageModel#using-traits-in-xcode-projects\">README</a> has detailed instructions.</p>\n<h2>Image Support (and API Design Trade-offs)</h2>\n<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/blog/vlms-2025\">Vision-language models</a> are incredibly capable and widely used. They can describe images, extract text from screenshots, analyze charts, and answer questions about visual content. Unfortunately, Apple's Foundation Models framework doesn't currently support sending images with prompts.</p>\n<p>Building on an existing API means accepting its constraints. Apple will likely add image support in a future release (iOS 27, perhaps?), but vision-language models are too useful to wait for. So we've extended beyond what Foundation Models offers today.</p>\n<p>Here's an example sending an image to Claude:</p>\n<pre><code class=\"language-swift\"><span class=\"code-snippet\" data-language=\"Swift\">let model = AnthropicLanguageModel(\n    apiKey: ProcessInfo.processInfo.environment[&quot;ANTHROPIC_API_KEY&quot;]!,\n    model: &quot;claude-sonnet-4-5-20250929&quot;\n)\n\nlet session = LanguageModelSession(model: model)\nlet response = try await session.respond(\n    to: &quot;What&#39;s in this image?&quot;,\n    image: .init(url: URL(fileURLWithPath: &quot;/path/to/image.png&quot;))\n)\n</span></code></pre>\n<p>We're taking a calculated risk here; we might design something that conflicts with Apple's eventual implementation. But that's what deprecation warnings are for. Sometimes you have to write the API for the framework that doesn't exist yet.</p>\n<h2>Try It Out: chat-ui-swift</h2>\n<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/any-swift-llm/chat-ui-swift.png\"><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/any-swift-llm/chat-ui-swift.png\" alt=\"Screenshot of chat-ui-swift app\" loading=\"eager\" decoding=\"async\" fetchpriority=\"high\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></a></p>\n<p>To see AnyLanguageModel in action, check out <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/mattt/chat-ui-swift\">chat-ui-swift</a>, a SwiftUI chat application that demonstrates the library's capabilities.</p>\n<p>The app includes:</p>\n<ul>\n<li>Apple Intelligence integration via Foundation Models (macOS 26+)</li>\n<li>Hugging Face OAuth authentication for accessing gated models</li>\n<li>Streaming responses</li>\n<li>Chat persistence</li>\n</ul>\n<p>It's meant as a starting point: Fork it, extend it, swap in different models. See how the pieces fit together and adapt it to your needs.</p>\n<h2>What's Next</h2>\n<p>AnyLanguageModel is currently pre-1.0. The core API is stable, but we're actively working on bringing the full feature set of Foundation Models to all adapters, namely:</p>\n<ul>\n<li><strong>Tool calling</strong> across all providers</li>\n<li><strong>MCP integration</strong> for tools and elicitations</li>\n<li><strong>Guided generation</strong> for structured outputs</li>\n<li>Performance optimizations for local inference</li>\n</ul>\n<p>This library is the first step toward something larger. A unified inference API provides the scaffolding needed to build seamless agentic workflows on Apple platforms — applications where models can use tools, access system resources, and accomplish complex tasks. More on that soon. 🤫</p>\n<h2>Get Involved</h2>\n<p>We'd love your help making this better:</p>\n<ul>\n<li><strong>Try it out</strong> — Build something, kick the tires</li>\n<li><strong>Share your experiences</strong> — What works? What's frustrating? We want to hear about the challenges you face integrating AI into your apps</li>\n<li><strong>Open issues</strong> — Feature requests, bug reports, questions</li>\n<li><strong>Contribute</strong> — PRs are welcome</li>\n</ul>\n<h2>Links</h2>\n<ul>\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/mattt/AnyLanguageModel\">AnyLanguageModel on GitHub</a></li>\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/mattt/chat-ui-swift\">chat-ui-swift on GitHub</a></li>\n</ul>\n<p>We're excited to see what you build 🦾</p>\n",
  "content_markdown": "LLMs have become essential tools for building software. But for Apple developers, integrating them remains unnecessarily painful.\n\nDevelopers building AI-powered apps typically take a hybrid approach, adopting some combination of:\n\n- Local models using Core ML or MLX for privacy and offline capability\n- Cloud providers like OpenAI or Anthropic for frontier capabilities\n- Apple's Foundation Models as a system-level fallback\n\nEach comes with different APIs, different requirements, different integration patterns. It's a lot, and it adds up quickly. When I interviewed developers about building AI-powered apps, friction with model integration came up immediately. One developer put it bluntly:\n\n> I thought I'd quickly use the demo for a test and maybe a quick and dirty build but instead wasted so much time. Drove me nuts.\n\nThe cost to experiment is high, which discourages developers from discovering that local, open-source models might actually work great for their use case.\n\nToday we're announcing [AnyLanguageModel](https://github.com/mattt/AnyLanguageModel), a Swift package that provides a drop-in replacement for Apple's Foundation Models framework with support for multiple model providers. Our goal is to reduce the friction of working with LLMs on Apple platforms and make it easier to adopt open-source models that run locally.\n\n## The Solution\n\nThe core idea is simple: Swap your `import` statement, keep the same API.\n\n```diff\n- import FoundationModels\n+ import AnyLanguageModel\n```\n\nHere's what that looks like in practice. Start with Apple's built-in model:\n\n```swift\nlet model = SystemLanguageModel.default\nlet session = LanguageModelSession(model: model)\n\nlet response = try await session.respond(to: \"Explain quantum computing in one sentence\")\nprint(response.content)\n```\n\nNow try an open-source model running locally via [MLX](https://huggingface.co/docs/hub/en/mlx):\n\n```swift\nlet model = MLXLanguageModel(modelId: \"mlx-community/Qwen3-4B-4bit\")\nlet session = LanguageModelSession(model: model)\n\nlet response = try await session.respond(to: \"Explain quantum computing in one sentence\")\nprint(response.content)\n```\n\nAnyLanguageModel supports a range of providers:\n\n- **Apple Foundation Models**: Native integration with Apple's system model (macOS 26+ / iOS 26+)\n- **Core ML**: Run converted models with Neural Engine acceleration\n- **MLX**: Run quantized models efficiently on Apple Silicon\n- **llama.cpp**: Load GGUF models via the llama.cpp backend\n- **Ollama**: Connect to locally-served models via Ollama's HTTP API\n- **OpenAI, Anthropic, Google Gemini**: Cloud providers for comparison and fallback\n- **Hugging Face Inference Providers**: Hundreds of cloud models powered by world-class [inference providers](https://huggingface.co/docs/inference-providers/en/index).\n\nThe focus is on local models that you can download from the [Hugging Face Hub](https://huggingface.co/docs/hub/). Cloud providers are included to lower the barrier to getting started and to provide a migration path. Make it work, then make it right.\n\n## Why Foundation Models as the Base API\n\nWhen designing AnyLanguageModel, we faced a choice: create a new abstraction that tries to capture everything, or build on an existing API. We chose the latter, using [Apple's Foundation Models framework](https://developer.apple.com/documentation/FoundationModels) as the template.\n\nThis might seem counterintuitive. Why tie ourselves to Apple's choices? A few reasons:\n\n1. Foundation Models is genuinely well-designed. It leverages Swift features like macros for an ergonomic developer experience, and its abstractions around sessions, tools, and generation map well to how LLMs actually work.\n\n2. It's intentionally limited. Foundation Models represents something like a lowest common denominator for language model capabilities. Rather than seeing this as a weakness, we treat it as a stable foundation (*hyuk hyuk*). Every Swift developer targeting Apple platforms will encounter this API, so building on it directly means less conceptual overhead.\n\n3. It keeps us grounded. Each additional layer of abstraction takes you further from the problem you're actually solving. Abstractions are powerful, but stack too many and they become a problem in themselves.\n\nThe result is that switching between providers requires minimal code changes, and the core abstractions remain clean and predictable.\n\n## Package Traits: Include Only What You Need\n\nOne challenge with multi-backend libraries is dependency bloat. If you only want to run MLX models, you shouldn't have to pull in llama.cpp and all *its* dependencies.\n\nAnyLanguageModel uses Swift 6.1 package traits to solve this. You opt in to only the backends you need:\n\n```swift\ndependencies: [\n    .package(\n        url: \"https://github.com/mattt/AnyLanguageModel.git\",\n        from: \"0.4.0\",\n        traits: [\"MLX\"]  // Pull in MLX dependencies only\n    )\n]\n```\n\nAvailable traits include `CoreML`, `MLX`, and `Llama` (for llama.cpp / [llama.swift](https://github.com/mattt/llama.swift)). By default, no heavy dependencies are included. You get the base API plus cloud providers, which only require standard `URLSession` networking.\n\nFor Xcode projects (which don't yet support trait declarations directly), you can create a small internal Swift package that depends on AnyLanguageModel with the traits you need, then add that package as a local dependency. The [README](https://github.com/mattt/AnyLanguageModel#using-traits-in-xcode-projects) has detailed instructions.\n\n## Image Support (and API Design Trade-offs)\n\n[Vision-language models](https://huggingface.co/blog/vlms-2025) are incredibly capable and widely used. They can describe images, extract text from screenshots, analyze charts, and answer questions about visual content. Unfortunately, Apple's Foundation Models framework doesn't currently support sending images with prompts.\n\nBuilding on an existing API means accepting its constraints. Apple will likely add image support in a future release (iOS 27, perhaps?), but vision-language models are too useful to wait for. So we've extended beyond what Foundation Models offers today.\n\nHere's an example sending an image to Claude:\n\n```swift\nlet model = AnthropicLanguageModel(\n    apiKey: ProcessInfo.processInfo.environment[\"ANTHROPIC_API_KEY\"]!,\n    model: \"claude-sonnet-4-5-20250929\"\n)\n\nlet session = LanguageModelSession(model: model)\nlet response = try await session.respond(\n    to: \"What's in this image?\",\n    image: .init(url: URL(fileURLWithPath: \"/path/to/image.png\"))\n)\n```\n\nWe're taking a calculated risk here; we might design something that conflicts with Apple's eventual implementation. But that's what deprecation warnings are for. Sometimes you have to write the API for the framework that doesn't exist yet.\n\n## Try It Out: chat-ui-swift\n\n[![Screenshot of chat-ui-swift app](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/any-swift-llm/chat-ui-swift.png)](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/any-swift-llm/chat-ui-swift.png)\n\nTo see AnyLanguageModel in action, check out [chat-ui-swift](https://github.com/mattt/chat-ui-swift), a SwiftUI chat application that demonstrates the library's capabilities.\n\nThe app includes:\n\n- Apple Intelligence integration via Foundation Models (macOS 26+)\n- Hugging Face OAuth authentication for accessing gated models\n- Streaming responses\n- Chat persistence\n\nIt's meant as a starting point: Fork it, extend it, swap in different models. See how the pieces fit together and adapt it to your needs.\n\n## What's Next\n\nAnyLanguageModel is currently pre-1.0. The core API is stable, but we're actively working on bringing the full feature set of Foundation Models to all adapters, namely:\n\n- **Tool calling** across all providers\n- **MCP integration** for tools and elicitations\n- **Guided generation** for structured outputs\n- Performance optimizations for local inference\n\nThis library is the first step toward something larger. A unified inference API provides the scaffolding needed to build seamless agentic workflows on Apple platforms — applications where models can use tools, access system resources, and accomplish complex tasks. More on that soon. 🤫\n\n## Get Involved\n\nWe'd love your help making this better:\n\n- **Try it out** — Build something, kick the tires\n- **Share your experiences** — What works? What's frustrating? We want to hear about the challenges you face integrating AI into your apps\n- **Open issues** — Feature requests, bug reports, questions\n- **Contribute** — PRs are welcome\n\n## Links\n\n- [AnyLanguageModel on GitHub](https://github.com/mattt/AnyLanguageModel)\n- [chat-ui-swift on GitHub](https://github.com/mattt/chat-ui-swift)\n\nWe're excited to see what you build 🦾\n",
  "dateCreated": "2026-10-04T12:50:30.804479567+00:00",
  "date_created": "2025-11-20T00:00:00+00:00",
  "date_modified": "2025-11-20T00:00:00+00:00",
  "date_published": "2025-11-20T00:00:00+00:00",
  "description": "LLMs have become essential tools for building software. But for Apple developers, integrating them remains unnecessarily painful. Developers building AI-powered apps typically take a hybrid approach, adopting some combination of: Local…",
  "external_url": "https://huggingface.co/blog/anylanguagemodel",
  "git": {
    "commit": "ebb0941c5c06a2ab2377342d607535262a3e969e",
    "path": "items/huggingface-co/2025/11/2025-11-20-introducing-anylanguagemodel-one-api-for-local-and-remote.md",
    "permalink": "https://github.com/aymericbeaumet/aggr-instance/blob/ebb0941c5c06a2ab2377342d607535262a3e969e/items/huggingface-co/2025/11/2025-11-20-introducing-anylanguagemodel-one-api-for-local-and-remote.md"
  },
  "id": "urn:aggr:item:b53931fd0e7ee76ba88145595c1c17c2a13384db",
  "isBasedOn": {
    "@id": "https://huggingface.co/blog/anylanguagemodel"
  },
  "mainEntity": {
    "@id": "https://huggingface.co/blog/anylanguagemodel",
    "@type": "CreativeWork",
    "archivedAt": {
      "@id": "https://aggr.aymericbeaumet.com/items/huggingface-co/2025-11-20-introducing-anylanguagemodel-one-api-for-local-and-remote/#webpage"
    },
    "dateModified": "2025-11-20T00:00:00+00:00",
    "datePublished": "2025-11-20T00:00:00+00:00",
    "headline": "Introducing AnyLanguageModel: One API for Local and Remote LLMs on Apple Platforms",
    "timeRequired": "PT6M",
    "url": "https://huggingface.co/blog/anylanguagemodel",
    "wordCount": 1132
  },
  "name": "Archived snapshot: Introducing AnyLanguageModel: One API for Local and Remote LLMs on Apple Platforms",
  "preview": null,
  "reading_minutes": 6,
  "replicated_at": null,
  "source": "huggingface-co",
  "source_name": "Hugging Face - Blog",
  "summary": null,
  "tags": [],
  "temporalCoverage": "2026-10-04T12:50:30.804479567+00:00",
  "title": "Introducing AnyLanguageModel: One API for Local and Remote LLMs on Apple Platforms",
  "url": "https://aggr.aymericbeaumet.com/items/huggingface-co/2025-11-20-introducing-anylanguagemodel-one-api-for-local-and-remote/",
  "word_count": 1132
}