pocketpal-ai

GitHub

An app that brings language models directly to your phone.

7,701 stars TypeScript
RAW Doc

Getting Started

Getting Started

Note: Part of this guide is outdated. It will be updated soon.

Installation

iPhone users can grab it here: PocketPal AI on the App Store

Android users can get it from here: PocketPal AI on Google Play

Note: This is a personal project, so I am working on it in my spare time. It might have bugs and issues, and obviously, I have not tested it on all devices. If you encounter any issues, open an issue, or even better, contribute to the project!


Available Models


PocketPal AI comes pre-configured with some popular SLMs:

- Danube 2 and 3
- Phi
- Gemma 2
- Qwen

Modells need to be downloaded before use. You can download and use these models directly from the app and load any other GGUF models you like!

<div style="display: flex; justify-content: center;">
<img src="../assets/models_page.webp" alt="Models Page" style="width: 33%;">
</div>

Using PocketPal AI

Downloading a Model

- Tap the burger menu
- Navigate to the β€œModels” page
- Choose your desired model and hit download


<div style="display: flex; justify-content: center;">
<img src="../assets/add_model_1.webp" alt="Navigate to Models Page" style="width: 33%;">
<img src="../assets/add_model_2.webp" alt="Download a Model" style="width: 33%;">
<img src="../assets/add_model_3.webp" alt="Load a Model" style="width: 33%;">
</div>

Loading a Model


After downloading, tap Load to bring the model into memory. Now you’re ready to chat!

Tips

On iOS devices, Apple’s GPU API (Metal) is activated by default. If you experience any hiccups, try deactivating it.

#### iOS Metal

#### Auto Offload/Load

To keep the device running smoothly, PocketPal AI can automatically manage memory usage:

- Enable β€œAuto Offload/Load” on the model page (by default it is)
- The app will offload the model when in the background
- It’ll reload when you return (give it a few seconds for larger models)

#### Advanced Settings

Click the chevron icon to access advanced LLM settings like:

- Temperature
- BOS token
- Chat template options
- etc.

<div style="display: flex; justify-content: center;">
<img src="../assets/model_config_1.webp" alt="Navigate to Models Page" style="width: 33%;">
<img src="../assets/model_config_2.webp" alt="Download a Model" style="width: 33%;">
<img src="../assets/model_load.webp" alt="Load a Model" style="width: 33%;">
</div>

Finally, Let’s Chat!

Once your model is loaded, head to the β€œChat” page and start conversing with the loaded model!

The generation performance metric is also displayed. If interested, watch the chat bubble for real-time performance metrics: Tokens per second and Milliseconds per token.

<div style="display: flex; justify-content: center;">
<img src="../assets/chat_1.webp" alt="Navigate to Models Page" style="width: 33%;">
<img src="../assets/chat_2.webp" alt="Download a Model" style="width: 33%;">
</div>

Copying Text

Important Note: As of now, I haven’t found an easy way to select and copy text from the generated responses while preserving the text formatting, particularly Markdown support.

In the meantime, here are the current options for copying text:
- Paragraph-level copying: Long-press on a specific paragraph to copy its content.
- Full response copying: Use the copy icon at the bottom of the text bubble to copy the entire AI-generated response.

I know these options might not be ideal, and this is one of my frustrations with using other apps. The difficulty of copying portions of text used to be a particularly annoying aspect of chat apps like ChatGPT and others.

Developers: PocketPal AI is built using React Native. Finding an easy solution that balances text selection with preserved formatting (especially Markdown support) has been tricky for me. If you have experience in this area, I’d love to hear from you!

Feedback Welcome!

If you have suggestions for new models or features, please let us know by creating an issue.

Happy exploring! πŸš€πŸ“±βœ¨

---

CONTRIBUTING

Contributing

Thank you for your interest in contributing! We welcome all contributions, from bug reports and feature requests to code changes. Please feel free to put up a PR for any issue or feature request.

Code of Conduct

Please be respectful to others in all interactions related to this project. We expect contributors to adhere to the code of conduct.

Creating issues

If you find any bugs, have suggestions for improvements, or encounter unexpected behavior, please open an issue.
Creating an issue before submitting a PR helps us discuss the problem or feature request in advance.

Submitting Pull Requests

We are grateful for any pull requests! To ensure a smooth contribution process, please follow these steps:

Workflow for Contributing

1. Fork this repository.
2. Clone your fork
3. Create a new branch
4. Make your changes: Implement your feature, fix the issue, or improve the code.
5. Test your changes: Please make sure your changes are tested locally (for all affected devices).

Testing Your Changes

We highly encourage testing your changes before submitting a pull request.

- Run the Metro server:

bash
yarn start:reset

- Run the app on iOS:
bash
yarn ios

- Run the app on Android:
bash
yarn android

Linting and Type Checking

Make sure your code passes the lint and type check processes:

- Lint your code with ESLint:

bash
yarn lint

- Type check your code with TypeScript:
bash
yarn typecheck


Writing Tests

Please add tests for any new features or changes. We use Jest for unit testing:

- Run tests:

bash
yarn test

If your changes affect the app's behavior, ensure you include or update tests as appropriate.

Translations (Localization)

PocketPal uses Weblate for managing translations. When adding or changing user-facing strings:

- Only edit src/locales/en.json (the English source file). Do not edit ja.json, zh.json, or other language files directly β€” they are managed by translators through Weblate and will be overwritten.
- Use {{placeholder}} syntax (double braces) for dynamic values, e.g. "Imported {{count}} sessions".
- Run yarn l10n:validate to check that your JSON is valid and placeholders are consistent.

To contribute translations, visit PocketPal on Weblate β€” no code changes needed.

Commit Message Guidelines

We follow the Conventional Commits specification for our commit messages to ensure clarity and consistency. Use one of the following prefixes for your commits:

- feat: New features (e.g., feat: add new model support functionality).
- fix: Bug fixes (e.g., fix: resolve crash on app startup).
- docs: Documentation changes (e.g., docs: update README.md).
- chore: Refactoring, tooling, testing, or configuration changes (e.g., chore: update CI pipeline).

Opening a Pull Request

1. Commit your changes following the commit message guidelines.
2. Push your branch to your fork.
3. Open a pull request from your branch in your fork to the main branch of this repository.
4. Follow the pull request template and fill in all relevant details.

Before opening a pull request, make sure:
- Your changes are focused and kept to a single logical change.
- Your code is linted and passes type checks.
- Tests are added or updated if applicable.

---

README

<div align="center">

<img src="src/assets/pocketpal-dark-v2.png" alt="PocketPal AI logo" width="120" />

PocketPal AI

A private AI assistant that runs entirely on your phone.

Chat with language models, give them a voice, and let them use tools β€” all on-device. No account, no cloud, no internet required.

<a href="https://pocketpal.dev/"><strong>pocketpal.dev</strong></a> Β·
<a href="#get-the-app">Get the app</a> Β·
<a href="https://pocketpal.dev/leaderboard">Leaderboard</a> Β·
<a href="https://palshub.ai/">PalsHub</a> Β·
<a href="https://github.com/a-ghorbani/pocketpal-ai/discussions">Discussions</a>

<br/>

