v3/docs/adr/ADR-304-local-meta-llm-proxy.md
This ADR defines the product: what the proxy does, its data-plane semantics, and its consent gates. The deployable runtime — binary, packaging, bind semantics, platform services, update integrity — is defined in ADR-307.
Many RuFlo users already run local models or use multiple providers. Managing endpoints, API keys, and routing policies individually increases friction.
Cognitum provides Meta LLM orchestration through https://api.cognitum.one. A local proxy can expose a single OpenAI-compatible endpoint while transparently routing requests to the optimal provider — the same tier-routing discipline the repo already applies internally (3-tier model routing, metallm_ask/metallm_delegate gateway delegation, ADR-149 cost-optimal routing).
Offer an optional local proxy during onboarding (ADR-302), on credit exhaustion (ADR-303), and on demand via ruflo proxy install / ruflo proxy enable.
Client (any OpenAI-compatible SDK / ruflo agents)
↓
localhost:11435
↓
Meta Proxy (local process, ruflo-managed)
↓
api.cognitum.one
↓
Claude │ GPT │ Gemini │ DeepSeek │ OpenRouter │ Local Ollama │ vLLM │ SGLang
Local backends (Ollama, vLLM, SGLang) are routed to directly by the local proxy without a cloud round-trip; api.cognitum.one is in the path only for cloud providers and for routing-policy updates.
cognitum-auto)metallm_ask contract)ruflo auth login
obtains credentials for proxy operation.
"Local proxy" is easily read as "local inference." The two must never be conflated:
Default state after ruflo proxy install is local-only. The proxy routes exclusively to local backends (Ollama, vLLM, SGLang). No prompt leaves the machine, and no request is made to api.cognitum.one for inference.
Cloud routing requires a separate explicit step — ruflo proxy config --cloud — gated on the cloud-routing consent domain (ADR-302). Neither enrollment acceptance, auth login, nor proxy installation enables it.
Pre-activation disclosure is mandatory. Before cloud routing turns on, the UI states in plain terms what changes:
Enabling cloud routing.
With cloud routing ON, prompts for cloud-tier requests are sent to
api.cognitum.one and forwarded to the selected provider
(Claude / GPT / Gemini / DeepSeek / OpenRouter).
Requests routed to local backends never leave this machine.
Enable cloud routing? [y/N]
The default answer is No.
Visible at runtime. ruflo proxy status and every request receipt state the data plane used (local vs cloud:<provider>), so the user can verify where any given prompt went.
Cloud routing can be disabled at any time (ruflo proxy config --local-only), reverting to a purely local multi-backend router and revoking the cloud-routing consent receipt.
The repository already carries an internal meta-llm gateway surface (metallm_ask / metallm_delegate, the dev-bridge MCP server). This proxy is related but not the same thing, and the boundary is explicit:
| metallm dev-bridge | ADR-304 proxy | |
|---|---|---|
| Audience | Internal orchestration interface for development of ruflo itself | Supported, customer-facing product |
| Contract | Best-effort, may change with the gateway | Versioned public API (ADR-308) |
| Routing core | Shared (cognitum tier-routing policy family) | Shared |
| Network contract | No implicit dependency in either direction | ADR-308 |
dependencies entry — install is an explicit user action.~/.ruflo/credentials with 0600 permissions; never in project config, never committed (existing @claude-flow/security boundary rules apply).ruflo proxy … — full lifecycle command set (install|start|stop|status|logs|update|uninstall) specified in ADR-307, plus proxy config for routing mode.ruflo doctor gains a proxy health check component (details in ADR-307).