OpenInfer
Open source inference runtime

One model, any hardware.

An OpenAI-compatible server that runs the same model on CPU, Apple Metal, NVIDIA CUDA, AMD ROCm or an NPU, and decides for every request whether it runs locally or in the cloud, by privacy, latency and cost.

uvx --from git+https://github.com/Hassan-Memon/openinfer openinfer serve

Runs with zero API keys. With no models configured it answers from a deterministic echo backend, so the whole API works on the first try.

Why it exists

Inference today means picking one vendor's GPU, one vendor's API, and hoping the bill is reasonable. OpenInfer puts a policy layer in front of all of them.

No hardware lock-in

One GGUF file runs through llama.cpp on CPU, Metal, CUDA or ROCm. Ollama and vLLM plug in over HTTP. A cloud API is just one more backend.

Private stays private

Tag a request private and only local backends are eligible. If no local backend can serve it, the request fails instead of falling through to the cloud.

Cost you can see

Every request records tokens, cost, latency and time to first token. Read it back from /v1/ledger, Prometheus /metrics or the bench command.

Your SDK already works

The API is OpenAI's wire format. Point the OpenAI SDK, LangChain or curl at it and change only the base URL.

Free tiers, made reliable

Alias chains retry with exponential backoff and fall through Groq, Gemini, OpenRouter, Ollama and llama.cpp in the order you choose.

Policy is a file

Aliases, privacy rules, cost and latency ceilings live in openinfer.yaml. Operators change behaviour without a deploy, and auditors can read it.

Router playground

This runs the router's selection rules in your browser, using the default alias chains from the repo's openinfer.yaml. Choose a request and switch backends off to see the fallback and the privacy rule at work.

Request

    
          

    Measured, not claimed

    Output of openinfer bench on a Windows 11 laptop, CPU only, with Ollama running locally. No GPU.

    BackendModelWhereTime to first token, p50Generated tokens/sTotal p50USD per 1M output tokens
    ollamadeepseek-r1:1.5blocal380 ms16.03,376 ms0.00
    echoecholocal0.1 ms171,0590.2 ms0.00

    The echo row is the test backend and shows only server overhead. Run openinfer bench on your own machine to get your numbers.

    How a request flows

    Clients speak OpenAI. The router picks a backend. The ledger records what happened.

    Clients

    • OpenAI SDK
    • LangChain
    • curl, any HTTP client

    OpenInfer

    • /v1/chat/completions, SSE streaming
    • /v1/embeddings, /v1/models
    • Router: aliases, privacy, cost, latency, fallback
    • Ledger and /metrics

    Backends

    • Local: llama.cpp, Ollama, vLLM
    • Cloud: Groq, Gemini, OpenRouter, OpenAI
    • Echo for tests and demos
    from openai import OpenAI
    
    client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")
    client.chat.completions.create(
        model="private",
        messages=[{"role": "user", "content": "Summarise this patient note"}],
    )