A lightweight Python CLI that connects to a local Ollama server running on an Android phone (Termux) or a computer.
PocketAI lets you use a local Large Language Model (LLM) running on your own device without relying on cloud services. It communicates with Ollama through its REST API and provides a simple, clean command-line chat interface.
- ๐ค Local AI Chat: Converse with LLMs completely offline.
- ๐ฑ Termux Ready: Works seamlessly with Ollama running on Android.
- ๐ป Clean Interface: A minimal and easy-to-use command-line interface.
- ๐ Fully Private: 100% local processing; your data never leaves your network.
- โก API Powered: Communicates efficiently via the Ollama REST API.
- ๐ ๏ธ Built-in Commands: Use
/helpfor guidance and/byeto exit securely.
PocketAI/
โ
โโโ pocketai/
โ โโโ ai.py
โ โโโ main.py
โ
โโโ README.md
โโโ LICENSE
โโโ requirements.txt
โโโ .gitignore
โโโ .gitattributes
- Python 3.13+
- Git
- Requests Library (pip install requests)
- Android Device
- Termux
- Ollama for Android (via Termux)
1. Clone the repository
git clone [https://github.com/kongogaming/PocketAI.git](https://github.com/kongogaming/PocketAI.git)
cd PocketAI
2. Create a virtual environment
python -m venv .venv
3. Activate the virtual environment
- Windows:
.venv\Scripts\activate
- Linux / macOS:
source .venv/bin/activate
4. Install dependencies
pip install -r requirements.txt
Download the latest version from the official GitHub release page or F-Droid.
pkg update && pkg upgrade
Follow the official Ollama Android/Termux installation instructions.
For PocketAI v0.1.0, this project uses gemma3:270m by default:
ollama pull gemma3:270m
(You can replace this with any Ollama-compatible model later).
Start Ollama so other devices on your local Wi-Fi can connect to it.
export OLLAMA_HOST=0.0.0.0:11434
ollama serve
โ ๏ธ Note: Leave this terminal running while you use PocketAI!
On the phone:
curl [http://127.0.0.1:11434](http://127.0.0.1:11434)
From your PC (Browser): Navigate to your phone's IP address on port 11434:
http://PHONE_IP:11434
# Example: [http://192.168.29.142:11434](http://192.168.29.142:11434)
Expected Output: Ollama is running
Open the pocketai/ai.py file in your code editor and set your Ollama server URL to match your phone's IP address:
# pocketai/ai.py
url = "http://YOUR_PHONE_IP:11434/api/generate"
# Example:
# url = "[http://192.168.29.142:11434/api/generate](http://192.168.29.142:11434/api/generate)"Start the CLI application:
python pocketai/main.py
=============================================
POCKET AI
=============================================
Type /help for commands.
You > Hello
AI > Hello! How can I help you today?
You > /help
Commands:
/help - Show available commands
/bye - Exit PocketAI
You > /bye
AI > Goodbye!
| Command | Description |
|---|---|
| /help | Show available commands and help menu |
| /bye | Exit the PocketAI CLI |
PocketAI works with any Ollama model.
- Current Default: gemma3:270m
- Popular Alternatives:
- qwen2.5:3b
- llama3.2
- phi4-mini Browse the Official Ollama Model Library for more options.
PocketAI communicates using the standard Ollama REST API.
- Example Endpoint: POST /api/generate
- Documentation: Ollama API Docs
- Local AI chat
- Modular architecture
- GitHub release
- Configuration file support
- Streaming responses
- Chat history memory
- Model switching in CLI
- Voice support
This project is licensed under the MIT License. See the LICENSE file for more details.
Somya Ranjan Pal (kongogaming)
- GitHub: @kongogaming