Keystone. The Model Switchboard. (KTMS) 1.7 replaces effort with needs and model competencies: a request says it needs medical: basic, the gateway picks a model that can do it, the closest fit first. Old configs keep working unchanged.
Until 1.7 a request to Keystone. The Model Switchboard. (KTMS) carried one routing field: an
effort, LOW, MEDIUM or HIGH. That was enough to keep model names out of application code,
and it had two problems. The word effort already means something else: it is how much a thinking
model reasons, and OpenAI’s reasoning_effort collided with ours in the HTTP adapter. And one axis
is not enough. A medical summary is not “harder” than a legal one; it needs a different model.
KTMS 1.7 replaces effort with two maps.
Competencies and needs #
A model declares its competencies, and a request states its needs. Both are a topic and a level:
models:
- {id: gpt-4o-mini, vendor: openai, competencies: {general: proficient}}
- {id: med-small, vendor: local, competencies: {general: basic, medical: proficient}}
- {id: claude, vendor: anthropic, competencies: {general: expert, medical: expert, legal: proficient}}
The operator picks the topics; they are plain lowercase words. The levels are ordered,
basic < proficient < expert, and a model meets any need at its own level or below. The code
says what it needs and knows nothing about models:
client.chat.completions.create(
model="auto:medical=basic", # or the X-KTMS-Needs header, for SDKs that fix the model value
messages=[{"role": "user", "content": text}],
)
Over gRPC the same request has needs: {medical: basic}. An unknown level is INVALID_ARGUMENT; an
unknown topic is no error, it just finds no model, and ktms route explain says so.
Routing without a rule #
Rules stay, and a matching rule still decides: it matches each of its topics at least at its level, and its chain is filtered to the models that meet the request. What is new is what happens when no rule matches. Once any model declares competencies, Keystone picks the chain itself:
- the enabled models that meet every need and the request’s capabilities, have a vendor key, and
are permitted by the key’s and team’s
allowed_models; - ordered by placement class first (
nodes_first,cloud_first), so a free local node does not take traffic acloud_firstcaller wanted in the cloud; - then by excess , the levels above the need summed over the needed topics, so an expert is not spent on a basic task;
- then by the blended price
(3 × price_in + price_out) / 4per million tokens; - and the first three make the chain, the best fit and two fallbacks.
The ranking itself is a few lines in internal/router/select.go:
slices.SortStableFunc(cands, func(a, b Candidate) int {
if ka, kb := a.Dropped == "", b.Dropped == ""; ka != kb {
if ka {
return -1
}
return 1
} else if !ka {
return 0 // dropped ones stay in id order
}
return cmp.Or(cmp.Compare(a.Excess, b.Excess), cmp.Compare(a.Price, b.Price))
})
Rules become what they should have been: the exceptions. Pin a chain for a tenant, run a canary, mirror to a shadow model; everything else routes by what the models can do. The order and the price formula are experimental in 1.7 and may still change in a minor release; which models qualify is stable.
ktms route explain KEY --needs medical=basic shows the whole selection: every model, kept or
dropped with the reason, its excess and price, and chain_length for the ones past the third.
Nothing to change on upgrade #
Effort is deprecated, not gone. LOW, MEDIUM and HIGH are now the needs general: basic,
proficient and expert, and every effort field keeps working until 2.0. A model described by
efforts keeps serving exactly those efforts, so a 1.6 configuration routes the same after the
upgrade, and keeps needing its catch-all rule per effort until a model declares competencies.
ktms config plan prints a hint: for each model and rule that still uses efforts, with the
competencies or needs to write instead. Two things to know:
- Upgrade ktms-admin together with the gateway. A console from before 1.7 saves models and rules without the new fields and would erase them.
- Metrics and usage keep their shape. The
effortlabel ofktms_requests_totalis the request’s general need aslow,mediumorhigh; usage events keepeffortand gainneeds(general=basic,medical=proficient).
Also in 1.7 #
- The process on a node is now called the node daemon : “agent” is left to AI agents and their
inbox. The
ktms-nodebinary, its service, flags and environment variables keep their names. - Speech, images, judgments and translation take
needstoo; without them only the modality filters, as before. Translation selection ranks by the price per million characters. ktms chat --needs,needsin the MCP toolexplain_route, and competencies and needs columns inktms models listandktms rules list. The plugin skillsconfigure,integrate,migrateandnodenow speak of needs.- ktms-admin 1.4: competencies on the model form, needs on rules and in the Playground, and Where would it go? , the route explanation for a client key.
Docs: Needs and competencies,
Rules,
API stability.
Code: internal/router/select.go,
internal/registry/competency.go.