Edge Router

Skill-based LLM routing on NVIDIA Jetson Orin Nano. Runs local Ollama first, escalates to the best cloud provider when confidence is low.

1

Query arrives at api.pazlabs.io

The chat UI POSTs to the public API endpoint with the user's query and a session ID.

2

Cloudflare Tunnel forwards to Jetson :8000

A persistent Cloudflare tunnel proxies the request to the edge-router FastAPI service running on the local Jetson at port 8000 — no port-forwarding needed.

3

edge-router sends query to local Ollama

The router forwards the query to the local Ollama instance running gemma2 or llama3.2. No cloud API keys used at this stage.

4

Confidence scorer evaluates response quality

The response is passed through a lightweight scorer that estimates how confident and complete the local answer is. Scores below the threshold trigger cloud escalation.

5a

Confidence ≥ 0.7 → return local answer

If the local model scores well, the answer is returned immediately with metadata: model_used, source: "local", tokens, latency_ms.

5b

Confidence < 0.7 → classify skill, route to cloud

A skill classifier determines the query type and selects the most capable model:

coding→🟣 Claude Sonnet
math / data→🔵 Gemini Pro
current events→🟡 Grok
general→🟢 GPT-4o
6

Response returned with full metadata

Every response includes: answer, model_used, source, skill, confidence_score, latency_ms, and tokens (input/output/total). The chat UI logs this to Firestore.

tripBuddy sends its Plan chat requests to a separate, additive trip-planning endpoint here. It routes local first (qwen2.5:7b on Ollama) and escalates to Gemini or Grok only under daily caps; expense messages are forced local. The chat path above is unchanged. tripBuddy architecture →

FastAPIOllamaDockerCloudflare TunnelPythonNVIDIA Jetson Orin NanoClaude APIGemini APIGrok APIOpenAI API
github.com/jeffpaz/edge-router