How to Run Your Own AI Agent on Android for Free
July 10, 2026 · 15 min read
What You'll Build
A fully functional AI automation system running on your Android phone, including Codex (AI coding agent), 9Router (AI provider router), and Chrome automation.
What You Need
- An Android phone (any version that supports Termux)
- At least 4GB free storage
- WiFi or mobile data connection
- 20 minutes of setup time
Step 1: Install Termux
Download Termux from F-Droid (recommended) or GitHub releases. Then update packages:
pkg update && pkg upgrade -y
Install basic dependencies:
pkg install curl git python nodejs -y
Step 2: Set Up 9Router
9Router gives you access to 18+ AI providers through a single API endpoint. Install it with one command:
curl -sL https://9router.com/install.sh | bash
Once installed, 9Router runs on http://localhost:20128 and you can start connecting providers like Groq, Cloudflare AI, Gemini, and OpenRouter.
Step 3: Connect Free AI Models
9Router supports many free tiers. Get API keys from Groq, Cloudflare AI, and Gemini, then add them in the 9Router dashboard. Test with:
curl http://localhost:20128/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"groq/llama-3.3-70b-versatile","messages":[{"role":"user","content":"Hello!"}],"max_tokens":20}' Step 4: Install Codex
Codex is OpenAI's open-source AI coding agent. It works with any OpenAI-compatible API, including 9Router:
npm install -g @openai/codex
Configure it to use 9Router as the provider and you have a powerful AI coding assistant running entirely on your phone.
Step 5: Add Browser Automation
Install Chromium for headless browser control:
pkg install chromium
This lets your AI agent browse websites, take screenshots, fill forms, and interact with web pages automatically.
What It Costs vs SaaS
The same AI capabilities would cost hundreds per month from SaaS providers:
- ChatGPT Pro: $200/month
- Claude Pro: $20/month
- GitHub Copilot: $10/month
- Browser automation tools: $50-100/month
- Self-hosted with open-source: $0/month
The only ongoing cost is optional VPS hosting (~$6/month via DigitalOcean or Linode) if you want 24/7 uptime without keeping your phone on.
Next Steps
- Read about Open-Source AI vs SaaS — how this compares to paid options
- Check our 9Router Review for a deep dive into all supported providers
- Explore the Tools page for more open-source AI software