cd /news/artificial-intelligence/apps-ask-for-a-use-not-a-model-insid… · home › topics › artificial-intelligence › article
[ARTICLE · art-178072] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Apps ask for a use, not a model: inside the AI Hub of our self-hosted app store

A developer built an AI Hub for a self-hosted app store that centralizes model access behind a single front door, so no app holds an API key or picks a model. Apps request abstract "uses" (smart, fast, local, coder, hear, transcribe, listen, speak, music) that the owner maps to models once, with callers arriving through four doors: apps, agents via MCP, OpenAI-style endpoints, and people. The hub runs Ollama, cloud APIs, and on-device speech engines under one memory budget on a 24 GB Mac, and the developer notes Ollama's default 4,096-token context silently truncates chats, so the hub now requests 16k context per request.

recommendation

Centralize model selection behind a use-based hub so apps never hold keys, and set Ollama's context to 16k per request to avoid silent prompt truncation.

more in playbook: Designing agent systems
by read7 min views8 publishedNov 29, 2026

Every app wants AI now, and each one arrives with its own model, its own API key and its own settings. In our self-hosted app store, three apps (a video editor, an English-practice chat and a music studio) had each loaded their own copy of Whisper, and every new AI feature started with the same question: which key goes where?

So we went the other way: no app holds an AI key, and no app picks a model. Every app and every agent goes through one front door, the AI Hub, and the owner decides there which model answers, what an AI may do, and what is kept on record.

This post walks through how it's built: the doors, the "use" abstraction, the tool layer with a human in the loop, the engines that run on the Mac's GPU and Neural Engine, and the single memory budget that keeps it all on one 24 GB Mac. There's an 8-minute video too, recorded live on the real apps:

smart, fast, local, coder, hear, transcribe, listen, speak, music), never a model. The owner maps each use to a model once, for every app.read, write or danger. A A few numbers from the research behind the video:

And the hopeful one: when a company offers a managed way in, people take it. The share of AI users on personal accounts fell from 78% to 47% in a year (same Netskope report). Banning AI doesn't work. Giving it one governed door does.

Four kinds of callers come in through four doors:

Door Who uses it Endpoint
Apps every app in the store, through the shared library reflex_ddns_auth.ai /api/ai/*
Agents Claude Code, Codex, Cursor, your own MCP client /api/mcp (Streamable HTTP)
OpenAI-style anything you can point at a base URL /api/v1/*
People the assistant inside any app, and a talking AI pages of the hub

Behind the doors the hub keeps four things: the uses and the models they map to, the tools of every installed app, the records, and the memory budget. Below it are the places answers are actually made: Ollama on the same machine, cloud APIs with your own key, the hub's own speech models, and engines on the Mac itself.

This is the idea everything else hangs on. An app never says "Claude Opus" or "qwen2.5:7b". It says what kind of help it needs:

from reflex_ddns_auth import ai

ai.uses(app,
        smart="The assistant panel's answers",
        coder="Writing or fixing a cell (⌘I)",
        fast="The grey suggestions while typing")

reply = ai.stream("coder",
                  system="You edit one cell of a notebook...",
                  messages=[{"role": "user", "content": "..."}],
                  user="someone@example.com")
async for piece in reply:      # the answer as it is written
    ...
reply.model                    # e.g. "Claude (claude-opus-5-5)", for the app's badge

On the hub's Uses page the owner decides, once for every app, which model answers each use, plus a backup for chat uses and an override for a single app if needed:

A few things fall out of this almost for free:

ai.uses() show up on the hub's page, so the owner sees "Captions from what is said in a project's videos" instead of an opaque API key.reply.model names it. An answer that fails halfway fails; it isn't silently stitched together from two models. The hub reaches models through Anthropic's SDK, Ollama's own chat API, or any OpenAI-style source (OpenAI, OpenRouter, Gemini, Groq, DeepSeek, LM Studio, llama.cpp). Adding a source is a form on a page: a name, an address and a key.

One gotcha worth sharing: Ollama's default context is 4,096 tokens, and it silently drops the start of the chat when you go over. With an app's guide and tool schemas in the prompt, that left almost no room. The hub now asks Ollama for a 16k context on every request.

Apps don't only use AI; they also lend their abilities to it. A tool is one decorator on a function in the app:

from reflex_ddns_auth.tools import tool
from reflex_ddns_auth import rooms

@tool(app, "cad.run_preview", kind="write", params={"room": "The room."})
async def run_preview(ctx, room: str = "default") -> dict:
    """Builds the room's model and shows it in every tab of the room."""
    async with rooms.change(CadState, room) as cad:   # everyone in the room sees the change
        ...
    return {"ok": True}

The app serves /_ddns_tool/manifest and /_ddns_tool/call/<name>, and the hub discovers it through the platform. When you install a new app, its tools simply show up. Agents connect once:

claude mcp add --transport http apps https://ai.reflex-ddns.com/api/mcp \
  --header "Authorization: Bearer <token>"

Each agent gets its own token, named after whoever will use it, and that name is how the AI shows up inside the apps. For everything else there's an OpenAI-compatible door where the "model" is just a use:

curl https://ai.reflex-ddns.com/api/v1/chat/completions \
  -H "Authorization: Bearer <token>" -H "Content-Type: application/json" \
  -d '{"model": "fast", "messages": [{"role": "user", "content": "Say hello."}]}'

kind is part of the tool's definition: read, write or danger (it also goes out to agents as MCP tool annotations). A danger tool is anything that deletes or replaces someone's work. When a model calls one, the hub doesn't forward the call. It shows the person what would happen and waits:

Accept, Accept all in this chat or Reject. Four minutes without an answer counts as no. A rejected change never reaches the app. The important part is where this lives: in the hub, keyed on the tool's declared kind. It's not an instruction in a system prompt that a clever prompt injection could argue with.

An app can also ask for consent in the middle of a call, for something it only learns at run time (ask_first(ctx, "read the chip's sources")). The hub then shows Allow / Decline, and on Allow it calls again with the person's consent signed into that one call's token.

And because "the AI tried to delete everything and I said no" is exactly what you want to find a week later, every tool call lands in a hash-chained history with the person's answer. I wrote a whole post about that part: My AI agents now leave a receipt.

Everything in the store runs in Docker. On a Mac that means Linux in a VM, with no access to the GPU or the Neural Engine. For chat that's fine (Ollama runs natively on the host anyway). For speech it wasn't: Whisper large-v3-turbo took about 4 seconds per piece of live microphone on the CPU.

So models that need the machine's own chips run as engines of one small helper on the host (a LaunchAgent on 127.0.0.1:3144, Python standard library only). The hub relays to it the same way it relays chat to Ollama, and the app never knows where its answer was made. Every engine shares one contract: a card that describes it, install, start, stop, settings, and work in one of three shapes:

Shape What it is Example
ask answered at once a piece of a microphone to words
job reports progress, leaves files a song from ACE-Step
stream fed pieces as they come, answers as it goes subtitles while someone is still speaking

The streams don't use WebSockets. Each piece of audio is one small POST on a kept-alive connection, answered with whatever the model has so far. That keeps the helper standard-library-only and adds about 0.1 s end to end, from the app's backend through the hub and the helper.

What we measured on an M4 Pro:

Docker's VM, Ollama's loaded models and the engines all eat the same RAM, and only the hub can see all three. So the hub keeps the budget:

AI may hold the machine's memory, minus Docker's allowance, minus 4 GB for the owner's own programs. Before a model that isn't in memory gets asked, idle holders leave, the one used longest ago first, and a busy one never does. On a 24 GB Mac with an Ollama model and the speech model loaded, the music engine took 73 s to start; with the hub clearing room first, 42 s.

If you know LLM gateways like LiteLLM, the routing part will look familiar. What the hub adds is the other half: the apps' tools behind one MCP address with approvals, the speech and music engines on the host's own chips, and one memory budget across all of it.

I'd love to hear how others handle this:

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @ollama 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/apps-ask-for-a-use-n…] indexed:0 read:7min 2026-11-29 · —