# Natif > On-device AI SDK. Runs LLMs (and voice/image models) on the user's device with WebGPU or llama.cpp, picks the right model per device, validates structured output with zod, and falls back to the cloud only with consent. Apache-2.0. ## Docs - [What Natif is](https://benatif.com/llms-full.txt#overview): Natif is an SDK that runs AI models on the user's own device (browser via WebGPU, phones via llama.cpp). - [Install (web)](https://benatif.com/llms-full.txt#install-web): npm i natif zod - [Install (React Native / Expo)](https://benatif.com/llms-full.txt#install-react-native): npm i @natif/react-native zod llama.rn @dr.pogodin/react-native-fs @react-native-async-storage/async-storage react-native-device-info - [Install (Expo)](https://benatif.com/llms-full.txt#install-expo): npx expo install @natif/expo llama.rn expo-file-system expo-device @react-native-async-storage/async-storage zod - [Install (Swift / Kotlin, preview)](https://benatif.com/llms-full.txt#install-native): Swift (iOS 17+ / macOS 14+), Swift Package Manager, product "Natif": - [Your own knowledge (RAG, grounding, citations)](https://benatif.com/llms-full.txt#knowledge): Natif never stores your data. You give the client your knowledge and it adds the relevant passages to each chat turn: - [Classification (classify)](https://benatif.com/llms-full.txt#classify): const { label, meta } = await ai.classify({ text: "I was charged twice", labels: ["billing", "bug", "feature-request"] }); - [Download ahead of time (download)](https://benatif.com/llms-full.txt#preload): const r = await ai.download({ onProgress: (p) => setProgress(p.progress) }); - [Structured extraction (extract)](https://benatif.com/llms-full.txt#extract): import { createClient } from "natif"; // or "@natif/react-native" - [Chat (streaming, history)](https://benatif.com/llms-full.txt#chat): const r = await ai.chat({ - [Tasks](https://benatif.com/llms-full.txt#tasks): A task is the prompt and settings for one job, referenced by slug. - [Model catalog and selection](https://benatif.com/llms-full.txt#models): | id | tier | memory | capabilities | web | react-native | license | - [Memory budget](https://benatif.com/llms-full.txt#memory): Natif budgets on memory the app can USE, not installed RAM, so it never slows the user's device down. - [Cloud fallback and consent](https://benatif.com/llms-full.txt#fallback): When the device can't (no GPU, out of memory, too slow, invalid output after repair, timeout) the same extract call can run in the cloud wit - [Loading UX](https://benatif.com/llms-full.txt#loading-ux): The first run downloads the model (1–2.5 GB). Treat it like a game's loading screen: - [Errors](https://benatif.com/llms-full.txt#errors): DeviceUnavailableError (.reason: no_webgpu | insufficient_memory | insufficient_storage | benchmark_slow | known_slow_device | load_failed | - [Privacy](https://benatif.com/llms-full.txt#privacy): User input and results stay on the device. They only leave in a consented cloud fallback and are not stored by Natif. ## Tools - MCP server: `npx -y @natif/mcp` (tools: get_started, get_docs, list_models, recommend_model, design_task) - Full guide in one file: https://benatif.com/llms-full.txt