Developer
Local OpenAI API on your phone.
PocketLLM Lite can run an authenticated OpenAI-compatible HTTP server inside the Android app, letting other apps or tools on the same phone share one loaded model.
Supported OpenAI-compatible endpoints
In lib/services/openai_server_service.dart, the embedded server exposes three standard endpoints for your active model and RAG embedding setup:
GET /v1/models— lists available models configured in the app.POST /v1/chat/completions— supports standard JSON responses and Server-Sent Events (stream: true).POST /v1/embeddings— serves embeddings when a compatible embedding path is available.
Guards built into the HTTP listener
Local development servers on phones are often left wide open. PocketLLM Lite enforces five controls by default:
- Bearer token required: every API call must carry the generated bearer key stored in Android secure storage.
- Loopback-only binding & Host check: when
localhostOnlyis enabled, only loopbackHostnames are accepted, blocking DNS-rebinding attacks from web pages. - Exact browser Origin allowlist: requests from a browser carrying an
Originheader are rejected with HTTP403unless that exactscheme://host[:port]origin is explicitly allow-listed (with no wildcards). - Concurrency and timeout caps: default concurrency is capped at 2 concurrent requests with a 5-minute request idle timeout and 30-second body timeout.
Example loopback call (Termux or local script)
curl http://127.0.0.1:8080/v1/chat/completions \
-H "Authorization: Bearer YOUR_APP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-0.6b",
"messages": [{"role": "user", "content": "Summarize in one sentence."}]
}'Keep the server in loopback mode unless you are on a trusted private LAN behind a firewall and understand that there is no TLS layer.
If you try it on your phone, open a GitHub issue or discussion with the model and device you ran — real hardware reports help everyone.
Sources
Ready when you are. Run your own local endpoint.
Authenticated loopback API built into the Android app, with zero cloud dependency.
Latest v1.0.61Android 7.0+Install guide & all builds