DevelopOther
@holtkeeper/ai-waibee
Waibee Router as an AI provider plugin (AiProviderPlugin of
@holtkeeper/agent), built on
@holtkeeper/waibee-ai-provider.
One Waibee key reaches the models of every vendor in its catalog.
Add the plugin to the config:
import { waibee } from '@holtkeeper/ai-waibee'import { defineConfig } from '@holtkeeper/core'
export default defineConfig({ // ... ai: { providers: [waibee()] },})Waibee then shows up in the AI provider list of the credential form, with its models and prices. A credential stores the key as its secret:
{ "name": "Waibee", "kind": "ai-sdk", "url": "https://api.waibee.com/v1", "secret": "<WAIBEE_API_KEY>", "scope": { "all": true }, "options": { "provider": "waibee", "package": "@holtkeeper/waibee-ai-provider" }}Model ids carry the vendor prefix (anthropic/claude-sonnet-4.6, openai/gpt-5.4); agents run
on the model tiers of @holtkeeper/agent: the models the llm.tiers setting names for each tier,
in order, then the newest anthropic/claude-* model of the tier’s family the credential lists.
waibee({ apiKey?, baseUrl?, id?, listModels? }) returns the plugin. WAIBEE_PACKAGE is the
package value credentials use.
- Claude models (
anthropic/claude-*,claude-*) run on Anthropic Messages, where the agent’s prompt-cache breakpoints apply, so repeated turns are billed as cache reads; every other model runs on Chat Completions.options.settings: { endpoint: 'chat' | 'messages' }on a credential forces one route for all its models. - A spent key limit or balance (
api_key_limit_exceeded,insufficient_funds, HTTP 402) fails the run withBudgetExceededErrorfrom@holtkeeper/agent. baseUrlandheadersof a credential apply to its runs; the router’s default base URL is used otherwise.- The catalog (provider id
waibee, orid) lists Waibee’s chat models with prices per million tokens, so runs are priced and model tiers resolve. It is listed withapiKey, defaultWAIBEE_API_KEYfrom the server environment, so prices follow that account’s plan; without a key it is the snapshot bundled with the provider package, with approximate prices. It is refreshed daily. - A credential’s own model listing (
listModels(connection)) asks the router with the credential’s key, so the models panel andllm.tierssee that account’s live models and prices even withoutWAIBEE_API_KEY. When the router cannot be asked, the listing falls back on the catalog.options.listModelsreplaces both listings in tests.