[](https://apps.apple.com/us/app/pocketpal-ai/id6502579498)
[](https://play.google.com/store/apps/details?id=com.pocketpalai)

[](https://github.com/a-ghorbani/pocketpal-ai/releases)
[](LICENSE)
[](https://github.com/a-ghorbani/pocketpal-ai/stargazers)
[](https://github.com/a-ghorbani/pocketpal-ai/issues)
[](https://github.com/sponsors/a-ghorbani)

</div>

---

Why PocketPal AI?

Most AI apps are a thin window onto someone else's server β€” every message you type gets shipped off, logged, and analyzed somewhere you can't see. PocketPal flips that around: the AI lives on your phone, and your conversations never leave it.

- πŸ”’ Private by default β€” every prompt, response, and document stays on your device. Nothing is uploaded or stored on external servers.
- ✈️ Works offline β€” download a model once and it just works, with no connection and no account. On a plane, on a trail, anywhere.
- πŸ“± Runs on hardware you already own β€” real language models, voices, and tools, tuned to make the most of your phone's CPU, GPU, and NPU.
- πŸ†“ Free and open source β€” no subscription, no "pro" tier to unlock the AI. MIT-licensed and built in the open.

Privacy note: The only data that ever leaves your device is what you explicitly choose to share β€” benchmark results (if you opt into the leaderboard) and feedback you submit through the app.

Contents

- Features
- Get the app
- How it works
- Using the app
- For developers
- Contributing
- Roadmap
- Community & support
- License

Features

- 🧠 On-device chat β€” run GGUF language models (Gemma, Qwen, Phi, Llama, and more) fully offline.
- πŸ—£οΈ Text-to-speech β€” give your assistant a voice with on-device neural TTS (Kokoro and other engines), no cloud calls.
- 🎭 Pals β€” create personalized assistants with their own model, system prompt, and personality (Assistant and Roleplay types).
- πŸ›οΈ PalsHub β€” discover and install community Pals, including premium ones via in-app checkout.
- πŸ› οΈ Talents & tools β€” let capable Pals call built-in tools (calculator, date/time, rich HTML rendering) inside a tool-use loop.
- πŸ“₯ Hugging Face integration β€” search and download GGUF models, including gated ones, directly from the HF Hub with your access token.
- πŸ“Š Benchmarking β€” measure tokens/sec and memory, and optionally compare on the AI Phone Leaderboard.
- ⚑ Hardware acceleration β€” CPU, GPU (Metal on iOS, OpenCL/Adreno on Android), and NPU (Qualcomm Hexagon) inference paths, with graceful fallback.
- 🌍 Localized β€” available in 11 languages, on phones and tablets, including full iPad support.

Get the app

| Platform | |
| --- | --- |
| iOS / iPadOS | [](https://apps.apple.com/us/app/pocketpal-ai/id6502579498) |
| Android | [](https://play.google.com/store/apps/details?id=com.pocketpalai) |

Three steps to your first chat:

1. Install PocketPal from the App Store or Google Play.
2. Download a model β€” tap the menu (☰) β†’ Models, pick one that fits your phone, and download (or add one from Hugging Face).
3. Load it and start chatting β€” that's it, you're running AI fully offline.

How it works

You don't need to know any of this to use PocketPal β€” but if you're curious how a phone runs real AI offline, here's the short version.

PocketPal is a four-layer stack, from the silicon up to the chat UI. Each layer has one job, and the dependency direction is strictly top-down β€” the JS app talks to native bridges, bridges talk to inference engines, engines target hardware backends.

<div align="center">
<img src="assets/images and logos/stack-diagram-dark.png" alt="PocketPal AI on-device stack β€” UI & Tool Use β†’ Bridging β†’ Engine β†’ Hardware" width="100%">
</div>

| Layer | What runs here |
| --- | --- |
| UI & Tool Use | The React Native app (UI via React Native Paper, state via MobX, chat history in WatermelonDB). The AgentRunner drives each chat turn β€” streaming tokens, dispatching Talents (tools) when the model calls them, and feeding results back for follow-up reasoning. Pals are configurable personas; PalsHub is the in-app marketplace for sharing and buying them. |
| Bridging | Native modules that connect JavaScript to the engines. llama.rn bridges LLM inference over JSI; react-native-speech and onnxruntime-react-native bridge text-to-speech. |
| Engine | The inference engines. llama.cpp runs language models in the quantized GGUF format. ONNX Runtime runs TTS voice models in the ONNX format. |
| Hardware | Where the math actually happens. PocketPal targets CPU (universal fallback), GPU (Metal on iOS, OpenCL on Qualcomm Adreno for Android), and NPU (Qualcomm Hexagon) β€” falling back gracefully and offloading partial layers when a full backend isn't available. |

Using the app

<details>
<summary><strong>πŸ“₯ Download & load a model</strong></summary>

<br/>

1. Open the app and tap the Menu (☰), then go to Models.
2. Pick a model from the list and tap Download, or tap + to add one from Hugging Face or local storage.
3. From Hugging Face, search GGUF models and choose a quantization that fits your device's memory and storage β€” download now or bookmark for later.
4. After downloading, tap Load (or use the chevron icon left of the chat input to load right from the chat screen).

<img src="assets/images and logos/Download_models.png" alt="Download Models" width="100%">
</details>

<details>
<summary><strong>πŸ’¬ Chat</strong></summary>

<br/>

1. Make sure a model is loaded.
2. Open the Chat page and start talking.
3. The screen stays awake during inference and deactivates when idle.
4. Copy a full response with the copy icon, or long-press a paragraph to copy just that.
5. Edit any of your messages with a long-press β€” the AI regenerates from your change. Hit retry for a fresh answer, optionally with a different model.

<img src="assets/images and logos/Chat.png" alt="Chat" width="83%">
</details>

<details>
<summary><strong>🎭 Pals & PalsHub</strong></summary>

<br/>

Create personalized assistants:
- Assistant Pal β€” pick a default model, set a system prompt (write it yourself or have the app generate one), and customize the chat input color.
- Roleplay Pal β€” everything above, plus location, the AI's role, and other contextual parameters.

Switch personas with the Pal picker on the chat page. Browse PalsHub in-app to discover community Pals, including premium ones via in-app checkout (US iOS & Android).

<img src="assets/images and logos/Pals.png" alt="Assistant Pal" width="100%">
<p><em>Creating a cocktail-recipe assistant</em></p>
</details>

<details>
<summary><strong>πŸ“Š Benchmark your device</strong></summary>

<br/>

1. Open the Benchmark page.
2. Run performance tests to compare speed and efficiency across models.
3. Review tokens/sec and memory usage.
4. Optionally share your results to the AI Phone Leaderboard.

<img src="assets/images and logos/Benchmark.png" alt="Benchmark" width="100%">
</details>

<details>
<summary><strong>πŸ”‘ Set up a Hugging Face token (for gated models)</strong></summary>

<br/>

1. Create an access token in your Hugging Face account (docs).
2. In PocketPal, go to Settings β†’ Set Token, paste it, and save.

<img src="assets/images and logos/Token_in_pocketpal.png" alt="Token setup" width="66%">
</details>

<details>
<summary><strong>πŸ’Œ Send feedback</strong></summary>

<br/>

Go to App Info β†’ "Sharing your thoughts", type your feedback β€” feature requests, suggestions, anything β€” and submit.

<img src="assets/images and logos/Send_Feedback.png" alt="Send feedback" width="50%">
</details>

For developers

PocketPal is a standard React Native app. If you can build a React Native project, you can build PocketPal.

Prerequisites

- Node.js β€” version is pinned in .nvmrc (currently 22.21.0); run nvm use to match it. Older Node will fail the engines check.
- Yarn 1 (Classic) β€” packageManager is pinned to [email protected].
- Xcode + CocoaPods, and Ruby + Bundler (for iOS / Fastlane tooling).
- Android Studio + Android SDK/NDK.

See the React Native environment setup for platform details.

Clone, install & run

bash
git clone https://github.com/a-ghorbani/pocketpal-ai
cd pocketpal-ai

nvm use # match the pinned Node version
yarn install # install JS dependencies
(cd ios && pod install) # iOS only

yarn start # Metro bundler
yarn ios # build + run on iOS simulator
yarn android # build + run on Android emulator

Core on-device chat works without any backend keys; only PalsHub/auth features need additional configuration.

Native-change rule: if you change package.json, a native module, ios/, android/, the Podfile, or build.gradle, re-run pod install and rebuild both platforms β€” a JS reload won't pick up native changes.

Quality gates

bash
yarn lint           # ESLint
yarn typecheck # tsc --noEmit
yarn test # Jest
yarn l10n:validate # validate locale JSON (placeholders, integrity)

Run yarn lint && yarn typecheck && yarn test before opening a PR. Commits are validated by Commitlint (Conventional Commits) via a Husky hook.

<details>
<summary><strong>Repository layout</strong></summary>

<br/>

text
src/
β”œβ”€β”€ screens/ # Chat, Models, Pals, Benchmark, Settings, About, …
β”œβ”€β”€ components/ # Reusable UI
β”œβ”€β”€ store/ # MobX stores (Model, ChatSession, Pal, TTS, HF, Benchmark, …)
β”œβ”€β”€ services/
β”‚ β”œβ”€β”€ agent/ # AgentRunner β€” the chat / tool loop
β”‚ β”œβ”€β”€ talents/ # Tool engines + registries
β”‚ β”œβ”€β”€ tts/ # TTS engines (kokoro, kitten, supertonic, system)
β”‚ β”œβ”€β”€ palshub/ # PalsHub marketplace integration
β”‚ └── downloads/ # Model download manager
β”œβ”€β”€ database/ # WatermelonDB schema, models, migrations
β”œβ”€β”€ repositories/ # Data-access layer over the DB
β”œβ”€β”€ locales/ # i18n JSON + lazy loader (index.ts is the registry)
└── hooks/ api/ theme/ utils/ config/ specs/

</details>

<details>
<summary><strong>Tech stack</strong></summary>

<br/>

Versions are pinned in package.json; the highlights:

| Area | Choice |
| --- | --- |
| Framework | React Native 0.82.1, React 19.1.1 (New Architecture) |
| Language | TypeScript 5.0.4 |
| UI | React Native Paper 5.14.5, React Navigation |
| State | MobX 6 (mobx, mobx-react, mobx-persist-store) |
| Persistence | WatermelonDB (chat history), AsyncStorage (settings), Keychain (secrets) |
| LLM | llama.rn 0.12.4 β†’ llama.cpp Β· GGUF |
| TTS | react-native-speech 2.3.1 + onnxruntime-react-native 1.23.2 Β· ONNX |
| Tooling | Yarn 1 (Classic), ESLint, Prettier, Jest, Husky + Commitlint |

</details>

<details>
<summary><strong>Extending PocketPal</strong></summary>

<br/>

A Talent is a tool the model can call mid-conversation. Engines are registered in a TalentRegistry, exposed to the model as tool schemas; the AgentRunner detects a call, runs the engine, and returns the result for the next turn.

| Talent | Engine | Does |
| --- | --- | --- |
| calculate | CalculateEngine | Arithmetic / expression evaluation |
| datetime | DatetimeEngine | Current date / time |
| render_html | RenderHtmlEngine | Renders model-produced HTML in chat |

Good first contributions:
- A new Talent β€” implement a TalentEngine and register it in src/services/talents/.
- A new TTS engine β€” add it under src/services/tts/engines/.
- A new locale β€” add a JSON file in src/locales/ (or translate on Weblate).

</details>

Contributing

Contributions are welcome β€” bug reports, fixes, features, translations, and docs all help.

1. Fork and branch: git checkout -b feature/your-feature-name
2. Make your changes; run on a device/emulator (yarn ios / yarn android). Re-run pod install + rebuild if you touched native code.
3. Gate locally: yarn lint && yarn typecheck && yarn test
4. Commit with Conventional Commits: git commit -m "feat: add new talent"
5. Push and open a pull request.

Please read the Contributing Guidelines and Code of Conduct first. Want to translate PocketPal into your language? Join us on Weblate.

Roadmap

- Tool use expansion β€” grow the Talents catalog and deepen the agentic loop so Pals can do more, fully on-device.

Have an idea or found a bug? Open an issue or start a discussion.

Community & support

- πŸ’¬ Questions & ideas β€” GitHub Discussions
- πŸ› Bugs & requests β€” GitHub Issues
- 🌐 Website β€” pocketpal.dev
- ❀️ Support development β€” PocketPal is free and ad-free; sponsoring helps keep it that way.

License

Licensed under the MIT License.

Acknowledgements

PocketPal AI stands on the shoulders of the open-source community, including:

- llama.cpp β€” efficient on-device LLM inference.
- llama.rn β€” llama.cpp bindings for React Native.
- react-native-speech β€” React Native TTS bridge powering on-device voices.
- ONNX Runtime β€” cross-platform inference engine powering on-device TTS.
- React Native, MobX, React Native Paper, React Navigation, WatermelonDB, and many other open-source libraries that make this project possible.

<div align="center">
<br/>

Made with ❀️ for people who want AI that stays on their phone.

<br/>

<sub>If PocketPal is useful to you, consider giving it a ⭐ β€” it helps others find the project.</sub>

</div>

---