OlliteRT:三步將 Android 手機設為本地 LLM 伺服器
OlliteRT: Android LLM Server in 3 Steps
OlliteRT 教學示範如何把 Android 手機設為本地、OpenAI 相容的 LLM 推理伺服器,讓同一區域網絡內的程式透過 HTTP API 呼叫手機上的模型。
TL;DR: This guide shows you how to set up OlliteRT, a free and open-source Android application that runs LLMs directly on your phone. You'll learn to turn an old Android device into a private, OpenAI-compatible AI server for local development and automation.
When you're prototyping AI features or building automation, relying on cloud-based LLMs often means constant API costs, data privacy concerns, and internet dependency. Imagine being able to run a capable LLM entirely offline, with your data never leaving your device. I've found that local-first AI tools, when good enough, are preferable to paid subscriptions, and I even wrote about replacing Cursor with a free local AI coding assistant. For those who want to extend this privacy and control to mobile, OlliteRT offers a compelling solution.
OlliteRT is an Android application that transforms your phone into a fully local, OpenAI-compatible LLM inference server. It leverages Google's LiteRT-LM runtime to run models directly on your mobile device's CPU/GPU, exposing them via a standard HTTP API on your local network. This means any application or script that can talk to the OpenAI API can instead talk to your Android phone, without external API keys or cloud services. It's a game-changer for privacy-focused AI experiments, mobile-first agentic workflows, or integrating AI into local automation where data absolutely needs to stay on-device. If you've been curious about running LLMs on Android, my guide on Llama 3.2 on Android: Run It Locally with Ollama is my most popular article, and OlliteRT takes this concept further by providing an API server.
What You'll Build and What You Need
You'll be setting up an Android device as a dedicated LLM server. This server will host one or more large language models and respond to HTTP requests from other devices on your local network, mimicking the OpenAI API. It's essentially "Ollama for Android".
Here's what you need:
- An Android phone running Android 12 (API 31) or later.
- The device must have an
arm64-v8aarchitecture. Most Android phones from 2017 onwards meet this requirement. - Minimum 6 GB RAM; 8 GB+ recommended, especially for larger or multimodal models like Gemma 4 E4B, which may require 12 GB or more.
- A stable Wi-Fi connection for client devices to access the server.
- (Optional but recommended) ADB (Android Debug Bridge) installed on your development machine for advanced debugging.
OlliteRT works exclusively with .litertlm model files, not GGUF models typically used by llama.cpp-based tools. These .litertlm models are optimized for Google's LiteRT-LM runtime.
Setting up OlliteRT
The setup process is straightforward, focusing on getting the app and a model running.
Download and Install the APK:
Navigate to the official OlliteRT GitHub repository and download the latest APK from the releases section.
Install it on your Android phone. You might need to enable "install from unknown sources" in your Android settings.Download a Model:
Open the OlliteRT app. From within the app, you can download supported models directly from HuggingFace.
Gemma 4 E2B is recommended for most devices (2.4 GB, runs on 8 GB RAM).Start the Server:
Once a model is downloaded and selected, tap the Start Server button on the model card.
The app will display the local IP address and port (e.g.,http://PHONE_IP:8000/v1) that your client applications will use to connect.
Running a Quick Example
After the server starts, you can interact with it using any OpenAI-compatible client. This includes curl, Python's OpenAI SDK, Open WebUI, or even Home Assistant.
First, get your phone's IP address and the server's port from the OlliteRT app's "Status" screen. Let's assume your phone's IP is 192.168.1.100 and the server is on the default port 8000.
Here’s a curl example to send a chat completion request:
curl http://192.168.1.100:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Gemma-4-E2B-it",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain the concept of reactive programming simply."}
],
"max_tokens": 150,
"temperature": 0.7
}'
Replace 192.168.1.100 with your phone's actual IP address and Gemma-4-E2B-it with the name of the model you have loaded.
You can also use the Python openai library:
from openai import OpenAI
# Point to the OlliteRT server
client = OpenAI(
base_url="http://192.168.1.100:8000/v1",
api_key="sk-no-key-required" # A dummy key is fine if auth is not enabled
)
response = client.chat.completions.create(
model="Gemma-4-E2B-it",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"}
],
max_tokens=50,
temperature=0.7
)
print(response.choices[0].message.content)
Ensure that if you've enabled bearer token authentication in OlliteRT's settings, you provide the correct api_key in your client requests.
Common Problems and Limitations
While OlliteRT provides a powerful local LLM server, there are a few things to keep in mind.
- Model Format: As mentioned, OlliteRT exclusively supports
.litertlmmodels. You cannot directly load GGUF models. Advanced users can convert HuggingFace models to.litertlmusing Google'slitert-torchtooling, but this requires a Linux environment and significant RAM (32GB+). - No Chat Interface: OlliteRT is a headless server, meaning it doesn't have its own chat UI. You interact with it programmatically via its HTTP API from another device.
- Performance: While efficient for on-device inference, a phone's hardware is not equivalent to a dedicated GPU server. Expect acceptable latency for conversational AI and text generation, but real-time, heavy-duty tasks (like continuous video analysis) are better suited for dedicated AI hardware.
- Battery and Heat: Running an LLM puts the phone's GPU under load, similar to a demanding game. For continuous use, it's advisable to keep the phone plugged in, remove its case for better heat dissipation, and place it on a cool surface.
- Android Doze: Android's aggressive battery optimizations can kill background processes. To prevent OlliteRT from being killed, you should disable battery optimization for the app in Android settings (App info -> Battery -> Unrestricted). For a truly "always-on" server, some users have implemented external watchdog automation scripts to detect and relaunch OlliteRT if Android Doze kills it.
One honest limitation is that while OlliteRT supports multimodal capabilities and tool calling, these features are model-dependent and can be experimental. Models like Gemma 4 are better suited for these tasks, but sometimes specific integrations (like Claude Code) might push the context window too far, leading to errors or long prefill times.
Sources
- https://github.com/NightMean/OlliteRT
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGQELZjidjXlLgl_tfM_eywxHVOlvguh_ZV9HkMiF_0lVDcJNboL2u-diq_LMwXkBB8aLblZ5AoLTQ4yXMbUjnnc2jkUI6uabxp_7PZ4wpr4XKhd0gRdH9uan4CfPEHpctxe5IlKkccm8xHuCPlsg5Yz_sL_tzoDg==
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGUbQqlbEzg6X6LtdJSr9WLIdPgLNzdvSyLnanDzt-pwm0TevVzEa65-drJb8D0rOB9klTMC7uKr-H-xJOqGKcleRn_QAYQ-vkm9dXbFysBoY1bIOqcDBg65qsf1GWk0HX4=
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEyIeYNl9-M7sbAOM5Czn3zlFqKYjUdeA7JPnhHo2uPR7n3Cq9ssmcH8gjBeAf9D4asyvlMBWbtP2CajnoskUYjE3apL-0FD36SMypNno5qJJLWruXTXYmiG6pVZPCd7JQyRo88oehqtURw2CCD0107x2lycF0y
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH1n0xJKqVEM008oYM--h_iTRNURBQR6SaLB1BsZv32edM07dFaXhLZ9_yZdfYORINQkXU29lp9nDOZGhSraZKiuFCVUKh_Dv2FpcGZxw6el-ChTGFqBBgAwV2UKl8upJ-cSJYxNqn34rCMSGU4bfJ3dZ4NLeGRqqu0EjV1EA4yZNb_5A==
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHtwNYCnyfTvT2_N9R3Sktd_qb9oKDGIz1RzLUuNTU_w0U0FC0DVLs4q29E6GSMae8NvZSNFZ4IPRiizNkwQETHiEMWco9Ns0SSu3fGIXWnOzoRvlqYUCuJarLv3BCgXewMUAxeVrp-7Exn5jShnhcYkG57j1HA1n2eRXBMKQlZ
Written by **Kamal Kishor* (@koolkamalkishor) — Sr. Frontend Developer building AI agents (React, TypeScript, LangChain). LinkedIn · GitHub · Portfolio*
Published: 25 Nov 2026. This article was generated with AI (Google Gemini + web search). Please check important details against the sources above.
來源:DEV Community · dev.to