{"id":42102167,"url":"https://github.com/Cap-go/capacitor-llm","last_synced_at":"2026-02-05T13:01:00.781Z","repository":{"id":309544810,"uuid":"1000598569","full_name":"Cap-go/capacitor-llm","owner":"Cap-go","description":"Capacitor plugin to run LLM models locally in IOS and Android, support AppleInteligence","archived":false,"fork":false,"pushed_at":"2026-01-31T23:06:13.000Z","size":963,"stargazers_count":13,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-01T10:57:25.994Z","etag":null,"topics":["capacitor","capgo","ionic","plugin"],"latest_commit_sha":null,"homepage":"https://capgo.app","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cap-go.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"Cap-go","patreon":null,"open_collective":"capgo","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2025-06-12T03:23:26.000Z","updated_at":"2026-01-31T23:06:17.000Z","dependencies_parsed_at":"2025-10-08T17:34:41.324Z","dependency_job_id":"994ddac1-0961-4fd9-b906-44923e3269fd","html_url":"https://github.com/Cap-go/capacitor-llm","commit_stats":null,"previous_names":["cap-go/apple-intelligence","cap-go/capacitor-llm"],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/Cap-go/capacitor-llm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-llm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-llm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-llm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-llm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cap-go","download_url":"https://codeload.github.com/Cap-go/capacitor-llm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-llm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29122350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T10:47:47.471Z","status":"ssl_error","status_checked_at":"2026-02-05T10:45:08.119Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["capacitor","capgo","ionic","plugin"],"created_at":"2026-01-26T13:00:21.333Z","updated_at":"2026-02-05T13:01:00.773Z","avatar_url":"https://github.com/Cap-go.png","language":"Vue","funding_links":["https://github.com/sponsors/Cap-go","https://opencollective.com/capgo"],"categories":["Capgo Capacitor Plugins","[Capgo plugins](https://capgo.app/)"],"sub_categories":["Utilities"],"readme":"# @capgo/capacitor-llm\n\n\u003ca href=\"https://capgo.app/\"\u003e\u003cimg src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/\u003e\u003c/a\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/?ref=plugin_llm\"\u003e ➡️ Get Instant updates for your App with Capgo 🚀\u003c/a\u003e\u003c/h2\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/consulting/?ref=plugin_llm\"\u003e Fix your annoying bug now, Hire a Capacitor expert 💪\u003c/a\u003e\u003c/h2\u003e\n\u003c/div\u003e\n\nAdds support for LLM locally run for Capacitor\n\nIt uses Apple Intelligence (default) or MediaPipe custom models on iOS, and MediaPipe's tasks-genai on Android\n\n## Documentation\n\nThe most complete doc is available here: https://capgo.app/docs/plugins/llm/\n\n## Compatibility\n\n| Plugin version | Capacitor compatibility | Maintained |\n| -------------- | ----------------------- | ---------- |\n| v8.\\*.\\*       | v8.\\*.\\*                | ✅          |\n| v7.\\*.\\*       | v7.\\*.\\*                | On demand   |\n| v6.\\*.\\*       | v6.\\*.\\*                | ❌          |\n| v5.\\*.\\*       | v5.\\*.\\*                | ❌          |\n\n\u003e **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.\n\n## Installation\n\n```bash\nnpm install @capgo/capacitor-llm\nnpx cap sync\n```\n\n### iOS Additional Setup for Custom Models\n\nIf you want to use custom models on iOS (not just Apple Intelligence), you need to install MediaPipe dependencies.\n\n**Using CocoaPods:**\nThe MediaPipe dependencies are already configured in the podspec. Make sure to run `pod install` after adding the plugin.\n\n**Note about Static Framework Warning:**\nWhen running `pod install`, you may see a warning about transitive dependencies with statically linked binaries. To fix this, update your Podfile:\n\n```ruby\n# Change this:\nuse_frameworks!\n\n# To this:\nuse_frameworks! :linkage =\u003e :static\n\n# And add this to your post_install hook:\npost_install do |installer|\n  assertDeploymentTarget(installer)\n  \n  # Fix for static framework dependencies\n  installer.pods_project.targets.each do |target|\n    target.build_configurations.each do |config|\n      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'\n    end\n    \n    # Specifically for MediaPipe pods\n    if target.name.include?('MediaPipeTasksGenAI')\n      target.build_configurations.each do |config|\n        config.build_settings['ENABLE_BITCODE'] = 'NO'\n      end\n    end\n  end\nend\n```\n\n**Using Swift Package Manager:**\n\nMediaPipe GenAI does not officially support SPM yet (see [MediaPipe issue #5464](https://github.com/google-ai-edge/mediapipe/issues/5464)). However, you can use the community package [SwiftTasksGenAI](https://github.com/paescebu/SwiftTasksGenAI) by adding it manually in Xcode:\n\n**To add MediaPipe GenAI via SPM:**\n1. Open your app project in Xcode\n2. Go to **File \u003e Add Package Dependencies...**\n3. Enter the URL: `https://github.com/paescebu/SwiftTasksGenAI.git`\n4. Select your desired version (e.g., 0.10.24)\n5. Add the `SwiftTasksGenAI` product to your app target\n\n**Note:** SwiftTasksGenAI uses unsafe build flags, which means it cannot be added directly in Package.swift files, but works fine when added through Xcode's UI. This is the same approach used by SwiftTasksVision.\n\n**Alternatively:** Use CocoaPods for a more traditional setup, or use Apple Intelligence (iOS 18.2+) which works with both SPM and CocoaPods.\n\n## Adding a Model to Your App\n\n### iOS\n\nOn iOS, you have two options:\n\n1. **Apple Intelligence (Default)**: Uses the built-in system model (requires iOS 26.0+) - Recommended\n2. **Custom Models**: Use your own models via MediaPipe (requires CocoaPods) - Note: Some model formats may have compatibility issues\n\n#### Using Apple Intelligence (Default)\n\nNo additional setup needed. The plugin will automatically use Apple Intelligence on supported devices (iOS 26.0+).\n\n#### Using Custom Models on iOS via MediaPipe\n\n**⚠️ IMPORTANT**: While MediaPipe documentation states Gemma-2 2B works on all platforms, iOS implementation has compatibility issues with `.task` format models, often resulting in `(prefill_input_names.size() % 2)==(0)` errors.\n\n## Model Compatibility Guide\n\n### Android (Working ✅)\n- **Model**: Gemma-3 models (270M, 1B, etc.)\n- **Format**: `.task` + `.litertlm` files\n- **Where to download**: \n  - [Kaggle Gemma models](https://www.kaggle.com/models/google/gemma) - \"LiteRT (formerly TFLite)\" tab\n  - Example: `gemma-3-270m-it-int8.task` + `gemma-3-270m-it-int8.litertlm`\n\n### iOS (Limited Support ⚠️)\n- **Recommended**: Use Apple Intelligence (built-in, no download needed)\n- **Alternative (Experimental)**: \n  - **Model**: Gemma-2 2B (documented as compatible but may still fail)\n  - **Format**: `.task` files (`.bin` format preferred but not available)\n  - **Where to download**:\n    - [Hugging Face MediaPipe models](https://huggingface.co/collections/google/mediapipe-668392ead2d6768e82fb3b87) \n    - Look for `Gemma2-2B-IT_*_ekv*.task` files\n    - Example: `Gemma2-2B-IT_multi-prefill-seq_q8_ekv1280.task`\n  - **Note**: Even with Gemma-2 2B, you may still encounter errors. Apple Intelligence is more reliable.\n\n### Web\n- **Model**: Gemma-3 models\n- **Format**: `.task` files\n- **Where to download**: Same as Android\n\n## Download Instructions\n\n1. **For Android**:\n   - Go to [Kaggle Gemma models](https://www.kaggle.com/models/google/gemma)\n   - Click \"LiteRT (formerly TFLite)\" tab\n   - Download both `.task` and `.litertlm` files\n   - Place in `android/app/src/main/assets/`\n\n2. **For iOS** (if not using Apple Intelligence):\n   - Visit [Hugging Face MediaPipe collection](https://huggingface.co/collections/google/mediapipe-668392ead2d6768e82fb3b87)\n   - Find Gemma-2 2B models\n   - Download `.task` files (and `.litertlm` if available)\n   - Add to Xcode project in \"Copy Bundle Resources\"\n   - Note: Success is not guaranteed due to format compatibility issues\n\n3. **Set the model path**:\n\n```typescript\nimport { CapgoLLM } from '@capgo/capacitor-llm';\n\n// iOS - Use Apple Intelligence (default)\nawait CapgoLLM.setModel({ path: 'Apple Intelligence' });\n\n// iOS - Use MediaPipe model (experimental)\nawait CapgoLLM.setModel({ \n  path: 'Gemma2-2B-IT_multi-prefill-seq_q8_ekv1280',\n  modelType: 'task',\n  maxTokens: 1280\n});\n\n// Now you can create chats and send messages\nconst chat = await CapgoLLM.createChat();\n```\n\n### Android\n\nFor Android, you need to include a compatible LLM model in your app. The plugin uses MediaPipe's tasks-genai, which supports various model formats.\n\nWhen Gemini mini will be out of close alpha we might add it as default like we do Apple intelligence default\nhttps://developer.android.com/ai/gemini-nano/experimental\n\n**Important:** Your app's `minSdkVersion` must be set to 24 or higher. Update your `android/variables.gradle` file:\n```gradle\next {\n    minSdkVersion = 24\n    // ... other settings\n}\n```\n\n1. **Download a compatible model**: \n   \n   **For Android: Gemma 3 Models** (Working ✅)\n   - **Recommended**: Gemma 3 270M - Smallest, most efficient (~240-400MB)\n   - Text-only model optimized for on-device inference\n   - Download from [Kaggle](https://www.kaggle.com/models/google/gemma) → \"LiteRT (formerly TFLite)\" tab\n   - Get both `.task` and `.litertlm` files\n   \n   **For iOS: Limited Options** (⚠️)\n   - **Option 1** (Recommended): Use Apple Intelligence - no download needed\n   - **Option 2** (Experimental): Try Gemma-2 2B from [Hugging Face](https://huggingface.co/collections/google/mediapipe-668392ead2d6768e82fb3b87)\n     - Download `Gemma2-2B-IT_*.task` files  \n     - May still encounter compatibility errors\n   \n   **Available Model Sizes** (from [Google AI](https://ai.google.dev/gemma/docs/core#sizes)):\n   - `gemma-3-270m` - Most portable, text-only (~240-400MB) - Android only\n   - `gemma-3-1b` - Larger text-only (~892MB-1.5GB) - Android only\n   - `gemma-2-2b` - Cross-platform compatible (~1-2GB) - iOS experimental\n   - Larger models available but not recommended for mobile\n   \n   For automated download, see the script in the example app section below.\n\n2. **Add the model to your app**:\n   \n   **Option A - Bundle in APK (for smaller models)**:\n   - Place the model files in your app's `android/app/src/main/assets/` directory\n   - The `/android_asset/` prefix is used to reference files from the assets folder\n   - Note: This approach may increase APK size significantly\n   \n   **Option B - Download at runtime (recommended for production)**:\n   - Host the model files on a server\n   - Download them to your app's files directory at runtime\n   - This keeps your APK size small\n\n3. **Set the model path**:\n\n```typescript\nimport { CapgoLLM } from '@capgo/capacitor-llm';\n\n// If model is in assets folder (recommended) - point to the .task file\nawait CapgoLLM.setModelPath({ path: '/android_asset/gemma-3-270m-it-int8.task' });\n\n// If model is in app's files directory\nawait CapgoLLM.setModelPath({ path: '/data/data/com.yourapp/files/gemma-3-270m-it-int8.task' });\n\n// Example: Download model at runtime (recommended for production)\nasync function downloadModel() {\n  // Add progress listener\n  await CapgoLLM.addListener('downloadProgress', (event) =\u003e {\n    console.log(`Download progress: ${event.progress}%`);\n  });\n\n  // Download the model\n  const result = await CapgoLLM.downloadModel({\n    url: 'https://your-server.com/models/gemma-3-270m-it-int8.task',\n    companionUrl: 'https://your-server.com/models/gemma-3-270m-it-int8.litertlm', // Android only\n    filename: 'gemma-3-270m-it-int8.task' // Optional, defaults to filename from URL\n  });\n\n  console.log('Model downloaded to:', result.path);\n  if (result.companionPath) {\n    console.log('Companion file downloaded to:', result.companionPath);\n  }\n\n  // Now set the model path\n  await CapgoLLM.setModelPath({ path: result.path });\n}\n\n// Now you can create chats and send messages\nconst chat = await CapgoLLM.createChat();\n```\n\n## Usage Example\n\n```typescript\nimport { CapgoLLM } from '@capgo/capacitor-llm';\n\n// Check if LLM is ready\nconst { readiness } = await CapgoLLM.getReadiness();\nconsole.log('LLM readiness:', readiness);\n\n// Set a custom model (optional - uses system default if not called)\n// iOS: Use a GGUF model from bundle or path\n// Android: Use a MediaPipe model from assets or files\nawait CapgoLLM.setModelPath({ \n  path: Platform.isIOS ? 'gemma-3-270m.gguf' : '/android_asset/gemma-3-270m-it-int8.task' \n});\n\n// Create a chat session\nconst { id: chatId } = await CapgoLLM.createChat();\n\n// Listen for AI responses\nCapgoLLM.addListener('textFromAi', (event) =\u003e {\n  console.log('AI:', event.text);\n});\n\n// Listen for completion\nCapgoLLM.addListener('aiFinished', (event) =\u003e {\n  console.log('AI finished responding to chat:', event.chatId);\n});\n\n// Send a message\nawait CapgoLLM.sendMessage({\n  chatId,\n  message: 'Hello! How are you today?'\n});\n```\n\n## API\n\n\u003cdocgen-index\u003e\n\n* [`createChat()`](#createchat)\n* [`sendMessage(...)`](#sendmessage)\n* [`getReadiness()`](#getreadiness)\n* [`setModel(...)`](#setmodel)\n* [`downloadModel(...)`](#downloadmodel)\n* [`addListener('textFromAi', ...)`](#addlistenertextfromai-)\n* [`addListener('aiFinished', ...)`](#addlisteneraifinished-)\n* [`addListener('downloadProgress', ...)`](#addlistenerdownloadprogress-)\n* [`addListener('readinessChange', ...)`](#addlistenerreadinesschange-)\n* [`getPluginVersion()`](#getpluginversion)\n* [Interfaces](#interfaces)\n\n\u003c/docgen-index\u003e\n\n\u003cdocgen-api\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\nLLM Plugin interface for interacting with on-device language models\n\n### createChat()\n\n```typescript\ncreateChat() =\u003e Promise\u003c{ id: string; instructions?: string; }\u003e\n```\n\nCreates a new chat session\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ id: string; instructions?: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### sendMessage(...)\n\n```typescript\nsendMessage(options: { chatId: string; message: string; }) =\u003e Promise\u003cvoid\u003e\n```\n\nSends a message to the AI in a specific chat session\n\n| Param         | Type                                              | Description                       |\n| ------------- | ------------------------------------------------- | --------------------------------- |\n| **`options`** | \u003ccode\u003e{ chatId: string; message: string; }\u003c/code\u003e | - The chat id and message to send |\n\n--------------------\n\n\n### getReadiness()\n\n```typescript\ngetReadiness() =\u003e Promise\u003c{ readiness: string; }\u003e\n```\n\nGets the readiness status of the LLM\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ readiness: string; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### setModel(...)\n\n```typescript\nsetModel(options: ModelOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nSets the model configuration\n- iOS: Use \"Apple Intelligence\" as path for system model, or provide path to MediaPipe model\n- Android: Path to a MediaPipe model file (in assets or files directory)\n\n| Param         | Type                                                  | Description               |\n| ------------- | ----------------------------------------------------- | ------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#modeloptions\"\u003eModelOptions\u003c/a\u003e\u003c/code\u003e | - The model configuration |\n\n--------------------\n\n\n### downloadModel(...)\n\n```typescript\ndownloadModel(options: DownloadModelOptions) =\u003e Promise\u003cDownloadModelResult\u003e\n```\n\nDownloads a model from a URL and saves it to the appropriate location\n- iOS: Downloads to the app's documents directory\n- Android: Downloads to the app's files directory\n\n| Param         | Type                                                                  | Description                  |\n| ------------- | --------------------------------------------------------------------- | ---------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#downloadmodeloptions\"\u003eDownloadModelOptions\u003c/a\u003e\u003c/code\u003e | - The download configuration |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#downloadmodelresult\"\u003eDownloadModelResult\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### addListener('textFromAi', ...)\n\n```typescript\naddListener(eventName: 'textFromAi', listenerFunc: (event: TextFromAiEvent) =\u003e void) =\u003e Promise\u003c{ remove: () =\u003e Promise\u003cvoid\u003e; }\u003e\n```\n\nAdds a listener for text received from AI\n\n| Param              | Type                                                                            | Description                         |\n| ------------------ | ------------------------------------------------------------------------------- | ----------------------------------- |\n| **`eventName`**    | \u003ccode\u003e'textFromAi'\u003c/code\u003e                                                       | - Event name 'textFromAi'           |\n| **`listenerFunc`** | \u003ccode\u003e(event: \u003ca href=\"#textfromaievent\"\u003eTextFromAiEvent\u003c/a\u003e) =\u0026gt; void\u003c/code\u003e | - Callback function for text events |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ remove: () =\u0026gt; Promise\u0026lt;void\u0026gt;; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### addListener('aiFinished', ...)\n\n```typescript\naddListener(eventName: 'aiFinished', listenerFunc: (event: AiFinishedEvent) =\u003e void) =\u003e Promise\u003c{ remove: () =\u003e Promise\u003cvoid\u003e; }\u003e\n```\n\nAdds a listener for AI completion events\n\n| Param              | Type                                                                            | Description                           |\n| ------------------ | ------------------------------------------------------------------------------- | ------------------------------------- |\n| **`eventName`**    | \u003ccode\u003e'aiFinished'\u003c/code\u003e                                                       | - Event name 'aiFinished'             |\n| **`listenerFunc`** | \u003ccode\u003e(event: \u003ca href=\"#aifinishedevent\"\u003eAiFinishedEvent\u003c/a\u003e) =\u0026gt; void\u003c/code\u003e | - Callback function for finish events |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ remove: () =\u0026gt; Promise\u0026lt;void\u0026gt;; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### addListener('downloadProgress', ...)\n\n```typescript\naddListener(eventName: 'downloadProgress', listenerFunc: (event: DownloadProgressEvent) =\u003e void) =\u003e Promise\u003c{ remove: () =\u003e Promise\u003cvoid\u003e; }\u003e\n```\n\nAdds a listener for model download progress events\n\n| Param              | Type                                                                                        | Description                             |\n| ------------------ | ------------------------------------------------------------------------------------------- | --------------------------------------- |\n| **`eventName`**    | \u003ccode\u003e'downloadProgress'\u003c/code\u003e                                                             | - Event name 'downloadProgress'         |\n| **`listenerFunc`** | \u003ccode\u003e(event: \u003ca href=\"#downloadprogressevent\"\u003eDownloadProgressEvent\u003c/a\u003e) =\u0026gt; void\u003c/code\u003e | - Callback function for progress events |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ remove: () =\u0026gt; Promise\u0026lt;void\u0026gt;; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### addListener('readinessChange', ...)\n\n```typescript\naddListener(eventName: 'readinessChange', listenerFunc: (event: ReadinessChangeEvent) =\u003e void) =\u003e Promise\u003c{ remove: () =\u003e Promise\u003cvoid\u003e; }\u003e\n```\n\nAdds a listener for readiness status changes\n\n| Param              | Type                                                                                      | Description                              |\n| ------------------ | ----------------------------------------------------------------------------------------- | ---------------------------------------- |\n| **`eventName`**    | \u003ccode\u003e'readinessChange'\u003c/code\u003e                                                            | - Event name 'readinessChange'           |\n| **`listenerFunc`** | \u003ccode\u003e(event: \u003ca href=\"#readinesschangeevent\"\u003eReadinessChangeEvent\u003c/a\u003e) =\u0026gt; void\u003c/code\u003e | - Callback function for readiness events |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ remove: () =\u0026gt; Promise\u0026lt;void\u0026gt;; }\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### getPluginVersion()\n\n```typescript\ngetPluginVersion() =\u003e Promise\u003c{ version: string; }\u003e\n```\n\nGet the native Capacitor plugin version.\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ version: string; }\u0026gt;\u003c/code\u003e\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### Interfaces\n\n\n#### ModelOptions\n\nModel configuration options\n\n| Prop              | Type                | Description                                                                                                |\n| ----------------- | ------------------- | ---------------------------------------------------------------------------------------------------------- |\n| **`path`**        | \u003ccode\u003estring\u003c/code\u003e | Model path or \"Apple Intelligence\" for iOS system model                                                    |\n| **`modelType`**   | \u003ccode\u003estring\u003c/code\u003e | Model file type/extension (e.g., \"task\", \"bin\", \"litertlm\"). If not provided, will be extracted from path. |\n| **`maxTokens`**   | \u003ccode\u003enumber\u003c/code\u003e | Maximum number of tokens the model handles                                                                 |\n| **`topk`**        | \u003ccode\u003enumber\u003c/code\u003e | Number of tokens the model considers at each step                                                          |\n| **`temperature`** | \u003ccode\u003enumber\u003c/code\u003e | Amount of randomness in generation (0.0-1.0)                                                               |\n| **`randomSeed`**  | \u003ccode\u003enumber\u003c/code\u003e | Random seed for generation                                                                                 |\n\n\n#### DownloadModelResult\n\nResult of model download\n\n| Prop                | Type                | Description                                             |\n| ------------------- | ------------------- | ------------------------------------------------------- |\n| **`path`**          | \u003ccode\u003estring\u003c/code\u003e | Path where the model was saved                          |\n| **`companionPath`** | \u003ccode\u003estring\u003c/code\u003e | Path where the companion file was saved (if applicable) |\n\n\n#### DownloadModelOptions\n\nOptions for downloading a model\n\n| Prop               | Type                | Description                                                   |\n| ------------------ | ------------------- | ------------------------------------------------------------- |\n| **`url`**          | \u003ccode\u003estring\u003c/code\u003e | URL of the model file to download                             |\n| **`companionUrl`** | \u003ccode\u003estring\u003c/code\u003e | Optional: URL of companion file (e.g., .litertlm for Android) |\n| **`filename`**     | \u003ccode\u003estring\u003c/code\u003e | Optional: Custom filename (defaults to filename from URL)     |\n\n\n#### TextFromAiEvent\n\nEvent data for text received from AI\n\n| Prop          | Type                 | Description                                                                |\n| ------------- | -------------------- | -------------------------------------------------------------------------- |\n| **`text`**    | \u003ccode\u003estring\u003c/code\u003e  | The text content from AI - this is an incremental chunk, not the full text |\n| **`chatId`**  | \u003ccode\u003estring\u003c/code\u003e  | The chat session ID                                                        |\n| **`isChunk`** | \u003ccode\u003eboolean\u003c/code\u003e | Whether this is a complete chunk (true) or partial streaming data (false)  |\n\n\n#### AiFinishedEvent\n\nEvent data for AI completion\n\n| Prop         | Type                | Description                       |\n| ------------ | ------------------- | --------------------------------- |\n| **`chatId`** | \u003ccode\u003estring\u003c/code\u003e | The chat session ID that finished |\n\n\n#### DownloadProgressEvent\n\nEvent data for download progress\n\n| Prop                  | Type                | Description                              |\n| --------------------- | ------------------- | ---------------------------------------- |\n| **`progress`**        | \u003ccode\u003enumber\u003c/code\u003e | Percentage of download completed (0-100) |\n| **`totalBytes`**      | \u003ccode\u003enumber\u003c/code\u003e | Total bytes to download                  |\n| **`downloadedBytes`** | \u003ccode\u003enumber\u003c/code\u003e | Bytes downloaded so far                  |\n\n\n#### ReadinessChangeEvent\n\nEvent data for readiness status changes\n\n| Prop            | Type                | Description          |\n| --------------- | ------------------- | -------------------- |\n| **`readiness`** | \u003ccode\u003estring\u003c/code\u003e | The readiness status |\n\n\u003c/docgen-api\u003e\n\n## Example App Model Setup\n\nThe example app demonstrates how to use custom models with the Capacitor LLM plugin.\n\n### Downloading Models\n\nSince AI models require license acceptance, you need to download them manually:\n\n### Model Setup by Platform\n\n#### Android Setup (Gemma 3 270M) ✅\n\n1. **Create Kaggle account and accept license:**\n   - Create a [Kaggle account](https://www.kaggle.com)\n   - Visit [Gemma 3 models](https://www.kaggle.com/models/google/gemma-3) and accept terms\n\n2. **Download the model:**\n   - Click \"LiteRT (formerly TFLite)\" tab\n   - Download `gemma-3-270m-it-int8` (get BOTH files):\n     - `gemma-3-270m-it-int8.task`\n     - `gemma-3-270m-it-int8.litertlm`\n\n3. **Place in Android app:**\n   - Copy BOTH files to: `example-app/android/app/src/main/assets/`\n   - In code, reference with `/android_asset/` prefix\n\n#### iOS Setup ⚠️\n\n**Option 1 (Recommended)**: Use Apple Intelligence\n- No model download needed\n- Works out of the box on iOS 26.0+\n\n**Option 2 (Experimental)**: Try Gemma-2 2B\n1. Visit [Hugging Face MediaPipe models](https://huggingface.co/collections/google/mediapipe-668392ead2d6768e82fb3b87)\n2. Download Gemma-2 2B files (e.g., `Gemma2-2B-IT_multi-prefill-seq_q8_ekv1280.task`)\n3. Add to Xcode project in \"Copy Bundle Resources\"\n4. Note: May still encounter errors - Apple Intelligence is more reliable\n### Update your code to use the model:\n```typescript\n// Android - Gemma 3 270M\nawait CapgoLLM.setModel({ \n  path: '/android_asset/gemma-3-270m-it-int8.task',\n  maxTokens: 2048,\n  topk: 40,\n  temperature: 0.8\n});\n\n// iOS Option 1 - Apple Intelligence (Recommended)\nawait CapgoLLM.setModel({ \n  path: 'Apple Intelligence' \n});\n\n// iOS Option 2 - Gemma-2 2B (Experimental)\nawait CapgoLLM.setModel({ \n  path: 'Gemma2-2B-IT_multi-prefill-seq_q8_ekv1280',\n  modelType: 'task',\n  maxTokens: 1280,\n  topk: 40,\n  temperature: 0.8\n});\n```\n\n### Model Selection Guide\n\n**For Android**: Gemma 3 270M is recommended because:\n- Smallest size (~240-400MB)\n- Text-only (perfect for chat)\n- Optimized for mobile devices\n- Works reliably with MediaPipe\n\n**For iOS**: Apple Intelligence is recommended because:\n- No download required\n- Native iOS integration\n- Better performance\n- No compatibility issues\n\n## Known Issues\n\n- **iOS MediaPipe Compatibility**: MediaPipe iOS SDK has issues with `.task` format models\n  - Symptom: `(prefill_input_names.size() % 2)==(0)` errors\n  - Solution: Use Apple Intelligence (built-in) instead of custom models\n  - Alternative: Try Gemma-2 2B models (experimental, may still fail)\n\n- **Platform Requirements**:\n  - iOS: Apple Intelligence requires iOS 26.0+\n  - Android: Minimum SDK 24\n\n- **Performance Considerations**:\n  - Model files are large (300MB-2GB)\n  - Initial download takes time\n  - Some devices may have memory limitations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCap-go%2Fcapacitor-llm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCap-go%2Fcapacitor-llm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCap-go%2Fcapacitor-llm/lists"}