Skip to content
GitHub

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 with BudgetExceededError from @holtkeeper/agent.
  • baseUrl and headers of a credential apply to its runs; the router’s default base URL is used otherwise.
  • The catalog (provider id waibee, or id) lists Waibee’s chat models with prices per million tokens, so runs are priced and model tiers resolve. It is listed with apiKey, default WAIBEE_API_KEY from 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 and llm.tiers see that account’s live models and prices even without WAIBEE_API_KEY. When the router cannot be asked, the listing falls back on the catalog. options.listModels replaces both listings in tests.