This beta feature is currently unavailable. We are moving off a dependency that is no longer open source and onto our own local AI infrastructure, so that every Despia user gets a fully open source, license-compliant experience.
Run language models on-device with one function call. Models load via the device’s native AI acceleration stack. Inference jobs auto-resume across backgrounding. Downloads continue when users close the app.
Installation
- Bundle
- CDN
Runtime detection
The SDK resolves runtime state once at import time and exposes it synchronously. Gate every call behindintelligence.runtime.ok so the same code works in a desktop browser preview.
ok is false, every API returns a not-ready handle. models.available() resolves to an empty array. The SDK never throws on a missing runtime, so your code can branch cleanly without try/catch.
Run
Fire an inference job and wire callbacks for streaming tokens and the final result.Handler callbacks
Fires for each snapshot.
chunk is the full accumulated text so far, not a delta.Fires on failure. See error codes.
Optional notification hook. Fires once per active job on
focusout. Use for UI affordances or analytics. Resume itself is automatic.Returns
run() returns a call handle synchronously. The same destructure works whether the runtime is ready or not.
Models
Manage the on-device model catalogue. Models are downloaded from Hugging Face into the Despia container and reused across launches.- Available
- Installed
- Download
- Remove
Starts a background download. Fire-and-forget, results arrive via the callback object.
Download events
Per-call callbacks for the component that started the download. Global events for app-wide state that needs to survive anything, including a force-quit mid-download.Fires on progress updates.
pct is a 0 to 100 integer in both the global event and the per-call onProgress callback.Background and return
Inference sessions do not survive backgrounding. The native context is torn down when iOS or Android suspend the WebView. The SDK handles this for you. Every in-flight job is re-fired automatically with the same params and the same handler when the user returns. Just write your code as if backgrounding does not exist. The SDK only re-fires jobs that were genuinely interrupted: jobs that complete normally never re-fire, jobs that error out never re-fire, jobs you explicitly.cancel() never re-fire. Any number of concurrent jobs all resume.
Error codes
React hook
Environment check
Resources
NPM Package
despia-intelligence
Introduction
Overview, model selection, and FAQs
GitHub
Source on GitHub