cross-platform-llm-client README

README проекта с github.com/orailnoor/cross-platform-llm-client. Одним файлом markdown: README.md.

PrivateLM

Live Web App

A production-ready, cross-platform AI chat client built with Flutter. It unifies local on-device LLM inference (Android) with cloud API access, giving users full control over how their models run.

Image generation tested on Moto G71 (Snapdragon), Oneplus 10r (Mediatek), Pixel 6A (Tensor), Poco F1 (Snapdragon), Samsung s23 (Snapdragon) 4 steps fast Image generation tested on Moto G71 (Snapdragon), Oneplus 10r (Mediatek), Pixel 6A (Tensor), Poco F1 (Snapdragon), Samsung s23 (Snapdragon) 4 steps fast

Generated on pixel 6 with 20 step Generated on pixel 6 with 20 step


What It Does


Technical Architecture

Stack

Inference Pipeline

┌─────────────────────────────────────────────────────────────┐
│                        UI Layer                              │
│   ChatView / ModelView / ServerView / SettingsView          │
└──────────────────────────┬──────────────────────────────────┘
                           │
┌──────────────────────────▼──────────────────────────────────┐
│                    Controllers (GetX)                        │
│   ChatController · TaskController · ModelController         │
│   SettingsController · HomeController                       │
└──────────────────────────┬──────────────────────────────────┘
                           │
┌──────────────────────────▼──────────────────────────────────┐
│                      Services                                │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────┐ │
│  │ InferenceService│  │  CloudService   │  │DownloadSvc  │ │
│  │  (local GGUF)   │  │ (OpenAI/Claude/ │  │ (model dl)  │ │
│  │                 │  │  Gemini/Kimi)   │  │             │ │
│  └─────────────────┘  └─────────────────┘  └─────────────┘ │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────┐ │
│  │  HiveService    │  │ DeviceInfoSvc   │  │ExecutionSvc │ │
│  │  ( persistence) │  │  (RAM/GPU tier) │  │ (bg tasks)  │ │
│  └─────────────────┘  └─────────────────┘  └─────────────┘ │
└─────────────────────────────────────────────────────────────┘

Local Inference (Android)

The app uses llama_flutter_android, a custom Flutter plugin wrapping llama.cpp for ARM64 devices. At runtime it:

  1. Detects GPU capabilities via Vulkan to determine offload layers.
  2. Selects thread count based on device tier (ultra / high / mid / low).
  3. Loads the GGUF model with progress streaming.
  4. Generates tokens via generateChat() with native chat-template support (ChatML, Llama-3, Gemma, Phi).
  5. Falls back to manual prompt construction if native templates fail.

Idle detection (5s) and hard timeouts (180s) keep the UX responsive even on underpowered hardware.

Cloud Inference

CloudService normalizes four different API shapes into a single interface:

API keys are stored in Hive and never transmitted anywhere except to the provider's endpoint.

Cross-Platform Abstraction

Local inference is conditionally compiled:

The InferenceService exposes supportsLocalInference so the UI can hide local-model UI on unsupported platforms.


Supported Platforms

Platform Local Inference Cloud APIs Notes
Android ✅ Yes ✅ Yes CPU offload via NEON; minSdk 28
iOS ✅ Yes ✅ Yes Metal GPU acceleration
Web ❌ No ✅ Yes Cloud-only (local coming soon)

iOS / iPad (Installation via AltServer)

The iOS/iPad release is distributed as a sideloadable IPA file. Due to the RAM requirements for local models, iPad is the recommended iOS target, but it can be installed on iPhones.

Here is how you can install the app using AltStore and AltServer:

Prerequisites:

Installation Steps:

  1. Download the IPA: Go to the Releases page on your iOS device (using Safari) and download the latest PrivateLM-iOS.zip package, extract it to get the .ipa file.
  2. Open in AltStore:
    • Locate the extracted .ipa file in your device's "Files" app.
    • Tap the Share button and select AltStore from the list of apps.
    • Alternatively, you can open the AltStore app, go to the My Apps tab, tap the "+" (plus) icon in the top-left corner, and select the downloaded IPA file.
  3. Install: AltStore will begin installing the app. You may be prompted to enter your Apple ID credentials if this is your first time.
  4. Enable Developer Mode: On iOS 16 and later, ensure "Developer Mode" is enabled in your device's Settings (Settings > Privacy & Security > Developer Mode) to launch the sideloaded app.
  5. Launch: Once installation is finished, PrivateLM will appear in the My Apps tab in AltStore and on your device's home screen!

Note: Sideloaded apps via AltStore expire after 7 days, but AltStore will attempt to automatically refresh them in the background when connected to the same Wi-Fi as your computer running AltServer.


Build Configuration

Prerequisites

Android

flutter pub get
flutter build apk --debug

Release APKs require a stable signing key. Copy android/key.properties.example to android/key.properties, fill in the keystore values, and keep both the key and its backup. Android accepts an APK upgrade only when it is signed with the same key as the installed APK.

cp android/key.properties.example android/key.properties
flutter build apk --release --split-per-abi

Never rotate the signing key between GitHub releases. The per-ABI APKs must also keep increasing the build number in pubspec.yaml.

iOS

flutter pub get
cd ios
pod install
flutter build ios

Web

flutter pub get
flutter build web --release

License

MIT — see LICENSE for details.

cross-platform-llm-client (orailnoor/cross-platform-llm-client)

Ищем в базе…

Что это такое?PrivateLM — это приложение на Flutter для телефонов, которое общается с ИИ либо прямо на устройстве с моделями GGUF, либо через облачные API на ваш выбор.
Это приложение, которое устанавливается, или библиотека, которую добавляют в код?Это приложение, которое устанавливается, а не библиотека. На Android и iOS доступен полноценный локальный инференс, а веб-версия работает только с облачными API.
Как установить его на телефон?На Android скачайте APK на странице Releases. На iOS скачайте PrivateLM-iOS.zip, распакуйте файл .ipa и установите его через AltStore, которому нужен запущенный AltServer на Mac или ПК с Windows.
Нужен ли мне свой ключ API, чтобы пользоваться приложением?Нет, для локальных моделей ничего, кроме загрузки, не требуется. Для облачного режима нужен ваш ключ OpenAI, Anthropic, Google Gemini или Kimi, и эти ключи хранятся на устройстве.
Какие есть подвохи?Раздел задач для многошаговых сценариев ещё в разработке и в приложении пока отсутствует. На iOS установки через AltStore истекают через 7 дней, и их нужно обновлять по Wi-Fi с помощью AltServer.
На каких устройствах это работает?Локальный инференс есть и на Android, и на iOS, а веб работает только с облаком. Для iOS рекомендуется iPad, так как локальным моделям нужно много оперативной памяти, но приложение также устанавливается на iPhone.
Можно ли отправлять модели картинки?Да, в одном чате можно отправлять и текст, и изображения. Распознавание изображений работает с локальными моделями Qwen2-VL и с облачными провайдерами.
Подстраивается ли оно под память моего телефона?При первом запуске оно проверяет объём оперативной памяти устройства и рекомендует размер контекста и лимиты токенов. Для локального инференса также подбирается количество потоков в зависимости от класса устройства.
Какие форматы локальных моделей и шаблоны чата поддерживаются?Локальные модели используют формат GGUF. Встроенные шаблоны чата охватывают ChatML, Llama-3, Gemma и Phi, а в качестве запасного варианта доступно ручное построение промптов.
Автор
orailnoor
Размер
98.1 MB
Звёзды
2.4K
Возраст
6 мес
Коммиты · 90 дней