How can a local LLM use encrypted cloud overflow?

Define which requests can leave the machine before enabling overflow. Confidential inference can help with approved data, while a local-only category must stay local even during an outage.

Use local inference first and permit cloud overflow only for requests explicitly approved to leave the device. Enforce two gates: your application authorizes remote processing, and the hosted request requires provider.min_privacy: "confidential"; failure at either gate stops remote inference.

Classify the complete request before scheduling it

Define three categories: local only, approved for confidential remote inference, and public. Assign the category through trusted application policy before placing a job in the queue. Do not let the model or text inside a document decide whether it may be uploaded. An unknown category should be rejected rather than treated as public.

Classify everything the request will contain: system instructions, conversation history, retrieved passages and tool results. A public question can become a private request after your application adds an internal document. Recheck approval when that content changes, especially in a tool loop that discovers new information after its first call.

Job category Local capacity available Local queue full
Local only Run locally Wait or return a local-capacity error
Confidential remote approved Run locally Try an eligible confidential route
Public Run locally Use the same confidential route in this design
Unknown Reject classification Reject classification

Use a deliberate queue threshold rather than interpreting every exception as permission to upload. For example, you might overflow approved jobs when two local slots are already occupied. Set that two-slot threshold in your application. On one local GPU, agents share its throughput, and requests beyond its parallel capacity wait in line when those slots are occupied. A malformed prompt, missing local model or authentication error should remain visible as an error.

Require the documented privacy floor

TrustedRouter's provider-routing guide defines min_privacy as a hard filter. Its confidential value requires verified provider-side confidential compute, end-to-end encryption and explicit zero data retention on the same route. Unsupported combinations fail closed. Require all three properties on the selected route.

The provider.only field restricts requests to an allowlist; provider.order is a preference while fallbacks are enabled. Set provider.allow_fallbacks: false to stop after the first candidate. If your approval names a particular operator, add its catalog slug to only. Do not substitute data_collection: "deny" for the hard privacy floor.

The ordinary API base URL is https://api.trustedrouter.com/v1. The dedicated confidential hostname, https://api.confidential.trustedrouter.com/v1, adds another guard and still requires the explicit confidential value. The example below uses the ordinary endpoint with that hard filter. Review gateway verification and data handling before approving your deployment; an ordinary HTTPS client does not itself verify gateway attestation.

Keep the same chat shape on both branches

Ollama documents its local OpenAI-compatible base at http://localhost:11434/v1. Both branches below send model and messages to /chat/completions and read choices[0].message.content. The sketch uses Python's standard library and runs on macOS or Linux with a local Ollama model already installed.

Set LOCAL_MODEL to an installed local-weight model, TR_OVERFLOW_MODEL to the hosted model approved in your route review, and TRUSTEDROUTER_API_KEY to your key. The scheduler supplies local_busy and the policy supplies category; neither comes from user-controlled prompt text.

import json
import os
import urllib.request

class NoRedirects(urllib.request.HTTPRedirectHandler):
    def redirect_request(self, req, fp, code, msg, headers, newurl):
        raise RuntimeError("Redirect refused")

http = urllib.request.build_opener(
    urllib.request.ProxyHandler({}), NoRedirects()
)

def post(base, payload, key=None):
    headers = {"Content-Type": "application/json"}
    if key:
        headers["Authorization"] = "Bearer " + key
    request = urllib.request.Request(
        base + "/chat/completions",
        data=json.dumps(payload).encode("utf-8"),
        headers=headers,
        method="POST",
    )
    with http.open(request, timeout=60) as response:
        return json.load(response)["choices"][0]["message"]["content"]

def answer(messages, category, local_busy=False):
    if category not in {"local_only", "confidential_approved", "public"}:
        raise ValueError("Unknown data category")
    if not local_busy:
        return post("http://localhost:11434/v1", {
            "model": os.environ["LOCAL_MODEL"],
            "messages": messages,
            "stream": False,
        })
    if category == "local_only":
        raise RuntimeError("Local capacity unavailable; keep queued")
    return post("https://api.trustedrouter.com/v1", {
        "model": os.environ["TR_OVERFLOW_MODEL"],
        "messages": messages,
        "stream": False,
        "provider": {
            "min_privacy": "confidential",
            "allow_fallbacks": False,
        },
    }, os.environ["TRUSTEDROUTER_API_KEY"])

This sketch refuses redirects, bypasses environment proxy settings and has no retry path that can choose another destination. Its 60-second socket timeout bounds individual blocking socket operations; manage the overall job deadline in your scheduler. HTTP errors propagate to the caller. In production, add bounded queues, cancellation, admission limits and metadata-only routing logs around this function.

Select an Ollama model that runs locally: the local server can also access Ollama cloud models. Verify your local-only branch with networking disconnected. Hosted and local model identifiers can differ even when they refer to the same upstream family.

Try it on your workload

Create three fictional jobs, one per category, with unique identifiers and no sensitive content. Run all three with local capacity available. Then simulate a full queue. Confirm that the local-only job produces no remote request, while approved and public jobs send the hard confidential filter.

Simulate a remote rejection because no route qualifies, an unavailable provider, a redirect and an unknown category. Each should stop without an ordinary-provider retry. In a test harness, replace post with a recorder that stores destination and routing fields, not message content. Then perform one approved live smoke test and inspect its result.

Record job ID, policy version, destination, model, status and elapsed time. Keep prompt bodies out of routing logs. If you replace this HTTP helper with an SDK, inspect its retry configuration and rerun the failure tests.

How to decide

Enable overflow only when policy classification is reliable, the eligible route meets your requirements and the failure tests pass. Keep local-only jobs queued during outages. When confidential capacity is unavailable, return a clear unavailable result rather than widening the provider set or lowering the privacy floor.

Budget twelve overflow agents at about 6 cents

Twelve overflow agents working on qwen/qwen3.6-35b-a3b cost about 6 cents in tokens at TrustedRouter's catalog rates. For this illustrative workload, each uses 50,000 input and 10,000 output tokens. On 2026-11-22, catalog prices rounded to $0.0422 per million input and $0.317 per million output tokens. Input = 12 × 50,000 = 600,000; output = 12 × 10,000 = 120,000. Cost = 0.6 × $0.0422 + 0.12 × $0.317 = $0.06336, about 6 cents.

On one local GPU, those agents share its throughput, and requests beyond its parallel capacity wait in line; through a per-token API they can run at the same time, with the same token bill as running them one after another. Dispatch only approved jobs, retain the confidential filter and keep local-only jobs queued. The catalog calculation does not establish confidential eligibility or the selected route's price.

Prices change; check current model endpoints, agent setup and confidential API requirements. Substitute the approved endpoint's rates before budgeting production overflow. Local remains better for steady work that already meets your needs and for requests whose data must stay on the device.

Sources

Related local LLM decisions