OpenRouter Provider
Configure @namzu/openrouter for multi-vendor model access through OpenRouter.
@namzu/openrouter gives Namzu access to OpenRouter's multi-vendor model catalog through a single provider package. It is useful when vendor flexibility matters more than binding directly to one model API.
1. When to Use It
Choose this package when you want to switch among vendors or models without changing the Namzu runtime wiring.
2. When Not to Use It
Choose another provider when:
- you already know the runtime is tied to one vendor and want the smallest translation layer
- you only need a generic OpenAI-compatible endpoint and do not need OpenRouter-specific behavior
3. Install
4. Register and Create the Provider
5. Sanity-Check With a Direct Provider Call
6. Configuration
| Field | Required | Description |
|---|---|---|
apiKey | Yes | OpenRouter API key |
baseUrl | No | Override the default OpenRouter API base URL |
siteUrl | No | Optional site URL for OpenRouter analytics |
siteName | No | Optional site name for OpenRouter analytics |
timeout | No | Request timeout in milliseconds |
7. Capability Snapshot
The package exports OPENROUTER_CAPABILITIES:
Actual tool quality still depends on the chosen upstream model.
8. Operational Notes
- Model identifiers typically use the
vendor/model-nameform. - This package is fetch-based and keeps runtime dependencies small.
- If you do not need OpenRouter-specific behavior and only need a generic OpenAI-compatible client,
@namzu/httpis the lighter conceptual fit. OPENROUTER_BASE_URLcan override the default base URL process-wide.siteUrlandsiteNameare useful when you want OpenRouter-side attribution or analytics context.- The provider also implements
listModels()andhealthCheck().
9. Common Errors
| Error | Meaning | Fix |
|---|---|---|
Unsupported provider type: openrouter | registration never happened | call registerOpenRouter() first |
| missing API key error | no apiKey passed | set OPENROUTER_API_KEY and pass it into config |
| model not found | incorrect vendor/model identifier | verify the model name in OpenRouter's catalog |