Local runtime · See your AI. Build with it.
Your own apps can call the models you already pay for.
OriginLM is one local runtime that makes the AI already on your machine callable from software you build. One integration, instead of client-specific paths, metadata parsers and streaming protocols for every AI client.
import { createLocalAI } from "originlm";
const ai = await createLocalAI();
const [pick] = await ai.selection.resolve({
query: "codex",
requiredCapabilities: ["generation.text"],
eligibleOnly: true,
});
const session = await ai.sessions.create({
selection: pick.selection,
workspaceId: "notes",
permissionMode: "read_only",
});
const events = ai.events.subscribe({ sessionId: session.id });
await ai.turns.start({
sessionId: session.id,
requestId: crypto.randomUUID(),
prompt: "Summarize the open questions in these notes.",
});
for await (const { payload } of events) {
if (payload.type === "text_delta") render(payload.text);
if (payload.type === "final") break;
}
query) changes.Summarize the open questions in these notes.
Three notes mention the launch. Two are drafts; one has a date: Thursday.
- 01resolvequery "codex"
- 02grantapproved · workspace notes
- 03staterunning
- 04finalcompleted (73 chars)
02 · Problem & architecture
Every app you build re-integrates every AI client.
Your application does not have to reproduce client-specific paths, metadata parsers or streaming protocols for each AI client a user might have installed.
Three example apps, five clients: fifteen integrations, each with its own client-specific paths, metadata parsers, streaming protocols. With one local runtime, each app integrates once.
One machine · No relay
Nothing passes through an OriginLM server, because there isn’t one.
Your code talks to the SDK. The SDK talks to a runtime on the same machine, which drives the clients the user installed.
Your app
Electron, Tauri, GPUI, Node, Python, or a browser extension page.
- user clicks Connect
originlm SDK
npm, crates.io and PyPI. Imports are inert until you call it.
- shared broker
- stdio helper
- loopback HTTP
OriginLM runtime
Discovery, evidence, grants, sessions and events. Runs locally.
- grants
- sessions
- events
Installed clients
The tools the user already signed in to, driven via their own interfaces.
- Claude Code
- Codex
- Antigravity
- Ollama
Provider
The route’s provider, under its own terms. Local model routes stay on the device.
- subscription
- metered
- local
03 · How it works
Discover. Grant. Call.
Step 01
snapshot.getDiscover
Passive discovery finds the AI clients already installed, from metadata only. No secrets read, no network calls, nothing at import time.
Provider, installation, profile, account, connection, route, model, billing and quota-pool identities stay distinct. Unknown and unsupported are different states; nothing is guessed.
const { connections, quotaPools } = await ai.snapshot.get();Step 02
grants.requestGrant
Discovery is not permission. The host app grants execution explicitly, scoped to connections and workspaces. grants.request only asks: it returns requires_host_approval and changes nothing.
Metadata, execution, workspace access, tools and paid options are separate, revocable, per-app grants.
await ai.grants.request({ connectionIds: [pick.connectionId], allowPaid: false, }); // never approves itselfStep 03
turns.startCall
Resolve a route by capability, open a session, stream the turn. Typed events from a cursor: text deltas, approvals, usage, final.
Native model IDs and option descriptors are preserved. There is no fake universal Low/Medium/High.
await ai.turns.start({ sessionId: session.id, requestId, prompt, });
04 · SDKs
One protocol. Three SDKs.
TypeScript, Rust and Python clients speak the same JSON-RPC protocol to the same runtime. The TypeScript and Python SDKs are typed protocol clients generated from the Rust contracts.
Importing the package never scans, launches a process or reads a credential. Discovery runs when you call it.
- Embedded libraryThe Rust facade embeds the runtime in-process when no helper exists.
- Native helperThe standalone originlm executable: stdio, HTTP/SSE, broker and Native Messaging transports.
- Shared brokerOne local service many apps attach to, each with its own token and identity.
- TypeScript & Python SDKsTyped protocol clients generated from the Rust contracts.
- React hooks & selectorsOptional hooks and eight selector layouts.
import { createLocalAI } from 'originlm';
const ai = await createLocalAI();
try {
const snapshot = await ai.snapshot.get();
console.log(ai.mode, snapshot.revision);
} finally {
await ai.close();
}npm install originlm@alpha
05 · Control center
And yes, it tracks allowances too.
The control center: a native desktop app and a terminal UI over the same public API. Overview, Providers, Models, Usage charts, Connected apps, Sessions, Playground, Diagnostics.
It shows quota windows only as the client reports them. Unknown stays unknown, never a guessed zero.
- CodexPersonal workspace · Included planSigned inSession window75% leftResets in 59mExample data
- CodexWork workspace · Included planCached sign-inWeekly windowStale30% leftReset time not reported
- AntigravityGoogle workspace · Gemini 4 NeonSigned inCount without a published total17 requests usedNo published total
- OllamaOn this device · Local runtimeLocalAllowance windowNot reportedLocal route — no allowance window
06 · Install
Install OriginLM.
- npm
npm install originlm@alpha - pip
pip install originlm==0.1.0a25 - cargo
cargo add originlm@=0.1.0-alpha.25
Published alpha on npm (the alpha tag), PyPI and crates.io at 0.1.0-alpha.25. The API can change between alpha revisions. MIT licensed.