mohdel
Your Node code calls language models. You want to try another model without rewriting the call, know what each call cost, and keep your keys on your own machines. mohdel does this: a self-hosted LLM (large language model) gateway and SDK for Node. spore talks to models through it, but it is a separate package, and it works without spore. Its full documentation lives on npm.
what mohdel is
A gateway is the one place your code sends model calls to instead of each provider, the company
or service that runs a model behind an API. An SDK (software development kit) is the package
your code imports: here, mohdel on npm. Both run on your machines.
- One
answer()call covers fifteen providers — Anthropic, OpenAI, ChatGPT, Gemini, Mistral, Groq, xAI, Cerebras, Fireworks, DeepSeek, Qwen Cloud, Xiaomi, Meta Model API, OpenRouter, Novita — or local inference: a model you run yourself, on any server that speaks OpenAI's chat-completions API, such as Ollama, vLLM, llama.cpp server or LM Studio. A call to a local model never falls through to a cloud provider. - Swapping models is changing one string. A model is named
<provider>/<model>, asanthropic/claude-sonnet-5-5, and the result has the same shape whatever the provider:{ status, output, inputTokens, outputTokens, cost }. - Every result carries the call's cost in US dollars, computed from your own pricing catalog —
curated.json, the list of models and prices you keep, which can carry your negotiated rates. Until the catalog has a model's prices, itscostreads 0. - No SaaS proxy — no third-party hosted service — in the path. mohdel calls the providers' APIs directly with your keys; nothing routes through a third party, and nothing marks up your tokens.
- An eligible ChatGPT plan can sit alongside API keys.
chatgpt/models are reached by signing in to the plan;openai/models use API billing. A ChatGPT call reports acostof 0: no per-call API charge is calculated, which does not mean the plan's usage is unlimited.
spore and mohdel
spore talks to models through mohdel. Its runner — the process on the host's side of a turn,
which holds the provider keys — looks for a key where mo, mohdel's command, does,
so a machine where mo works runs spores with no key copied. How a spore picks up a
model the catalog lacks is on use; mohdel, the gateway, the SDK,
providers, the catalog and answer() are defined under money and models, the runner under how a turn runs.
using mohdel alone
Install it, then run mo: it asks for a provider, takes your API key, and pulls that
provider's models. Keys are kept in ~/.config/mohdel/environment.
npm install -g mohdelmo Then, from Node 22 or later, with ES modules:
import mohdel from 'mohdel'
const mo = await mohdel()
const result = await mo.use('anthropic/claude-sonnet-5-5').answer('Hello')
console.log(result.output, result.cost) No subprocess, and no setup beyond your API key. Streaming, tools, the cross-process gateway and OpenTelemetry tracing are covered in the package's documentation.