The MLC provider enables you to run large language models directly on-device in React Native applications. This includes popular models like Llama, Phi-3, Mistral, and Qwen that run entirely on-device for privacy, performance, and offline capabilities.
Install the MLC provider:
While you can use the MLC provider standalone, we recommend using it with the Vercel AI SDK for a much better developer experience. The AI SDK provides unified APIs, streaming support, and advanced features. To use with the AI SDK, you'll need v5 and required polyfills:
You must run your application on a physical iOS device or using Mac (Designed for iPad) destination in Xcode, as prebuilt model binaries will not work in the iOS Simulator.
For Expo projects, add the MLC config plugin to automatically configure the increased memory limit capability:
The plugin automatically adds the com.apple.developer.kernel.increased-memory-limit entitlement to your iOS app, which is required to run large language models that exceed the default memory limits.
After adding the plugin, run:
If you're not using Expo or prefer manual configuration, add the "Increased Memory Limit" capability in Xcode:
Import the MLC provider and use it with the AI SDK: