Running large language models directly on a phone or tablet is one of the hardest optimization problems in modern mobile engineering. Memory budgets are measured in megabytes, not gigabytes, and thermal throttling can kill throughput in seconds. Most production mobile apps do not run 70B parameter models on device. Instead, they use a hybrid architecture: a small local model handles offline queries and sensitive preprocessing, while a remote inference backend handles complex reasoning, long context, and multimodal tasks. This is where Oxlo.ai becomes a natural fit. With flat per-request pricing, full OpenAI SDK compatibility, and a broad catalog of models ranging from coding specialists to vision architectures, Oxlo.ai gives mobile developers a backend that scales without the token-counting complexity typical of other providers.
Choose Your Deployment Strategy
Before you write any client code, decide whether your app will infer entirely on device, entirely in the cloud, or use a hybrid split. Pure edge inference keeps data local and works offline, but it limits you to models small enough to fit inside a mobile SoC's RAM and thermal envelope, typically sub-4GB quantized checkpoints. Pure cloud inference offloads all compute to a backend, letting you run state-of-the-art models like DeepSeek R1 671B MoE or Llama 3.3 70B, but it requires connectivity. A hybrid approach caches a tiny model locally for low-latency autocomplete or offline fallbacks, then routes hard queries to a remote endpoint.
If you choose cloud or hybrid, Oxlo.ai is a drop-in backend. Its API lives at https://api.oxlo.ai/v1 and accepts the exact same JSON schema as the OpenAI chat completions endpoint, so you can reuse existing mobile networking layers with only a base URL change.
Select a Model That Fits Mobile Constraints
For on-device inference, you generally need to stay inside the 1B to 8B parameter class after aggressive quantization. Even efficient architectures like Gemma 3 27B, hosted on Oxlo.ai, remain far too large for current smartphone NPUs and application processors. That size constraint means on-device models are good for classification, short summarization, or intent parsing, but they struggle with multi-turn reasoning, long-context document analysis, or agentic tool use.
When you need heavier capability, routing the request to Oxlo.ai lets you select from 45+ models across seven categories. For example, you can send vision requests to Kimi K2.6, coding tasks to Qwen 3 Coder 30B, or general reasoning to Llama 3.3 70B, all from the same mobile client. You are not locked into a single model that must compromise between size and capability.
Optimize the Model for Edge Compute
If you are running a model locally, you must quantize and convert it to a mobile-optimized runtime. The standard pipeline looks like this:
- Export to ONNX. Start with a PyTorch checkpoint and trace it into ONNX opset 17 or newer. This gives you a standardized graph that tools like ONNX Runtime Mobile or Qualcomm QNN can consume.
- Quantize weights. Run dynamic or static quantization to INT8, or use block-wise INT4 via GPTQ or AWQ. INT4 reduces model size by roughly 75%, though it can degrade reasoning quality on smaller architectures.
- Convert to platform-specific formats. On iOS, pass the ONNX graph through Core ML Tools and target the ML Program format with float16 precision. On Android, use the ONNX Runtime Mobile package with NNAPI or the Qualcomm QNN execution provider to leverage the NPU.
- Validate numerics. Run a parity check between the original float32 model and the quantized mobile artifact on a held-out prompt set. Mobile quantization errors often surface as repetitive token generation or sudden perplexity spikes.
Remember that on-device inference is not free. It drains battery and warms the chassis. For anything beyond lightweight classification, the energy cost often favors a single network round-trip to Oxlo.ai over minutes of sustained GPU compute on the phone.
Build the Mobile Client and API Layer
Whether you are building for Android or iOS, calling Oxlo.ai is identical to calling any OpenAI-compatible endpoint. You do not need a special SDK. A standard HTTP client and JSON serializer are sufficient.
On Android with Kotlin and Retrofit, define the request shapes and interface:
data class Message(val role: String, val content: String)
data class ChatRequest(
val model: String,
val messages: List<Message>,
val stream: Boolean = false
)
interface ChatService {
@POST("chat/completions")
suspend fun chat(
@Body request: ChatRequest,
@Header("Authorization") auth: String
): Response<ChatResponse>
}
val retrofit = Retrofit.Builder()
.baseUrl("https://api.oxlo.ai/v1/")
.addConverterFactory(GsonConverterFactory.create())
.build()
val oxlo.ai = retrofit.create(ChatService::class.java)
val response = oxlo.ai.chat(
ChatRequest(
model = "llama-3.3-70b",
messages = listOf(Message("user", "Summarize this meeting transcript."))
),
auth = "Bearer $OXLO_API_KEY"
)
On iOS with Swift and URLSession, the equivalent call looks like this:
let url = URL(string: "https://api.oxlo.ai/v1/chat/completions")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("Bearer \(oxloKey)", forHTTPHeaderField: "Authorization")
let body: [String: Any] = [
"model": "deepseek-r1-671b",
"messages": [
["role": "user", "content": "Refactor this Swift function for concurrency."]
],
"stream": false
]
request.httpBody = try? JSONSerialization.data(withJSONObject: body)
let (data, _) = try await URLSession.shared.data(for: request)
let json = try JSONSerialization.jsonObject(with: data) as? [String: Any]
Because Oxlo.ai offers no cold starts on popular models, the first request after an idle period returns as quickly as a warmed-up one. That predictability matters on mobile, where users expect instant feedback after tapping a send button.
Implement Streaming and Error Handling
Mobile networks are lossy and high-latency. Blocking the UI while waiting for a full response body is not acceptable. Oxlo.ai supports streaming responses via server-sent events (SSE), so you can render tokens as they arrive.
When stream: true is set, the response content-type becomes text/event-stream. Your client should read lines prefixed with data:, strip the prefix, and parse each line as JSON. On Android, you can use OkHttp's ResponseBody as a source and read lines in a coroutine. On iOS, use URLSession.DataTask with a custom delegate to process chunks as they stream in.
You should also handle three specific failure modes:
- Network drops mid-generation. Maintain a local message buffer so you can retry the request from the last successful chunk or prompt the user to retry.
- Out-of-memory kills. On older devices, aggressive image preprocessing before sending to a vision model can exhaust RAM. Resize images to 512px or 1024px on the longest edge before base64 encoding them.
- Token vs. request budget exhaustion. If you are prototyping against a provider with token-based pricing, a user pasting a long document can unexpectedly exhaust a daily quota. Oxlo.ai's request-based pricing removes that variable. One API call costs the same regardless of prompt length, which makes mobile budgeting straightforward.
Control Costs with Predictable Pricing
Mobile apps have spiky traffic. A user might send ten short messages in one session, then paste a 10,000-character PDF in the next. With token-based billing, that second interaction could cost an order of magnitude more than the first. Oxlo.ai uses flat per-request pricing, so your cost per API call does not scale with input length. That predictability is useful when you are building offline-first apps that sync large buffers to the cloud, or when you are running agentic workflows that append long tool contexts to every turn.
Oxlo.ai also offers a free tier with 60 requests per day across 16+ models, which is enough to validate a mobile integration before you ship to beta. When you are ready to scale, the Pro and Premium plans provide fixed daily request allotments. See the exact tiers at https://oxlo.ai/pricing.
Conclusion
Deploying LLMs on mobile devices is really a question of architecture, not just model weights. A small quantized network on the phone can cover offline niches, but production-grade reasoning, vision, and coding assistance still belong on a capable backend. Oxlo.ai fills that role with an OpenAI-compatible API, flat per-request pricing, and a catalog that spans everything from lightweight embeddings to 671B parameter MoEs. If you are building a mobile app that needs more intelligence than the edge can provide, point your HTTP client to https://api.oxlo.ai/v1 and treat inference as just another API call.
Top comments (0)