Skip to content

@capgo/capacitor-llm

LLM Plugin interface for interacting with on-device language models.

@capgo/capacitor-llm runs on device chat models without sending prompts to your server. iOS can use Apple Intelligence or LiteRT bundles. Android targets Gemini Nano where available or LiteRT .litertlm models. Web uses Gemma through MediaPipe GenAI (CDN runtime, local model file).

PlatformBackends
iOSApple Intelligence, custom .litertlm
AndroidGemini Nano, LiteRT, legacy MediaPipe .task fallback
WebGemma via @mediapipe/tasks-genai
  • createChat - Creates a new chat session.
  • sendMessage - Sends a message to the AI in a specific chat session.
  • getReadiness - Gets the readiness status of the LLM.
  • setModel - Sets the model configuration - iOS: Use “Apple Intelligence” as path for system model, or provide path to MediaPipe model - Android: Path to a MediaPipe model file (in assets or files directory).
MethodDescription
createChatCreates a new chat session.
sendMessageSends a message to the AI in a specific chat session.
getReadinessGets the readiness status of the LLM.
setModelSets the model configuration - iOS: Use “Apple Intelligence” as path for system model, or provide path to MediaPipe model - Android: Path to a MediaPipe model file (in assets or files directory).
downloadModelDownloads a model from a URL and saves it to the appropriate location - iOS: Downloads to the app’s documents directory - Android: Downloads to the app’s files directory.
addListenerAdds a listener for text received from AI.
addListenerAdds a listener for AI completion events.
addListenerAdds a listener for model download progress events.
addListenerAdds a listener for readiness status changes.
getPluginVersionGet the native Capacitor plugin version.

This reference is synced from src/definitions.ts in capacitor-llm.

If you are using @capgo/capacitor-llm to plan migration and enterprise operations, connect it with Using @capgo/capacitor-llm for the native capability in Using @capgo/capacitor-llm, Capgo Enterprise for the product workflow in Capgo Enterprise, Ionic Enterprise Plugin Alternatives for the product workflow in Ionic Enterprise Plugin Alternatives, Capgo Alternatives for the product workflow in Capgo Alternatives, and Capgo Consulting for the product workflow in Capgo Consulting.