All projects
Mobile2026Beta

Sage

A native Android AI assistant that talks to local or cloud models through any OpenAI-compatible endpoint.

Role

Solo developer — Flutter app, AI integration, and native platform work

Built with

  • Flutter
  • Dart
  • openai_dart
  • Tavily
  • SharedPreferences
Sage Android AI chat app connected to a local LM Studio endpoint
  • Android Platform
  • Any OpenAI-compatible Endpoints
  • Automatic Model discovery
  • Extensible registry Tools

The Problem

What needed to be solved

Chat apps that lock you into one provider are cheap to build and annoying to use. Local models are genuinely capable now, but every app assumes a specific endpoint, a specific key, and a specific list of models — and none of them let you actually run the model on your own machine without giving up the interface you like.

Context

Why it was built this way

I wanted an assistant I could point at LM Studio running on my own hardware, talk to, and keep on my phone — with the same quality of chat UI as a commercial app. That meant solving endpoint discovery, streaming, and tool-calling in a mobile client, which is a different problem from the web.

Approach

How I built it

  1. 01

    Talk to every backend through the OpenAI-compatible protocol, so LM Studio, Ollama, OpenAI, Groq, and anything else work by changing one endpoint profile.

  2. 02

    Discover available models automatically from the endpoint rather than hardcoding a list, so a newly loaded local model just shows up.

  3. 03

    Support both keyed and keyless endpoints — local servers usually need no key at all, which is a detail most integrations get wrong.

  4. 04

    Stream responses over SSE with a pulsing indicator, and allow cancelling generation mid-response.

  5. 05

    Render markdown line by line — code blocks, headings, lists, and tables — so long responses stay readable rather than arriving as a wall of plain text.

  6. 06

    Support image input from camera or gallery for vision-capable models.

  7. 07

    Make tools a one-file plugin: adding a tool registers it for the system prompt and the API call automatically, with no other wiring.

  8. 08

    Save a library of system prompts with an active selection, so the assistant's persona is switchable rather than hardcoded.

My role

What I was responsible for

  • Built the entire Flutter application — chat, settings, endpoint management, prompt management, and tools screens.

  • Implemented the streaming chat pipeline with cancel-mid-generation support and copy and regenerate actions.

  • Built the endpoint profile system with model auto-discovery and optional API keys.

  • Implemented function calling with a registry-based tool service, including web search via Tavily and current date and time awareness.

  • Built the markdown renderer with code block support and the custom SVG icon system.

  • Implemented conversation persistence with date-based grouping, message previews, and export through the system share sheet.

  • Built the Cupertino-styled UI with Geist typography, light and dark themes with persistence, and native haptic feedback.

  • Set up separate debug and release package names so both can be installed on the same device.

Challenges

The hard parts

One API surface across very different backends

Local and hosted endpoints differ in streaming format, tool support, and model listing. The OpenAI-compatible protocol is the common denominator, but the client still has to degrade gracefully when a local server does not implement a capability.

Streaming that stays responsive on mobile

Token-by-token rendering on a phone has to stay smooth while the user scrolls, reads, or cancels. Rendering markdown line by line rather than re-parsing the whole message on every token is what keeps it from stuttering.

Function calling that stays out of the way

Tools have to be registered with the model, executed, and fed back without every new tool requiring changes in three places. A single registry file handles the whole loop.

Decisions

Key technical calls I made

OpenAI-compatible protocol as the only abstraction

Instead of writing a native client per provider, one protocol covers every backend. A new provider is a new endpoint profile, not a new code path.

Registry-based tool system

Adding a tool means adding one Tool.function() and its execution logic. The system prompt and API calls pick it up automatically, so tool growth does not create coupling.

SharedPreferences for persistence

A personal assistant's data is conversations, prompts, and endpoint profiles — all small and local. SharedPreferences keeps everything on device, which is the point of a local-first assistant.

Custom SVG icons over an icon package

A consistent icon system across a Cupertino-styled interface is easier to control as project-owned SVG assets than as a themed icon font.

Gallery

Project in practice

Outcome

Where it landed

Sage is a working Android app that streams chat from local or cloud models, handles vision input, runs tools, and keeps its data on the device. It is my mobile counterpart to the web work — a demonstration that the same architectural thinking applies when the client is a phone rather than a browser, and that privacy and capability are not in conflict when the protocol is designed for it.

The source for this project is private. I'm happy to walk you through the architecture, the decisions behind it, and what I would do differently — get in touch and we'll set something up.

Stack

Built with

FlutterDartopenai_dartTavilySharedPreferences

Keep reading