AI Router 

One OpenAI-compatible endpoint in front of many AI providers.

Open ai.pseo.cloud(opens in a new tab)Private repository; walkthrough on request
Status
Checking whether AI Router answers
Access
Overview + sign-in
Runs on
My server, through a Cloudflare tunnel
Year
2026
Area
AI, Tools
AI Router, screenshot of the live app

A self-hosted gateway that routes chat, embeddings, images, speech and more across mostly free-tier providers. Point the standard openai SDK at it, ask for model "auto", and it picks a healthy, well-scoring model and fails over before you notice. It serves 5 of my live projects.

live projects routed through it
5
automated tests
342
hard budget across every hop
90 s
exploration so new models get a chance
5%

Why it exists

Across my projects the same free API keys were wired in by hand, and the fallback loop had been written nine times, in two languages, with three contradicting failover policies.

Worse, model IDs rot silently. Twelve models in one provider's catalogue returned 410 Gone, and ten of fourteen IDs at another no longer existed. Published metadata about free AI is unreliable; only probing tells the truth. AI Router does that work once, for every project.

How it works

  1. 1

    Call it like OpenAI

    Any project sends a standard request with the stock SDK. The model field is a routing hint: auto, a task, or a pinned model.

  2. 2

    Resolve a chain

    The router builds the candidate list for that task, ordered by live health and measured quality.

  3. 3

    Try within one budget

    Each hop gets what's left of a single wall-clock budget, so retries can never stack up past the deadline.

  4. 4

    Validate the output

    Structured output is checked against the JSON schema, repaired once, and escalated to the next model if it still fails.

  5. 5

    Learn from the outcome

    Every result updates the health table and the per-task scorecard, and models that keep failing a task are demoted.

What it does well

Drop-in compatible
Chat, structured JSON, streaming, tools, vision, embeddings, rerank, images, speech and transcription through one API.
Health known before requests
A background prober checks one stale model per tick, so health is known without burning free quota.
Routing on measured quality
Models are scored on first-try schema validity, success rate and latency, with a minimum sample before a score counts.
Failures with names
Empty replies, schema failures and retired models are typed outcomes, so they can be counted and fixed.

Decisions I made

Probes can't promote
A probe can only lift a model to 'unknown'; only real traffic earns 'ready'.
Never cross embedding dimensions
A 768-wide vector where 1024 was promised would silently poison a search index, so fallback stays within one dimension.
Streams fail over before the first token only
Once bytes are on the wire it's a pipe; switching models mid-answer would corrupt it.
The paid fallback is fenced in code
The one metered provider is last-hop only, never probed, allow-listed and capped per day.

What it doesn't do (yet)

  • It runs on a single home server, which is a single point of failure.
  • Free tiers churn constantly, so some providers answer only part of the time.
  • It's for my own projects: keys are minted per project and there's no public access.