{"slug": "keystone-1-7-say-what-the-request-needs-not-how-hard-it-is", "title": "Keystone 1.7: say what the request needs, not how hard it is", "summary": "Keystone. The Model Switchboard. (KTMS) 1.7 replaces its single LOW/MEDIUM/HIGH effort routing field with two maps: models declare competencies and requests state needs, both as a topic plus an ordered level (basic < proficient < expert). When no rule matches, Keystone builds a chain from enabled models meeting every need, ordered by placement class, then by excess levels above the need, then by the blended price (3 × price_in + price_out) / 4 per million tokens, taking the best fit plus two fallbacks. Effort is deprecated but still works until 2.0, so 1.6 configurations route the same after upgrade; the ordering and price formula are experimental in 1.7 and may change in a minor release.", "body_md": "# Keystone 1.7: say what the request needs, not how hard it is\n\nKeystone. 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.\n\nUntil 1.7 a request to Keystone. The Model Switchboard. (KTMS) carried one routing field: an\n**effort**, `LOW`, `MEDIUM` or `HIGH`. That was enough to keep model names out of application code,\nand it had two problems. The word *effort* already means something else: it is how much a thinking\nmodel reasons, and OpenAI’s `reasoning_effort` collided with ours in the HTTP adapter. And one axis\nis not enough. A medical summary is not “harder” than a legal one; it needs a different model.\n\nKTMS 1.7 replaces effort with two maps.\n\n## Competencies and needs\n\nA model declares its **competencies**, and a request states its **needs**. Both are a topic and a\nlevel:\n\n```\nmodels:\n  - {id: gpt-4o-mini,  vendor: openai, competencies: {general: proficient}}\n  - {id: med-small,    vendor: local,  competencies: {general: basic, medical: proficient}}\n  - {id: claude,       vendor: anthropic, competencies: {general: expert, medical: expert, legal: proficient}}\n```\n\nThe operator picks the topics; they are plain lowercase words. The levels are ordered,\n`basic` < `proficient` < `expert`, and a model meets any need at its own level or below. The code\nsays what it needs and knows nothing about models:\n\n```\nclient.chat.completions.create(\n    model=\"auto:medical=basic\",          # or the X-KTMS-Needs header, for SDKs that fix the model value\n    messages=[{\"role\": \"user\", \"content\": text}],\n)\n```\n\nOver gRPC the same request has `needs: {medical: basic}`. An unknown level is `INVALID_ARGUMENT`; an\nunknown topic is no error, it just finds no model, and `ktms route explain` says so.\n\n## Routing without a rule\n\nRules 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:\n\n1. the enabled models that meet every need and the request’s capabilities, have a vendor key, and\nare permitted by the key’s and team’s `allowed_models` ;\n2. ordered by placement class first (`nodes_first` ,`cloud_first` ), so a free local node does not\ntake traffic a`cloud_first` caller wanted in the cloud;\n3. then by **excess** , the levels above the need summed over the needed topics, so an expert is not\nspent on a basic task;\n4. then by the blended price `(3 × price_in + price_out) / 4` per million tokens;\n5. and the first three make the chain, the best fit and two fallbacks.\n\nThe ranking itself is a few lines in `internal/router/select.go`:\n\n```\nslices.SortStableFunc(cands, func(a, b Candidate) int {\n\tif ka, kb := a.Dropped == \"\", b.Dropped == \"\"; ka != kb {\n\t\tif ka {\n\t\t\treturn -1\n\t\t}\n\t\treturn 1\n\t} else if !ka {\n\t\treturn 0 // dropped ones stay in id order\n\t}\n\treturn cmp.Or(cmp.Compare(a.Excess, b.Excess), cmp.Compare(a.Price, b.Price))\n})\n```\n\nRules 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.\n\n`ktms route explain KEY --needs medical=basic` shows the whole selection: every model, kept or\ndropped with the reason, its excess and price, and `chain_length` for the ones past the third.\n\n## Nothing to change on upgrade\n\nEffort is deprecated, not gone. `LOW`, `MEDIUM` and `HIGH` are now the needs `general: basic`,\n`proficient` and `expert`, and every effort field keeps working until 2.0. A model described by\n`efforts` keeps serving exactly those efforts, so a 1.6 configuration routes the same after the\nupgrade, and keeps needing its catch-all rule per effort until a model declares competencies.\n\n`ktms config plan` prints a `hint:` for each model and rule that still uses efforts, with the\ncompetencies or needs to write instead. Two things to know:\n\n- **Upgrade ktms-admin together with the gateway.** A console from before 1.7 saves models and rules\nwithout the new fields and would erase them.\n- **Metrics and usage keep their shape.** The`effort` label of`ktms_requests_total` is the\nrequest’s general need as`low` ,`medium` or`high` ; usage events keep`effort` and gain`needs` (`general=basic,medical=proficient` ).\n\n## Also in 1.7\n\n- The process on a node is now called the **node daemon** : “agent” is left to AI agents and their\ninbox. The`ktms-node` binary, its service, flags and environment variables keep their names.\n- Speech, images, judgments and translation take `needs` too; without them only the modality\nfilters, as before. Translation selection ranks by the price per million characters.\n- `ktms chat --needs` ,`needs` in the MCP tool`explain_route` , and competencies and needs columns\nin`ktms models list` and`ktms rules list` . The plugin skills`configure` ,`integrate` ,`migrate` and`node` now speak of needs.\n- ktms-admin 1.4: competencies on the model form, needs on rules and in the Playground, and *Where would\nit go?* , the route explanation for a client key.\n\nDocs: [Needs and competencies](https://github.com/ai-process/ktms/blob/main/docs/concepts.md#needs-and-competencies),\n[Rules](https://github.com/ai-process/ktms/blob/main/docs/configuration.md#4-rules),\n[API stability](https://github.com/ai-process/ktms/blob/main/docs/stability.md).\nCode: [`internal/router/select.go`](https://github.com/ai-process/ktms/blob/main/internal/router/select.go),\n[`internal/registry/competency.go`](https://github.com/ai-process/ktms/blob/main/internal/registry/competency.go).", "url": "https://wpnews.pro/news/keystone-1-7-say-what-the-request-needs-not-how-hard-it-is", "canonical_source": "https://blog.ai-process.dev/2026/11/26/keystone-1-7/", "published_at": "2026-11-26 18:00:00+00:00", "updated_at": "2026-11-26 18:12:10.223625+00:00", "lang": "en", "topics": ["ai-infrastructure", "large-language-models", "mlops", "ai-tools"], "entities": ["Keystone. The Model Switchboard. (KTMS)", "OpenAI", "Anthropic", "gpt-4o-mini", "claude"], "also_reported_by": [], "takeaway": "KTMS 1.7 lets requests declare needs like medical=basic instead of an effort level, and when no rule matches it chains the best-fit model plus two fallbacks by lowest excess level, then blended price (3 × price_in + price_out) / 4 per million tokens.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/keystone-1-7-say-what-the-request-needs-not-how-hard-it-is", "markdown": "https://wpnews.pro/news/keystone-1-7-say-what-the-request-needs-not-how-hard-it-is.md", "text": "https://wpnews.pro/news/keystone-1-7-say-what-the-request-needs-not-how-hard-it-is.txt", "jsonld": "https://wpnews.pro/news/keystone-1-7-say-what-the-request-needs-not-how-hard-it-is.jsonld"}}