How to Run Your Own AI Agent on Android for Free

July 10, 2026 · 15 min read

Some links below are affiliate links. I may earn a commission at no extra cost to you. All tools mentioned are open-source and free to use.

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

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:

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

I'm committed to transparency. Some links on this page are affiliate links. If you make a purchase through them, I may earn a commission at no extra cost to you. All tools and software recommended here are free and open-source unless otherwise noted.