Skip to content

kongogaming/PocketAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ฑ PocketAI

A lightweight Python CLI that connects to a local Ollama server running on an Android phone (Termux) or a computer.

Python License: MIT Version

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.


โœจ Features

  • ๐Ÿค– 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 /help for guidance and /bye to exit securely.

๐Ÿ“‚ Project Structure

PocketAI/
โ”‚
โ”œโ”€โ”€ pocketai/
โ”‚   โ”œโ”€โ”€ ai.py
โ”‚   โ””โ”€โ”€ main.py
โ”‚
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ .gitignore
โ””โ”€โ”€ .gitattributes

โš™๏ธ Requirements

๐Ÿ’ป PC

  • Python 3.13+
  • Git
  • Requests Library (pip install requests)

๐Ÿ“ฑ Phone

  • Android Device
  • Termux
  • Ollama for Android (via Termux)

๐Ÿš€ Installing PocketAI (PC)

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

๐Ÿ“ฑ Setting up Ollama on Android (Termux)

1. Install Termux

Download the latest version from the official GitHub release page or F-Droid.

2. Update packages

pkg update && pkg upgrade

3. Install Ollama

Follow the official Ollama Android/Termux installation instructions.

4. Download a model

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).

5. Allow network access

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!

6. Verify the Connection

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

๐Ÿ› ๏ธ Configure PocketAI

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)"

๐ŸŽฎ Run PocketAI

Start the CLI application:

python pocketai/main.py

๐Ÿ–ฅ๏ธ Example Output

=============================================
               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!

โŒจ๏ธ Commands

Command Description
/help Show available commands and help menu
/bye Exit the PocketAI CLI

๐Ÿง  Models

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.

๐Ÿ”— Ollama API

PocketAI communicates using the standard Ollama REST API.

  • Example Endpoint: POST /api/generate
  • Documentation: Ollama API Docs

๐Ÿ—บ๏ธ Roadmap

  • Local AI chat
  • Modular architecture
  • GitHub release
  • Configuration file support
  • Streaming responses
  • Chat history memory
  • Model switching in CLI
  • Voice support

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for more details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Somya Ranjan Pal (kongogaming)

  • GitHub: @kongogaming

About

A lightweight Python CLI that connects to a local Ollama server running on a phone or computer.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages