New
Apps 6,419Makers 6,403This week 7
Promote your app−30%
3views in
the last 30 days

BYOLLM

Bring your own LLM: let users connect their own model and API key to your app

Built with Claude Code

by oftomorrowinc · Unclaimed · added Nov 3, 2026
no ratings0 comments

Warning

0.1.5 — early. The protocol is version 2 as of 0.1.0; the software is still early. These packages run one hosted service — byollm.cloud — and a small number of integrations; beyond that they have little mileage, and most of what we know about the failure modes we learned from the first people to try.

Formats change, and a change may require re-pairing. On-disk shapes (the pairings file), wire fields and the routing store's keyspace are still moving, and while the only deployment is ours they move in one release rather than three: transitional code exists to protect a party who has not agreed to change, and today that party is us. The slow procedures — dual-read for a keyspace, N/N+1 for a wire field, three releases for an on-disk format — are written down and turn on with the first outside user. If an upgrade leaves a daemon saying it is paired with nothing, byollm connect is the answer and nothing else is lost.

BYOLLM

Bring Your Own LLM. Let your app's users run its AI on their models and their subscriptions — their Ollama box, their Mac running MLX, their claude CLI — through a tiny daemon they run and control.

npx byollm@latest connect https://your-app.com

npm · license · status

You already have an AI. Hand it this.

Paste the prompt into whatever you use — Claude, ChatGPT, Codex, Cursor, a local model — and it does the setup, stopping where a step needs you.

Set up my computer
Set up BYOLLM on my computer so websites I approve can use the AI I already
have. Some steps need me at the keyboard: tell me exactly what to type, then
wait. First I open Terminal (Mac) or PowerShell (Windows). Run
`node --version`; if it fails or is below 22.14, I install the LTS version
of Node.js — the free program BYOLLM runs on — from https://nodejs.org and
reopen the window. Then run `npm install -g byollm@latest`. Then I run
`byollm setup` myself, because it asks questions: it finds what I have
(Ollama, MLX or llama.cpp here, or my Claude Pro/Max or Codex sign-in —
subscriptions stay mine, never shared) and pairs with byollm.cloud. When it
prints a pairing code and fingerprint, STOP: I approve it at
https://dashboard.byollm.cloud/devices and check the fingerprint matches.
Then run `byollm status` and `byollm services`, fix anything they name, and
`byollm start` if it is not running. Finish by having me press Connect at
https://test.byollm.cloud. Reference:
https://docs.byollm.cloud/#what-is-byollm and
https://docs.byollm.cloud/#keep-daemon-running. Don't guess commands:
`byollm --help` is the authority.
Add BYOLLM to my site
Add BYOLLM to this project so my users bring their own AI. Install
`@byollm/server`, generate site keys once with
`npx --package @byollm/server keygen` and put them in env (never in the
repo), mount the handler at `/byollm` (not under `/api` — the daemon pairs
with an origin), and add one `enqueue` with a timeout and a no-runner path —
never a bare await. Then register the site at https://dashboard.byollm.cloud
and add the Connect button exactly as https://docs.byollm.cloud/#embed says:
the iframe gets `site`, `state` and `return`, the page posts
`{ byollm: "hello" }` first, and the return page posts
`{ byollm: "connected" }` and closes. Job states and why an answer stopped:
https://docs.byollm.cloud/#job-states and
https://docs.byollm.cloud/#stop-reason. Test against
https://test.byollm.cloud's flow before you tell me it works. STOP and ask
me for anything that needs my dashboard login.
Run my own relay
Stand up my own BYOLLM relay instead of byollm.cloud. Use `@byollm/relay`
and `@byollm/control-plane` from npm — one replica on the built-in memory
store, or give the relay a shared `RoutingStore` to run more — and prove it
with `@byollm/conformance`
(`npx --package @byollm/conformance byollm-certify <target>`) before
pointing any daemon at it: a server is byollm-compatible when the kit
passes. Then pair a daemon with `byollm connect <my relay origin>`. The
relay never sees prompts (https://docs.byollm.cloud/#what-we-see) and that
must stay true in my deployment. Reference:
https://github.com/oftomorrowinc/byollm#packages. STOP and ask me before
anything that costs money or opens a port to the internet.

Why

Every AI app eventually gets the same request: "can I use my own model / my own key / my own GPU?" Answering it usually means CORS headaches, tunnels into localhost, or shipping the user a fragile script.

BYOLLM makes it a three-line integration. Your app enqueues LLM jobs; the user runs a small outbound daemon that claims only their own jobs and executes them locally. No inbound ports, no tunnels, no keys leaving the device. The browser app stays hosted; the compute comes from the user.

Two audiences, one design:

  • App developers get a drop-in server adapter and a job queue. Enqueue llm.generate, get a result back — you never touch the user's model or credentials.
  • Users get a daemon that is their trust anchor: every prompt that runs on their device is logged, rate-limited, and pausable, and subscription-backed models are hard-locked to their own work only.

How it works

   your web app  ──enqueue job──▶  your backend (@byollm/server)
                                          │
                                          │  jobs table (yours: Supabase, Postgres, memory…)
                                          ▼
   user's device   ──outbound poll──▶  claim ─▶ run on local model ─▶ result
     (byollm)                                          │
                                                   Ollama · MLX · claude CLI

The daemon only ever connects out. There is nothing to open on the user's network. Jobs are typed data, never code — a server can hand the daemon a prompt, never a command.

Quick start

For app developers

Mount the handler, point it at a store, and enqueue.

// app/byollm/[...route]/route.ts
import { createHandler } from "@byollm/server/next";
import { siteKeysFromEnv } from "@byollm/server";
import { getStore } from "@/lib/byollm";

// A function, not an object: `next build` imports this module with no secrets
// in the environment, and must not construct anything.
export const { POST } = createHandler(() => ({
  store: getStore(),
  siteKeys: siteKeysFromEnv("BYOLLM_SITE_KEYS"),
  verificationUrl: "https://your-app.com/settings/runners",
}));
// lib/byollm.ts
import { ByollmApp, MemoryStore, siteKeysFromEnv } from "@byollm/server";

// Lazily, and memoized, for the same reason the mount takes a function: a
// module-scope `new` runs during `next build`. Generate the keys once with
// `npx --package @byollm/server keygen` — never at startup, or each instance
// gets a different identity and paired daemons break.
let store: MemoryStore | undefined;
export function getStore(): MemoryStore {
  return (store ??= new MemoryStore());
}

let app: ByollmApp | undefined;
export function getApp(): ByollmApp {
  return (app ??= new ByollmApp({
    store: getStore(),
    siteKeys: siteKeysFromEnv("BYOLLM_SITE_KEYS"),
  }));
}

The route lives at /byollm, not under /api: the daemon pairs with an origin — it drops any path it is given — and calls <origin>/byollm/<endpoint>, so a handler mounted anywhere else is one no daemon can reach. Users pair with byollm connect https://your-app.com.

// anywhere in your app
const job = await getApp().enqueue({
  kind: "llm.generate",
  audience: "private",         // this user's device only
  owner: userId,
  payload: { prompt: "Summarize this transcript:\n\n" + transcript },
});

// resolves via your delivery channel (webhook / Realtime / poll),
// with a timeout and a noRunnerAvailable path — never a bare await
const { outcome } = await job.result({
  // Return something and the wait resolves with it, labelled `fallback: true`.
  onNoRunner: (reason) => hostedModelAnswer(prompt, reason),
});

That's the whole integration: one route, one store, one enqueue. If no daemon is online you get a noRunnerAvailable signal — never a promise that hangs forever.

onNoRunner decides which of two things happens. Return a string (or a full result) and the wait resolves with it, stamped fallback: true so a hosted answer can never be reported as the user's own compute. Return nothing — including from a handler that only prompts the person to connect — and NoRunnerAvailableError is thrown instead, so catch it:

try {
  const { outcome } = await job.result({
    onNoRunner: async () => { await showConnectModal(); },
  });
} catch (error) {
  if (error instanceof NoRunnerAvailableError) return renderConnectPrompt();
  throw error;
}

For users

npx byollm@latest connect https://your-app.com   # opens a browser to pair — one click
byollm status                                # what's connected, what's running

Point it at your models:

{
  "services": {
    "local": {
      "type": "ollama",
      "baseUrl": "http://127.0.0.1:11434/v1",
      "model": "gemma3:12b",
      "kinds": ["llm.generate"],
      "offer": "private"
    },
    "claude": {
      "type": "claude-cli",
      "model": "claude-opus-5",
      "kinds": ["llm.chat"],
      "offer": "private"
    }
  }
}

That lives in ~/.byollm/config.json, and byollm services manage writes it for you if you would rather not. To change which model a service uses, edit its model and restart the daemon — a running daemon reads this file once at start, so an edit alone changes nothing. (On a hosted box you cannot do either: the console runs a fixed list of commands. Hosted boxes run Opus.) type is the provider: name it and byollm can start that server when a job needs it. openai-http is the generic transport for a server byollm does not know by name — it works, and nothing can be started for it. offer is private for your own work or team to share; subscriptions are locked to private whatever the file says.

byollm services       # what's installed, healthy, advertised — and who each is offered to
byollm sites          # which sites this device serves, and which keys it holds
byollm log            # every prompt that ran here, ever
byollm stop           # stop running in the background — the off switch, always yours
byollm offer <service> team --cap 250     # share a paid service, deliberately

The audience model — sharing, safely

Every job carries an audience and every backend an offer scope. A job runs on a device only when both agree.

Backend Cost Can offer Why
Ollama, MLX, llama.cpp, vLLM, LM Studio free private → team Local compute. Costs electricity, not money.
Anthropic, OpenAI, Gemini, Grok, Groq, OpenRouter… metered private by default; team only with an explicit spend acknowledgment and a daily ceiling Your API key, your money, per token. Sharing it is legitimate and ruinous by accident.
claude CLI & other subscription accounts subscription private only, enforced One account runs one person's work. A protocol MUST, not a setting.
Gemini subscription (Gemini CLI sign-in) — — Not yet; we haven't found a way to isolate it the way the Claude Code and Codex sign-ins are isolated; the API key route works today, metered.

Cost class comes from the protocol registry and is not yours to declare. Point the generic openai-http backend at a remote endpoint and it is metered no matter what you call it — "free" is derived from the address the request is sent to, not from the config. That is the one rule that makes the rest enforceable.

Note the pair: anthropic and claude-cli reach one vendor in two different cost classes. A platform key bills per token; a Claude plan covers one person's work. The axis asks who pays and under what terms, not which company answers.

The derivation reads the address, not the destination — a localhost proxy forwarding to a paid API classes as free, and nothing downstream can see through it. That is a deliberate act by the device's owner against their own account, and it is outside the threat model; what the rule prevents is the accident.

Want your friends' jobs to run overnight on your computer? byollm offer <service> team flips an open service over to the people your relay admits. Your subscription is never part of that, and there is no scope that opens a device to people it cannot check.

Widening a paid backend is the one path that asks first, and the question names the money rather than asking whether you are sure:

$ byollm offer openai team --cap 250

This lets other people's jobs run on OpenAI (your API key), which bills
your account per token. You would be paying for their work, up to
$2.50 a day, every day, until you change it.
Spending stops at that ceiling and resumes the next day.

Offer openai to anyone? [y/N]

Sharing a metered backend without a ceiling is refused outright — an unlimited one is not something anyone means on purpose. Narrowing back to self withdraws the consent too, so widening again has to be agreed to again.

team is enforced by your daemon, not by the app. Every job arrives with a grant signed by the control plane your device pinned when it paired, naming the site, the person, the job and the service — and your device verifies that signature, checks the grant has not been used before, checks the service is one it actually offers to that person, and refuses outright if the service is private. A device with no relay paired serves its owner and nobody else, because nothing there could tell it who anybody else is.

Security

The daemon runs prompts on the owner's computer, so every payload is treated as hostile input. Breakout is made structurally impossible, not merely detected:

  • Payload text can never become a command line. HTTP-class backends (Ollama, MLX server, vLLM) receive it as a request body; process-class backends (claude CLI) receive it on stdin with a fixed argv. Shell metacharacters, --flags, $(…) are just characters the model reads.
  • Model, backend, and flags come from the owner's local config only — a job can never name a model, path, URL, or flag.
  • Process-class backends spawn with a stripped environment (no ANTHROPIC_API_KEY), an empty scratch dir, no inherited file descriptors, and hard timeout/output caps. HTTP-class backends spawn nothing at all.
  • The daemon exposes no tools, no retrieval, no MCP to the model. Output is inert bytes — never eval'd, never written to a payload-named path.
  • With a process-class backend that last point is a claim about the CLI's behaviour, not only ours, so it is re-proved on every run against the real signed-in binary rather than assumed. It is not yet an OS-level sandbox. docs/security.md §3.2–§3.3 say what has been proved, on which platforms, and what has not.

A named adversarial test corpus (command injection, argv injection, path traversal, env exfiltration, oversized/unicode payloads) runs as a blocking CI gate, and every backend must ship its own hostile-payload suite before it can be added. See docs/security.md.

We're precise about the boundary: BYOLLM makes breakout impossible; prompt injection (steering the model's words) is the model's problem, bounded here because the model has no tools and the output is inert. We don't promise more than we can keep.

Packages

Package What it is
byollm The daemon — runs models on your own machine and answers for it.
@byollm/protocol The wire: envelopes, signatures and the closed vocabularies both ends validate against.
@byollm/server The SDK a site uses to ask a device for work.
@byollm/relay The broker that holds jobs between a site and a device, and can read neither.
@byollm/control-plane Who may ask whom, and the policy store behind it.
@byollm/conformance The kit that proves an implementation is one — including a posture audit that holds nothing but a URL.

Six packages, versioned and released together.

Where the rest lives

A server is byollm-compatible when the conformance kit passes against it. That sentence is the whole versioning story — no framework version to chase.

Status

Early, built in the open. The packages are listed above, and npm install byollm resolves to this release.

The protocol is at v0 and the audience model is settled, but v0 means what it says: it will change without a deprecation path. A device serves its owner alone until it is paired with a relay and its owner shares a service deliberately. Backends at v1: openai-http for any OpenAI-compatible server (Ollama, MLX, llama.cpp, vLLM, LM Studio and the rest), the CLI backends claude-cli and codex-cli, and named ids for the hosted vendors — the full set is BACKEND_IDS in @byollm/protocol.

What exists: a large test suite, an adversarial corpus wired as a blocking CI gate, and a conformance kit green against both the in-memory reference and real Postgres.

Not yet

Things we know are limiting right now:

  • Tool use
  • Access to your local files
  • Streaming — a result comes back whole
  • Job kinds beyond llm.generate and llm.chat — no embeddings or images yet
  • Jobs while your device is offline — your device has to be online for your jobs to run

We have plans for every one of these, and we are building in public — follow and join them on the issues page.

Contributing

pnpm install
pnpm run verify     # format, build, smoke, lint, typecheck, tests, coverage, dead code

Run pnpm run build before any bare tsc. Every package resolves its neighbours through the types field in their package.json, which points at dist/ — so on a clean checkout tsc -p packages/daemon reports that @byollm/protocol does not exist, and the wall of errors that follows reads exactly like a half-finished migration. It cost an external contributor a wrong diagnosis in a PR description, which is how this paragraph came to be here. pnpm run typecheck now builds first, so it is safe on its own; pnpm exec tsc still is not.

The bar is CI-enforced, not review-vigilance: strict TypeScript, ≥90% coverage on the

Description taken from the repository README.

Ratings

–
0 ratings
5 0
4 0
3 0
2 0
1 0

Rate this app

Sign in to rate

Comments 0

Sign in to comment

No comments yet.

Related apps

#llm · #api · #dev-tools