Web · React Native · Expo
Run LLMs, voice and image models on your users' own hardware. benatif picks the right model for each device, keeps user data on it, and only falls back to the cloud when the device can't, with consent.
$ npm i natif zod ·
import { createClient } from "natif";
import { z } from "zod";
const ai = createClient({
apiKey: "pk_live_…",
capabilities: ["text"],
consent: { cloudFallback: false },
});
const scores = await ai.extract({
task: "daily-checkin",
schema: z.object({
mood: z.number().int().min(1).max(10),
stress: z.number().int().min(1).max(10),
}),
input: { text },
});
// → { mood: 3, stress: 8 } ran on device · 2.0 s · $0
How it works
Declare what your app needs. benatif measures the device and decides, call by call, where each model runs.
WebGPU, f16 support, memory budget, free storage. Memory is budgeted on what's available, so it never slows the user's computer down.
Picks the best model that fits from a curated catalog (Apache/MIT licenses only), using anonymous benchmarks from devices like this one.
Downloads once, caches, runs each engine in its own Web Worker. Output is constrained to your JSON Schema and validated with zod.
Too slow, no GPU, out of memory? The same call goes to the cloud, only with user consent, and never for projects marked device-only.
Capabilities
Extraction, classification, scoring with schema-constrained decoding. Qwen3-4B, Gemma 4 E2B.
availableNatural text-to-speech in English, Spanish, Portuguese, French and Korean.
previewText-to-image on the GPU with Janus-Pro 1B. 384×384 in ~7 s on a laptop.
previewCompose vertical videos with captions, voice and music. 1080×1920 rendered faster than real time with WebCodecs.
previewWhisper on device: record or upload, the audio never leaves the browser.
previewImage understanding with small multimodal models.
phase 4Ground answers in your docs or your own vector DB, with citations. benatif never stores the data.
availableBenchmarks
Apple M2 Max, Chrome 157, WebGPU. Model already cached. Structured check-in extraction, 5 runs, median.
| Model | License | Time to first token | Full answer | Speed | Quality |
|---|---|---|---|---|---|
| Qwen3-4B | Apache-2.0 | 0.8 s | 2.0 s | ~40 tok/s | ●●● |
| Gemma 4 E2B | Apache-2.0 | 1.0 s | 2.7 s | ~20 tok/s | ●●● |
| Qwen3-1.7B | Apache-2.0 | 0.3 s | ~1 s | fast | ●●○ |
| Qwen2.5-1.5B | Apache-2.0 | 0.3 s | 1.1 s | fast | ●○○ |
First run downloads and compiles the model (47–130 s); after that it loads from cache in 2–6 s. Run your own numbers in the API playground.
Build it with your AI
Copy a ready prompt into Claude, Cursor or ChatGPT, or connect the benatif MCP server so your assistant can read the docs, pick models for your users' devices and generate typed tasks.
Also at /llms.txt and /llms-full.txt.
Privacy by architecture
Health check-ins, private notes, customer photos: on device, they never touch your servers or an AI provider. Telemetry is a closed list of numbers (model, latency, device class), validated on both ends.
FAQ
benatif is an open-source SDK (Apache-2.0) that runs AI models on your users' own devices: in the browser with WebGPU and in iOS/Android apps with llama.cpp. You ask for a task (extract, chat, classify, transcribe, speak, image, video) and benatif picks the model that fits each device, runs it locally and falls back to the cloud only with the user's consent.
Install the SDK with npm i natif zod, create a client with createClient() and call ai.chat() or ai.extract(). benatif downloads a model that fits the device (for example Qwen3-4B on a laptop, Qwen3-1.7B on a phone), caches it and runs it on the GPU with WebGPU in a Web Worker. No server is needed.
Yes. The same task API ships as natif (web), @natif/react-native, @natif/expo (development build, resumable downloads), and native Swift and Kotlin SDKs in preview. All of them use the same model catalog and selection rules, so the same code gives the same results on web, iOS and Android.
No. You describe the task; benatif measures the device (GPU, memory it can use, free storage, real speed) and picks the best model that fits. When a better model is released it can be swapped in without changing your code. Teams that want full control can plug in their own router.
Yes, without sending that data to benatif. Pass a few documents, or a retrieve function that queries your existing vector database or search API. With grounding "strict" the model answers only from your sources and returns citations.
No. Inputs and results stay on the device. Data only leaves in a cloud fallback that the user consented to, and projects can be marked device-only so the server refuses any fallback.
The SDK is free and open source. Running on the device costs $0 per call. Paid plans (coming soon) will add smart model routing based on real device performance data, a bundled cloud fallback on one bill, and a dashboard with metrics.
WebLLM and transformers.js are inference engines; benatif uses them and adds per-device model selection, schema validation, cloud fallback with consent, knowledge grounding and the same API on web, React Native, Expo, Swift and Kotlin. Firebase AI Logic's hybrid mode is tied to Gemini and, on the web, to the model built into Chrome; benatif runs open models (Qwen, Whisper, Janus) in any WebGPU browser and is not tied to one cloud.
Text models are 1.1-2.6 GB, downloaded once and cached. benatif can download them in the background (ai.download()) while the user browses, so the first call only compiles the model, which takes seconds.
Write a product, get a script, a photo, a voice-over and a vertical video ad. All generated in your browser.
Open the API playground →