Web · React Native · Expo

On-device AI.
One SDK.

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 ·

checkin.ts
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
2.0 sstructured extraction on device
Qwen3-4B · M2 Max · Chrome
0 bytesof user content sent to your servers
$0per call when it runs on the device
2.2×faster than real time Spanish speech
Supertonic 2 · WASM

How it works

An orchestrator for local models

Declare what your app needs. benatif measures the device and decides, call by call, where each model runs.

01

Detect

WebGPU, f16 support, memory budget, free storage. Memory is budgeted on what's available, so it never slows the user's computer down.

02

Select

Picks the best model that fits from a curated catalog (Apache/MIT licenses only), using anonymous benchmarks from devices like this one.

03

Run

Downloads once, caches, runs each engine in its own Web Worker. Output is constrained to your JSON Schema and validated with zod.

04

Fall back

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

Text, voice, image, video

{ }

Text → JSON

Extraction, classification, scoring with schema-constrained decoding. Qwen3-4B, Gemma 4 E2B.

available
◉

Voice

Natural text-to-speech in English, Spanish, Portuguese, French and Korean.

preview
▣

Image

Text-to-image on the GPU with Janus-Pro 1B. 384×384 in ~7 s on a laptop.

preview
▶

Video

Compose vertical videos with captions, voice and music. 1080×1920 rendered faster than real time with WebCodecs.

preview
≋

Speech → text

Whisper on device: record or upload, the audio never leaves the browser.

preview
◎

Vision

Image understanding with small multimodal models.

phase 4
❝

Your knowledge

Ground answers in your docs or your own vector DB, with citations. benatif never stores the data.

available

Benchmarks

Measured, not promised

Apple M2 Max, Chrome 157, WebGPU. Model already cached. Structured check-in extraction, 5 runs, median.

ModelLicenseTime to first tokenFull answerSpeedQuality
Qwen3-4BApache-2.00.8 s2.0 s~40 tok/s●●●
Gemma 4 E2BApache-2.01.0 s2.7 s~20 tok/s●●●
Qwen3-1.7BApache-2.00.3 s~1 sfast●●○
Qwen2.5-1.5BApache-2.00.3 s1.1 sfast●○○

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

Let your coding assistant add it

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.

prompt.md

Privacy by architecture

The safest data is data you never receive

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

Questions developers ask

What is benatif?

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.

How do I run an LLM in the browser?

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.

Does it work with React Native, Expo, Swift and Kotlin?

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.

Do I have to choose a model?

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.

Can the AI answer from my own data (RAG)?

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.

Is my users' data sent to a server?

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.

How much does it cost?

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.

How is benatif different from WebLLM, transformers.js or Firebase AI Logic?

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.

How big are the models and how long is the first load?

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.

See it run on your machine

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 →