AI capability routing
A capability registry + capability-aware router for AI model fleets. NIST AI RMF (AI 100-1) MAP 2.x requires documenting each model's capabilities and limitations; the Model Cards convention (Mitchell et al., 2019) formalizes that descriptor. This module turns those descriptors into a routing decision: given a set of requirements (context window, modalities, tool use, reasoning tier, …), pick the cheapest model in the fleet that satisfies all of them, or fall back deterministically.
b.ai.capability.create({ models }) builds a registry from operator-supplied descriptors and returns:
- describe(modelId) — the frozen descriptor. - list() — every registered model id. - register(modelId, descriptor) — add / replace one. - satisfies(modelId, requirements) — { ok, failures } where each failure names the requirement, the need, and what the model has. - route({ requirements, fallback?, costBasis? }) — the cheapest satisfying model, or the fallback, or a refusal.
A descriptor carries: maxContextTokens, maxOutputTokens, modalitiesIn / modalitiesOut (arrays — e.g. "text", "image", "audio", "video"), toolUse, structuredOutput, fineTunable, reasoningTier ("none" | "basic" | "standard" | "advanced", ordered), citationSupport, promptCachingMaxTokens, and the cost rates costPer1kInputTokens / costPer1kOutputTokens.
Routing picks the cheapest match. When a costBasis ({ inputTokens, outputTokens }) is supplied the router estimates the per-call cost and ranks by it; otherwise it ranks by the sum of the per-1k rates. Ties break by model id so the choice is deterministic. Routing to the cheapest sufficient model is the front-line defense against over-provisioning spend — it composes with b.ai.quota's cost-usd dimension, where the chosen descriptor's rate feeds the budget charge.
Refusing to route a request to a model that cannot satisfy it (missing modality, too-small context window, no tool use) catches a capability mismatch before the inference call burns tokens on a guaranteed-bad result.
b.ai.capability.create(opts) #
{
{
models: { // required, ≥ 1 entry
[modelId: string]: {
maxContextTokens: number, // required, positive int
maxOutputTokens?: number, // default: maxContextTokens
modalitiesIn?: string[], // default: ["text"]
modalitiesOut?: string[], // default: ["text"]
toolUse?: boolean, // default: false
structuredOutput?: boolean, // default: false
fineTunable?: boolean, // default: false
reasoningTier?: string, // none|basic|standard|advanced
citationSupport?: boolean, // default: false
promptCachingMaxTokens?: number, // default: 0
costPer1kInputTokens?: number, // default: 0
costPer1kOutputTokens?: number, // default: 0
provider?: string,
version?: string,
}
},
audit?: boolean, // default: true (route decisions)
}
}
Build a capability registry + router from operator-supplied model descriptors. Returns { describe, list, register, satisfies, route }. Pair it with b.ai.quota: route() picks the cheapest model that meets the request, and the chosen descriptor's cost rate feeds the cost-usd budget charge.
var fleet = b.ai.capability.create({
models: {
"haiku": { maxContextTokens: 200000, reasoningTier: "basic",
costPer1kInputTokens: 0.001, costPer1kOutputTokens: 0.005 },
"opus": { maxContextTokens: 200000, reasoningTier: "advanced",
toolUse: true, modalitiesIn: ["text", "image"],
costPer1kInputTokens: 0.015, costPer1kOutputTokens: 0.075 },
},
});
var pick = fleet.route({
requirements: { minContextTokens: 100000, toolUse: true,
modalitiesIn: ["text", "image"] },
costBasis: { inputTokens: 4000, outputTokens: 500 },
});
// → { modelId: "opus", descriptor: {...}, estimatedCost: 0.0975, reason: "cheapest-of-1" }
Last updated 2026-08-08T16:39:49.652Z by seeder.