@namzu/openrouter
v2.3.1
Published
OpenRouter LLM provider for @namzu/sdk. Access to 200+ models (Claude, GPT-4, Llama, Mixtral) via OpenRouter's unified API.
Readme
The OpenRouter model driver for Namzu.
Install · Usage · Documentation
Implements the kernel's LLMProvider interface over OpenRouter, which
fronts many vendors behind one key and one wire format. Installed only if
you use it — the kernel has no preferred vendor and no driver is a
dependency of it.
Install
pnpm add @namzu/sdk @namzu/openrouter@namzu/sdk is a peer dependency. Install both.
Usage
import { ProviderRegistry } from '@namzu/sdk'
import { registerOpenRouter } from '@namzu/openrouter'
registerOpenRouter() // once, at startup
const { provider } = ProviderRegistry.create({
type: 'openrouter',
apiKey: process.env.OPENROUTER_API_KEY ?? '',
siteUrl: 'https://example.com', // optional
siteName: 'Example', // optional
})
for await (const chunk of provider.chatStream({
model: 'anthropic/claude-opus-5',
messages: [{ role: 'user', content: 'Hello' }],
})) {
if (chunk.delta.content) process.stdout.write(chunk.delta.content)
}chatStream is the only model entry point; a non-streaming call is that
stream collected. In practice the kernel's run loop calls it and hands you
events.
Documentation
License
FSL-1.1-MIT, converting to MIT two years after each release.
