@linxiraos/pi-catalog 1.4.4 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +3 -3
  3. package/dist/types/build.d.ts +12 -4
  4. package/dist/types/compat/anthropic.d.ts +20 -0
  5. package/dist/types/compat/behavior.d.ts +2 -0
  6. package/dist/types/compat/catalog-policy.d.ts +2 -2
  7. package/dist/types/compat/collapse.d.ts +10 -0
  8. package/dist/types/compat/factory-droid.d.ts +2 -0
  9. package/dist/types/compat/resolve.d.ts +2 -2
  10. package/dist/types/compat/types.d.ts +5 -1
  11. package/dist/types/discovery/antigravity.d.ts +7 -2
  12. package/dist/types/discovery/codex.d.ts +4 -5
  13. package/dist/types/discovery/devin.d.ts +1 -1
  14. package/dist/types/model-cache.d.ts +8 -0
  15. package/dist/types/model-catalog-format.d.ts +37 -0
  16. package/dist/types/models.d.ts +6 -3
  17. package/dist/types/provider-models/google.d.ts +2 -0
  18. package/dist/types/provider-models/openai-compat.d.ts +16 -3
  19. package/dist/types/types.d.ts +58 -3
  20. package/dist/types/wire/codex.d.ts +1 -1
  21. package/dist/types/wire/devin.d.ts +2 -2
  22. package/dist/types/wire/gemini-headers.d.ts +41 -22
  23. package/dist/types/wire/xiaomi-token-plan.d.ts +2 -0
  24. package/package.json +6 -10
  25. package/src/build.d.ts +12 -4
  26. package/src/build.ts +97 -4
  27. package/src/compat/anthropic.d.ts +20 -0
  28. package/src/compat/anthropic.ts +47 -0
  29. package/src/compat/axes.ts +16 -3
  30. package/src/compat/behavior.d.ts +2 -0
  31. package/src/compat/behavior.ts +5 -0
  32. package/src/compat/catalog-policy.ts +10 -8
  33. package/src/compat/collapse.d.ts +10 -0
  34. package/src/compat/collapse.ts +63 -2
  35. package/src/compat/factory-droid.d.ts +2 -0
  36. package/src/compat/factory-droid.ts +3 -0
  37. package/src/compat/resolve.d.ts +2 -2
  38. package/src/compat/resolve.ts +7 -5
  39. package/src/compat/rules/README.md +24 -16
  40. package/src/compat/rules/auth/google-antigravity.kdl +2 -1
  41. package/src/compat/rules/auth/llama.cpp.kdl +1 -1
  42. package/src/compat/rules/auth/typesafe.kdl +2 -1
  43. package/src/compat/rules/auth/xiaomi-token-plan-ams.kdl +1 -1
  44. package/src/compat/rules/auth/xiaomi-token-plan-cn.kdl +1 -1
  45. package/src/compat/rules/auth/xiaomi-token-plan-sgp.kdl +1 -1
  46. package/src/compat/rules/classes/anthropic.kdl +6 -1
  47. package/src/compat/rules/classes/deepseek.kdl +2 -1
  48. package/src/compat/rules/classes/minimax.kdl +10 -0
  49. package/src/compat/rules/classes/openai.kdl +2 -2
  50. package/src/compat/rules/providers/anthropic.kdl +15 -1
  51. package/src/compat/rules/providers/deepseek.kdl +13 -10
  52. package/src/compat/rules/providers/factory-droid.kdl +72 -0
  53. package/src/compat/rules/providers/google-antigravity.kdl +7 -0
  54. package/src/compat/rules/providers/google-vertex.kdl +3 -0
  55. package/src/compat/rules/providers/kimi-code.kdl +26 -0
  56. package/src/compat/rules/providers/mistral.kdl +8 -0
  57. package/src/compat/rules/providers/moonshot.kdl +25 -0
  58. package/src/compat/rules/providers/muse-code.kdl +1 -1
  59. package/src/compat/rules/providers/openai-codex.kdl +17 -4
  60. package/src/compat/rules/providers/openai.kdl +23 -2
  61. package/src/compat/rules/providers/opencode-go.kdl +38 -3
  62. package/src/compat/rules/providers/opencode-zen.kdl +7 -0
  63. package/src/compat/rules/providers/xiaomi-token-plan-ams.kdl +1 -1
  64. package/src/compat/rules/providers/xiaomi-token-plan-cn.kdl +1 -1
  65. package/src/compat/rules/providers/xiaomi-token-plan-sgp.kdl +1 -1
  66. package/src/compat/rules/providers/xiaomi.kdl +1 -1
  67. package/src/compat/rules/runtime/behavior.kdl +39 -20
  68. package/src/compat/rules/taxonomy/kimi.kdl +7 -0
  69. package/src/compat/rules.json +1 -1
  70. package/src/compat/types.d.ts +5 -1
  71. package/src/compat/types.ts +5 -1
  72. package/src/discovery/antigravity.d.ts +7 -2
  73. package/src/discovery/antigravity.ts +41 -6
  74. package/src/discovery/codex.d.ts +4 -5
  75. package/src/discovery/codex.ts +5 -6
  76. package/src/discovery/cursor.ts +0 -6
  77. package/src/discovery/devin.d.ts +1 -1
  78. package/src/discovery/devin.ts +9 -3
  79. package/src/discovery/factory-droid.ts +38 -6
  80. package/src/model-cache.d.ts +8 -0
  81. package/src/model-cache.ts +55 -5
  82. package/src/model-catalog-format.d.ts +37 -0
  83. package/src/model-catalog-format.ts +299 -0
  84. package/src/models.d.ts +6 -3
  85. package/src/models.json +1 -1
  86. package/src/models.ts +16 -10
  87. package/src/provider-models/cache-provider-id.ts +26 -6
  88. package/src/provider-models/google.d.ts +2 -0
  89. package/src/provider-models/google.ts +13 -1
  90. package/src/provider-models/openai-compat.d.ts +16 -3
  91. package/src/provider-models/openai-compat.ts +207 -58
  92. package/src/provider-models/special.ts +5 -6
  93. package/src/types.d.ts +58 -3
  94. package/src/types.ts +63 -1
  95. package/src/wire/codex.d.ts +1 -1
  96. package/src/wire/codex.ts +1 -1
  97. package/src/wire/devin.d.ts +2 -2
  98. package/src/wire/devin.ts +2 -2
  99. package/src/wire/gemini-headers.d.ts +41 -22
  100. package/src/wire/gemini-headers.ts +68 -24
  101. package/src/wire/xiaomi-token-plan.d.ts +2 -0
  102. package/src/wire/xiaomi-token-plan.ts +4 -0
  103. package/src/models.json.d.ts +0 -9
@@ -179,16 +179,16 @@ provider "openrouter" {
179
179
 
180
180
  ### Selectors and nesting
181
181
 
182
- | Selector | Form | Matching semantics |
183
- | ---------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
184
- | `class` | `class "id" { ... }` | Exact class ID. At document root it may contain `on`, `on-api`, `family`, `revision`, and `models`. Under `provider` it may contain `family`, `revision`, and `models`. |
185
- | `provider` | `provider "id" { ... }` | Exact provider ID. It is root-only and may contain `class`, `on-api`, and `models`. |
186
- | `on` | `on "provider-a" "provider-b" { ... }` | One or more provider IDs, combined as OR. It is allowed under a root `class`, and may contain `on-api` to conjoin an API scope plus `family`, `revision`, and `models`. |
187
- | `on-api` | `on-api "adapter-a" "adapter-b" { ... }` | One or more request adapter IDs, combined as OR. At document root it may contain `class` and `models`; under a root `class` (directly or nested inside `on`) or `provider` it may contain `family`, `revision`, and `models`. |
188
- | `family` | `family "id" { ... }` | Exact classified family ID. It may contain `revision` and `models`. A target with no family does not match. |
189
- | `revision` | `revision ">=2.5 <4" { ... }` | A non-empty, whitespace-separated conjunction of comparisons. It may contain `models`. A target with no revision does not match. |
190
- | `models` | `models "id" "vendor/*" { ... }` | One or more alternatives, combined as OR. It may contain only `on-upstream`. `token="name"` matches an ASCII-case-insensitive token bounded by non-alphanumerics. |
191
- | `on-upstream` | `on-upstream "a" "b" { ... }` | Exact selected upstream IDs, combined as OR. Allowed inside any selector scope once; preserves the containing scope's other permitted children. Absent upstream never matches. |
182
+ | Selector | Form | Matching semantics |
183
+ | ------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
184
+ | `class` | `class "id" { ... }` | Exact class ID. At document root it may contain `on`, `on-api`, `family`, `revision`, and `models`. Under `provider` it may contain `family`, `revision`, and `models`. |
185
+ | `provider` | `provider "id" { ... }` | Exact provider ID. It is root-only and may contain `class`, `on-api`, and `models`. |
186
+ | `on` | `on "provider-a" "provider-b" { ... }` | One or more provider IDs, combined as OR. It is allowed under a root `class`, and may contain `on-api` to conjoin an API scope plus `family`, `revision`, and `models`. |
187
+ | `on-api` | `on-api "adapter-a" "adapter-b" { ... }` | One or more request adapter IDs, combined as OR. At document root it may contain `class` and `models`; under a root `class` (directly or nested inside `on`) or `provider` it may contain `family`, `revision`, and `models`. |
188
+ | `family` | `family "id" { ... }` | Exact classified family ID. It may contain `revision` and `models`. A target with no family does not match. |
189
+ | `revision` | `revision ">=2.5 <4" { ... }` | A non-empty, whitespace-separated conjunction of comparisons. It may contain `models`. A target with no revision does not match. |
190
+ | `models` | `models "id" "vendor/*" { ... }` | One or more alternatives, combined as OR. It may contain only `on-upstream`. `token="name"` matches an ASCII-case-insensitive token bounded by non-alphanumerics. |
191
+ | `on-upstream` | `on-upstream "a" "b" { ... }` | Exact selected upstream IDs, combined as OR. Allowed inside any selector scope once; preserves the containing scope's other permitted children. Absent upstream never matches. |
192
192
 
193
193
  Every selector scope may additionally contain `on-upstream`; it cannot replace an already constrained upstream. Class, provider/`on`, `on-api`, `on-upstream`, and family values are compared exactly and case-sensitively to the structured resolve target. Revision operators are `>=`, `>`, `<=`, `<`, and `=`; operands have one to three dot-separated unsigned 8-bit components, omitted components zero.
194
194
 
@@ -223,15 +223,15 @@ One object axis carries a computed form: `long-context-cost` accepts either the
223
223
 
224
224
  `long-context-window-uncapped #true` keeps a model's `long-context-cost` tier from capping its runtime context window while extended context is off: the coding agent normally lowers the window to the tier's input threshold so compaction fires before a request crosses into premium pricing. Use it where the tier is an API-equivalent estimate on a subscription host (`xai-oauth`) or where the model is served at its full window regardless (GPT-5.4, except on GitHub Copilot). `buildModel` materializes it as `Model.longContextWindowUncapped`; explicit user context overrides still apply.
225
225
 
226
- `max-tokens-fallback` seeds `maxTokens` only when the row reports none, and `max-tokens-ceiling` lowers a larger reported `maxTokens` to the host's output cap (an unknown budget stays unknown unless a fallback seeded it). Both apply in `buildModel` after `limits-patch`, so discovery mappers pass upstream output budgets through verbatim. See the Kimi rules in [`providers/fireworks.kdl`](providers/fireworks.kdl).
226
+ `max-tokens-fallback` seeds `maxTokens` only when the row reports none, and `max-tokens-ceiling` lowers a larger reported `maxTokens` to the host's output cap (an unknown budget stays unknown unless a fallback seeded it); the ceiling also lowers discovered Antigravity per-SKU `maxOutputTokens` (`antigravityWireProfiles`, row and per-account), which the transport sends verbatim. Both apply in `buildModel` after `limits-patch`, so discovery mappers pass upstream output budgets through verbatim. See the Kimi rules in [`providers/fireworks.kdl`](providers/fireworks.kdl).
227
227
 
228
- `inline-image-byte-budget` caps retained base64 image characters for a deployment's request body. It leaves room for tool schemas and text beneath the provider's body-size limit; the coding agent reads it through `resolveInlineImageByteBudget` before sending live history, and snapcompact gives its archive frames half of it (`frameDataBytesBudget`). The budget applies only while the request reaches the host the rules describe (the Anthropic API, first-party OpenAI, the Codex backend at its default URL, or Factory Droid's own global or EU API host), which callers decide with pi-ai's `reachesBudgetedHost`: `compat.officialEndpoint` for the configured `baseUrl`, for first-party Anthropic models also the `ANTHROPIC_BASE_URL` or Foundry `FOUNDRY_BASE_URL` reroute applied at request time, and for Factory Droid models the `baseUrl` origin. A custom or rerouted endpoint imposes its own body limit.
228
+ `inline-image-byte-budget` caps retained base64 image characters for a deployment's request body. It leaves room for tool schemas and text beneath the provider's body-size limit; the coding agent reads it through `resolveInlineImageByteBudget` before sending live history, and snapcompact gives its archive frames half of it (`frameDataBytesBudget`). The budget applies only while the request reaches the host the rules describe (the Anthropic API, first-party OpenAI, the Codex backend at its default URL, DeepSeek's API, or Factory Droid's own global or EU API host), which callers decide with pi-ai's `reachesBudgetedHost`: `compat.officialEndpoint` for the configured `baseUrl`, for first-party Anthropic models also the `ANTHROPIC_BASE_URL` or Foundry `FOUNDRY_BASE_URL` reroute applied at request time, and for Factory Droid models the `baseUrl` origin. A custom or rerouted endpoint imposes its own body limit.
229
229
 
230
230
  `request-body-byte-limit` is the largest request body the host accepts (Factory Droid's hosted routes: 4,500,000 bytes), under the same gate. Where it is set, the byte clamp keeps the inline images of the newest user message and then of the newest image-bearing tool result even past `inline-image-byte-budget`, each only while the kept images fit the limit less the request's other serialized bytes, and evicts older images instead; read through `resolveRequestBodyByteLimit`.
231
231
 
232
- `catalog-endpoint-budgets #true` makes these host budgets apply whenever a request reaches the provider's own catalog endpoint (an unset `baseUrl`, or an `endpoint-hosts` host; see `isCatalogEndpointUrl`), for a hosted gateway such as Factory Droid whose compat names no official endpoint. Unassigned, they apply only on the official endpoint.
232
+ `catalog-endpoint-budgets #true` makes these host budgets apply whenever a request reaches the provider's own catalog endpoint (an unset `baseUrl`, or an `endpoint-hosts` host; see `isCatalogEndpointUrl`), for a hosted gateway such as Factory Droid whose compat names no official endpoint, or a first-party provider such as DeepSeek whose `openai-completions` compat resolves no `officialEndpoint`. Unassigned, they apply only on the official endpoint.
233
233
 
234
- `image-count-budget` is the most images one request may carry, archive frames, screenshots and imaged tool results combined. The coding agent reads it through `resolveImageCountBudget`, drops the oldest images past it, and caps snapcompact frames at it; unassigned hosts get a floor of 5. `official-image-count-budget` replaces it while the request reaches the host the rules describe (same gate as `inline-image-byte-budget`), for limits established on the host's own endpoint (Anthropic: 600, 100 on 200k-window models; Codex: 2,000); a custom or rerouted endpoint keeps `image-count-budget` (Anthropic 90, Codex 200).
234
+ `image-count-budget` is the most images one request may carry, archive frames, screenshots and imaged tool results combined. The coding agent reads it through `resolveImageCountBudget`, drops the oldest images past it, and caps snapcompact frames at it; unassigned hosts get a floor of 5. `official-image-count-budget` replaces it while the request reaches the host the rules describe (same gate as `inline-image-byte-budget`), for limits established on the host's own endpoint (Anthropic: 600, 100 on 200k-window models; Codex: 2,000; DeepSeek: 600); a custom or rerouted endpoint keeps `image-count-budget` (Anthropic 90, Codex 200, DeepSeek 5).
235
235
 
236
236
  `endpoint-hosts` lists the HTTPS hostnames a provider serves besides its bundled base URL's host, such as Copilot's per-plan `api.<plan>.githubcopilot.com` hosts. That host plus these define the provider's own endpoint (`isCatalogEndpointUrl`), which separates first-party traffic from a custom model or provider override that keeps a catalog provider id but points `baseUrl` at a gateway, proxy, or local server. Connection prewarming and request compression act only on the provider's own endpoint.
237
237
 
@@ -245,7 +245,12 @@ One object axis carries a computed form: `long-context-cost` accepts either the
245
245
 
246
246
  `prompt-cache-persistent #true` marks a provider whose own endpoint keeps prompt-cache entries indefinitely (logged-in Codex accounts). The coding agent reads it through `isPromptCachePersistent` and skips idle compaction, which would only discard a prefix that stays warm; a custom `baseUrl` reusing the provider id does not qualify. Unassigned means entries expire.
247
247
 
248
- `task-sibling-prompt-cache #true` lets Task children use an automatically derived sibling cache key on the matching request model. Missing or `#false` keeps the provider's per-child default; explicit cache keys still win. The session resolves this catalog policy against the actual model for primary turns, handoff, and ephemeral requests that reuse the live context, including model changes, without sharing conversation IDs or response state. The automatic candidate is persisted separately from explicit keys and survives full forks, `/tan`, and session reopening; new and partial sessions discard it. A fork carrying an automatic candidate uses its own conversation ID on unsupported models, and re-enables the candidate when returning to an eligible model. Ordinary forks without an automatic candidate keep their existing inherited cache routing. Conventional compaction keeps its existing cache routing because its serialized summary prompt differs from the primary context. The opt-in covers Muse Code's `muse-spark-1.3`, `muse-spark-1.3-contributor`, `muse-wonder-1.0`, `muse-wonder-1.0-contributor`, `muse-wonder-full-1.0`, and `muse-wonder-full-1.0-contributor` over `openai-responses`. Meta documents shared-prefix `prompt_cache_key` routing for Responses. Warmed sibling cache reuse was measured on Spark 1.3 Contributor; the standard Spark variant shares this scope following maintainer guidance. A bounded synthetic probe observed cache reuse on all four Wonder variants; it does not establish production or latency benefits. Auxiliary-request latency has not been measured. Provider selectors also match custom providers that declare the same `providerType`; no benefit is established for custom endpoints.
248
+ `shared-prompt-cache #true` marks a lane that rewards routing related requests under one shared prompt-cache key instead of each conversation's own identity. Missing or `#false` keeps per-conversation routing. Two consumers read it against the model each request actually sends (primary turns, handoff, side requests, and remote compaction under its `remoteCompaction.api`/`model` override):
249
+
250
+ - The coding agent gives a Task child the derived sibling key `<parent cache key>:<agent>` only on opted-in models; an explicit key (`--prompt-cache-key`, an SDK key, or a full fork's inherited key) always wins. The candidate is persisted on the session header at its first eligible request and survives full forks, `/tan`, and reopening; new and partial sessions discard it.
251
+ - OpenCode Go (`providerType ?? provider` is `opencode-go`) sends any explicit prompt-cache key as `x-opencode-session`, so siblings, forks, and their parent share one gateway cache. Without an explicit key the header keeps the conversation id. Credentials and response state stay per conversation.
252
+
253
+ Opted in: Muse Code `muse-spark-1.3`, `muse-spark-1.3-contributor`, and the four Wonder variants over `openai-responses` (Meta documents shared-prefix `prompt_cache_key` routing; sibling reuse measured on Spark 1.3 Contributor). OpenCode Go `muse-spark-1.3-contributor`, `muse-spark-1.2-contributor`, `gpt-5.6-luna`, `gpt-6-luna`, and `grok-4.6` over `openai-responses`, and `deepseek-v4-pro` and `omen-alpha` over `openai-completions`. A Go lane qualifies only when a cold / different-family / same-family probe warms on the repeated key and stays cold under the different key; [`providers/opencode-go.kdl`](providers/opencode-go.kdl) records the per-lane tallies and the lanes that warmed under any key (and so gain nothing). The standard Go `muse-spark-1.3`/`1.2` ids stay off: the gateway answers "Model is unavailable". Custom providers opt in only by declaring a matching `providerType`.
249
254
 
250
255
  `image-max-edge` is the longest image edge, in pixels, a host passes to the model; it downscales larger images to fit first (Cursor: 1024 for Claude and GPT). Snapcompact reads it through `resolveImageMaxEdge` and renders frames no wider, so their glyphs reach the model at the size they were drawn; unassigned means the host keeps the image's size.
251
256
 
@@ -322,6 +327,7 @@ behavior {
322
327
  exclude-substring "embedding"
323
328
  }
324
329
  model-operations provider="openai" { exact "o3"; prefix "gpt-"; operation "generate_image" }
330
+ append-only-context-providers "deepseek" "ollama" "google-antigravity" "google" "google-vertex"
325
331
  cursor-effort family-marker="gpt-" { tier "minimal" "low" "medium" "high" "xhigh" "max" }
326
332
  cursor-model-parameter model="composer-2.5" id="fast" value="false"
327
333
  quota-tiers provider="openai-codex" {
@@ -350,6 +356,8 @@ behavior {
350
356
 
351
357
  `exclude-discovery-modes` takes one or more exact, case-sensitive upstream mode strings plus `provider=`; discovery mappers preserve missing, malformed, and unknown modes unless the provider policy explicitly lists them. Matcher properties on `route` / `exclude-models` / `tier` nodes are `exact=` / `prefix=` / `substring=` / `glob=`, repeatable. `strip-prefix=#true` on a prefix route strips the matched prefix off the wire id. Values are copied verbatim from the TS constants they replaced; runtime accessors live in `src/compat/behavior.ts`.
352
358
 
359
+ `append-only-context-providers` names hosts whose prefix caches benefit from append-only message history. The coding agent uses this list for `provider.appendOnlyContext: auto`; user `on`/`off` always takes precedence, and URL/explicit stored-request signals remain separate.
360
+
353
361
  `role-defaults "<role>"` declares one agent role's built-in default model selector chain, one `model "<selector>"` child per entry, most preferred first. Selectors are copied verbatim (`provider/id`, bare ids, fuzzy fragments such as `-mini`, and `@role` references); duplicates within a role and repeated roles are compile errors. `roleDefaultModels()` returns every chain keyed by role in declaration order.
354
362
 
355
363
  ## Auth grammar
@@ -407,7 +415,7 @@ auth "anthropic" {
407
415
 
408
416
  Login kinds:
409
417
 
410
- - `login "api-key" { auth-url "…"; instructions "…"; prompt "…" placeholder="…"; empty-fallback "…"; normalize "strip-bearer"; validate … }` — `validate "chat-completions" base-url= model= tolerate-model-denied= max-tokens-field= max-tokens=`, `validate "anthropic-messages" base-url= model=`, or `validate "models-endpoint" url= base-url-env= headers-hook=`; all accept `label=` (error-message label, defaults to `name`), `optional=#true` (only auth failures reject), and `trust-forbidden=#true` (requires `optional=#true`; a 403 no longer rejects, so only a 401 does).
418
+ - `login "api-key" { auth-url "…"; instructions "…"; prompt "…" placeholder="…"; empty-fallback "…"; normalize "strip-bearer"; validate … }` — `validate "chat-completions" base-url= model= tolerate-model-denied= max-tokens-field= max-tokens=`, `validate "anthropic-messages" base-url= model=`, or `validate "models-endpoint" url= base-url-env= base-url-path= headers-hook=` (`base-url-path`, default `/models`, is appended to the `base-url-env` value and needs it); all accept `label=` (error-message label, defaults to `name`), `optional=#true` (only auth failures reject), and `trust-forbidden=#true` (requires `optional=#true`; a 403 no longer rejects, so only a 401 does).
411
419
  - `login "oauth-code" { … }` as above; `token`/`refresh` `params` values may use `{code}`, `{state}`, `{redirect_uri}`, `{code_verifier}`, `{client_id}`, `{client_secret}`, `{refresh_token}`, `{scope}`; the standard grant parameters are sent unless `standard=#false`.
412
420
  - `login "device-code" { client-id …; base-url "…"; scopes …; headers-hook "…"; device url="{base}/…" body="form" { params {…} headers {…} }; token url="…" url-hook="…"; response user-code= device-code= verification-uri= verification-uri-complete= interval= expires-in=; instructions "Enter code: {user_code}"; credential {…}; userinfo …; after-exchange hook=… }`.
413
421
  - `login "custom" hook="name"` — the whole flow is a named `@linxiraos/pi-ai` hook (`src/registry/hooks/custom.ts`).
@@ -7,7 +7,8 @@ auth "google-antigravity" {
7
7
  authorize-url "https://accounts.google.com/o/oauth2/v2/auth"
8
8
  scopes "https://www.googleapis.com/auth/cloud-platform" "https://www.googleapis.com/auth/userinfo.email" \
9
9
  "https://www.googleapis.com/auth/userinfo.profile" "https://www.googleapis.com/auth/cclog" \
10
- "https://www.googleapis.com/auth/experimentsandconfigs"
10
+ "https://www.googleapis.com/auth/experimentsandconfigs" "https://www.googleapis.com/auth/aicode"
11
+ pkce #true
11
12
  authorize-params { access_type "offline"; prompt "consent" }
12
13
  instructions "Complete the sign-in in your browser."
13
14
  callback port=51121 path="/oauth-callback" hostname="127.0.0.1"
@@ -3,7 +3,7 @@ auth "llama.cpp" {
3
3
  env "LLAMA_CPP_API_KEY"
4
4
  login "api-key" {
5
5
  auth-url "https://github.com/ggml-org/llama.cpp#quick-start"
6
- instructions "Paste your llama.cpp API key if your server requires auth. Leave empty for local no-auth mode (default base URL: http://127.0.0.1:8080; set LLAMA_CPP_BASE_URL to customize)."
6
+ instructions "Paste your llama.cpp API key if your server requires auth. Leave empty for local no-auth mode (default base URLs: http://127.0.0.1:8080, then http://127.0.0.1:9931; set LLAMA_CPP_BASE_URL to customize)."
7
7
  prompt "Paste your llama.cpp API key (optional for local no-auth)" placeholder="llama-cpp-local"
8
8
  empty-fallback "llama-cpp-local"
9
9
  }
@@ -8,6 +8,7 @@ auth "typesafe" {
8
8
  auth-url "https://console.typesafe.ai/"
9
9
  instructions "Create or copy your API key from the TypeSafe console."
10
10
  prompt "Paste your TypeSafe API key" placeholder="API key"
11
- validate "models-endpoint" label="TypeSafe" url="https://api.typesafe.ai/v1/models" base-url-env="TYPESAFE_BASE_URL"
11
+ // TYPESAFE_BASE_URL is an origin without `/v1` (the SDK appends `/v1/systemone`).
12
+ validate "models-endpoint" label="TypeSafe" url="https://api.typesafe.ai/v1/models" base-url-env="TYPESAFE_BASE_URL" base-url-path="/v1/models"
12
13
  }
13
14
  }
@@ -4,6 +4,6 @@ auth "xiaomi-token-plan-ams" {
4
4
  auth-url "https://platform.xiaomimimo.com/console/plan-manage"
5
5
  instructions "Copy your token-plan API key for the Europe region"
6
6
  prompt "Paste your Xiaomi Token Plan Europe API key (tp-...)" placeholder="tp-..."
7
- validate "chat-completions" label="xiaomi" base-url="https://token-plan-ams.xiaomimimo.com/v1" model="mimo-v2.5"
7
+ validate "chat-completions" label="xiaomi" base-url="https://token-plan-ams.xiaomimimo.com/v1" model="mimo-v2.6-flash"
8
8
  }
9
9
  }
@@ -4,6 +4,6 @@ auth "xiaomi-token-plan-cn" {
4
4
  auth-url "https://platform.xiaomimimo.com/console/plan-manage"
5
5
  instructions "Copy your token-plan API key for the China region"
6
6
  prompt "Paste your Xiaomi Token Plan China API key (tp-...)" placeholder="tp-..."
7
- validate "chat-completions" label="xiaomi" base-url="https://token-plan-cn.xiaomimimo.com/v1" model="mimo-v2.5"
7
+ validate "chat-completions" label="xiaomi" base-url="https://token-plan-cn.xiaomimimo.com/v1" model="mimo-v2.6-flash"
8
8
  }
9
9
  }
@@ -4,6 +4,6 @@ auth "xiaomi-token-plan-sgp" {
4
4
  auth-url "https://platform.xiaomimimo.com/console/plan-manage"
5
5
  instructions "Copy your token-plan API key for the Singapore region"
6
6
  prompt "Paste your Xiaomi Token Plan Singapore API key (tp-...)" placeholder="tp-..."
7
- validate "chat-completions" label="xiaomi" base-url="https://token-plan-sgp.xiaomimimo.com/v1" model="mimo-v2.5"
7
+ validate "chat-completions" label="xiaomi" base-url="https://token-plan-sgp.xiaomimimo.com/v1" model="mimo-v2.6-flash"
8
8
  }
9
9
  }
@@ -742,9 +742,14 @@ class "anthropic" {
742
742
  }
743
743
  on "google-antigravity" {
744
744
  drop-unsigned-thinking #true
745
- claude-thinking-beta-header #true
746
745
  antigravity-claude-tool-mode #true
747
746
  antigravity-usage-label "true"
747
+ // The interleaved-thinking beta gated Claude 4.x thinking here. The
748
+ // native 2.26.0 client sends no beta for Claude 5.5, whose thinking
749
+ // streams without it.
750
+ revision "<5" {
751
+ claude-thinking-beta-header #true
752
+ }
748
753
  }
749
754
  }
750
755
 
@@ -90,10 +90,11 @@ class "deepseek" {
90
90
  }
91
91
  // V4.1 Flash is natively multimodal (vision encoder + projector, image-text
92
92
  // pre-training) but its release id carries no `vision` token to key on.
93
+ // The leading glob also covers publisher-namespaced ids (`ds/deepseek-flash`).
93
94
  // Same priority as the V4.1 Flash carve-out: the OpenCode Go provider rule
94
95
  // declares the same value for its `deepseek-flash` lane and would otherwise
95
96
  // tie at equal rank.
96
- models "deepseek-flash" priority=10 {
97
+ models "*deepseek-flash" priority=10 {
97
98
  strip-image-input #false
98
99
  }
99
100
  // DSML is the model's own tool-call grammar, not a host quirk: any server
@@ -48,6 +48,16 @@ class "minimax" {
48
48
  }
49
49
  }
50
50
  }
51
+ // MiniMax's standard API doubles every rate above 512K input tokens;
52
+ // subscription hosts retain the same rates only as usage estimates.
53
+ on "minimax" "minimax-cn" "minimax-code" "minimax-code-cn" {
54
+ models "MiniMax-M3" {
55
+ long-context-cost {
56
+ input-threshold 512000
57
+ multiplier 2.0
58
+ }
59
+ }
60
+ }
51
61
  on "alibaba-coding-plan" "minimax-code" "minimax-code-cn" "wafer-serverless" {
52
62
  supports-developer-role #false
53
63
  }
@@ -84,14 +84,14 @@ class "openai" {
84
84
  on-api "openai-responses" {
85
85
  revision ">=5" {
86
86
  web-search "openai"
87
- web-search-model "gpt-5.6-luna"
87
+ web-search-model "gpt-6-luna"
88
88
  hosted-image #true
89
89
  image-model "gpt-image-2"
90
90
  }
91
91
  }
92
92
  on-api "openai-codex-responses" {
93
93
  revision ">=5" {
94
- web-search-model "gpt-5.6-luna"
94
+ web-search-model "gpt-6-luna"
95
95
  hosted-image #true
96
96
  image-model "gpt-image-2"
97
97
  }
@@ -116,13 +116,27 @@ provider "anthropic" {
116
116
  family "fable" {
117
117
  server-side-fallback-models "claude-opus-5"
118
118
  // Fallback-credit redemption targets: the refused model's permitted
119
- // fallback targets. Fable 5 and 5.1 → Opus 4.8 and Opus 5
119
+ // fallback targets
120
120
  // (https://platform.claude.com/docs/en/build-with-claude/fallback-credit).
121
+ // Fable 5 and 5.1 → Opus 4.8 and Opus 5.
121
122
  fallback-credit-targets "claude-opus-4-8" "claude-opus-5"
122
123
  }
123
124
  family "mythos" {
124
125
  server-side-fallback-models "claude-opus-5"
125
126
  }
127
+ family "opus" {
128
+ revision "=5.5" {
129
+ fallback-credit-targets "claude-opus-4-8" "claude-opus-5"
130
+ }
131
+ revision "=5" {
132
+ fallback-credit-targets "claude-opus-4-8"
133
+ }
134
+ }
135
+ family "sonnet" {
136
+ revision "=5.5" {
137
+ fallback-credit-targets "claude-sonnet-5"
138
+ }
139
+ }
126
140
  }
127
141
  // residue: taxonomy ranks and exact globs do not isolate these models.
128
142
  models "*20240229" "claude-3-7-sonnet-20250219" {
@@ -5,6 +5,18 @@ provider "deepseek" {
5
5
  env "DEEPSEEK_API_KEY"
6
6
  discovery label="DeepSeek"
7
7
 
8
+ // DeepSeek's vision guide documents 600 images per request and a 48 MiB
9
+ // request body. OMP reserves 8 MiB for text, tools, and the JSON envelope
10
+ // (48 MiB - 8 MiB = 40 MiB); Anthropic's 24,000,000-byte image budget under
11
+ // its 32 MB body uses an 8 MB reserve. DeepSeek documents MiB, so this uses
12
+ // an 8 MiB reserve. The split is OMP's conservative margin, not a
13
+ // DeepSeek-documented figure. A custom baseUrl keeps the conservative
14
+ // catalog floor because the gateway's own limits are unknown.
15
+ // Source: https://api-docs.deepseek.com/guides/vision#limits
16
+ catalog-endpoint-budgets #true
17
+ official-image-count-budget 600
18
+ inline-image-byte-budget 41943040
19
+
8
20
  extra-body {
9
21
  thinking {
10
22
  type "enabled"
@@ -52,7 +64,7 @@ provider "deepseek" {
52
64
  max-tokens 384000
53
65
  }
54
66
  }
55
- // residue: the dated price transition applies to the documented exact Pro SKU only.
67
+ // DeepSeek kept Pro billing unchanged after September 14 (2026-09-10 change log).
56
68
  models "deepseek-v4-pro" {
57
69
  cost-patch {
58
70
  input 1.32
@@ -74,15 +86,6 @@ provider "deepseek" {
74
86
  end-minute 600
75
87
  }
76
88
  }
77
- effective-rates {
78
- flash-pricing {
79
- effective-from "2026-09-14T04:00:00Z"
80
- input 0.30
81
- output 1.20
82
- cache-read 0.006
83
- cache-write 0
84
- }
85
- }
86
89
  }
87
90
  }
88
91
  // residue: taxonomy ranks and exact globs do not isolate these models.
@@ -345,6 +345,12 @@ provider "factory-droid" {
345
345
  cost input=0 output=0 cache-read=0 cache-write=0
346
346
  limits context=136464 max-tokens=65536
347
347
  }
348
+ model "deepseek-v4.1-flash-1017" name="DeepSeek V4.1 Flash 1017" {
349
+ reasoning #true
350
+ input "text" "image"
351
+ cost input=0 output=0 cache-read=0 cache-write=0
352
+ limits context=908928 max-tokens=131072
353
+ }
348
354
  model "deepseek-v4.1-flash" name="DeepSeek V4.1 Flash" {
349
355
  reasoning #true
350
356
  input "text" "image"
@@ -405,6 +411,26 @@ provider "factory-droid" {
405
411
  cost input=0 output=0 cache-read=0 cache-write=0
406
412
  limits context=196600 max-tokens=64000
407
413
  }
414
+ // `generate_image` models, in the CLI's tool preference order. GPT Image 2
415
+ // is retired from the CLI's selectable chain and is not listed.
416
+ model "gpt-image-2.5-sunburst" name="GPT Image 2.5" {
417
+ reasoning #false
418
+ input "text" "image"
419
+ cost input=0 output=0 cache-read=0 cache-write=0
420
+ limits
421
+ }
422
+ model "gpt-image-2.5-flare" name="GPT Image 2.5 Flare" {
423
+ reasoning #false
424
+ input "text" "image"
425
+ cost input=0 output=0 cache-read=0 cache-write=0
426
+ limits
427
+ }
428
+ model "gemini-3-pro-image-preview" name="Gemini 3 Pro Image" {
429
+ reasoning #false
430
+ input "text" "image"
431
+ cost input=0 output=0 cache-read=0 cache-write=0
432
+ limits
433
+ }
408
434
  }
409
435
 
410
436
  // Upstream serving regions (the CLI's upstream region table). A model's own
@@ -836,6 +862,23 @@ provider "factory-droid" {
836
862
  thinking-requires-effort #true
837
863
  thinking-default-level "high"
838
864
  }
865
+ // Image models: the org's `imageGenerationEnabled` and
866
+ // `imageGenerationAllowedModelIds` managed settings gate them
867
+ // (discovery/factory-droid.ts), not feature flags. Credits follow the CLI's
868
+ // image registry: OpenAI output is image tokens at 6x input, Gemini's 60x.
869
+ models "gpt-image-2.5-sunburst" "gpt-image-2.5-flare" {
870
+ kind "image"
871
+ routing-family "openai"
872
+ upstream-rotation "openai"
873
+ credit-rates { input 2.0; output 6 }
874
+ }
875
+ models "gemini-3-pro-image-preview" {
876
+ kind "image"
877
+ routing-family "google"
878
+ upstream-rotation "google"
879
+ region-upstreams-us
880
+ credit-rates { input 0.8; output 60 }
881
+ }
839
882
  models "inkling" {
840
883
  routing-family "factory"
841
884
  upstream-rotation "fireworks"
@@ -938,6 +981,17 @@ provider "factory-droid" {
938
981
  thinking-requires-effort #false
939
982
  thinking-default-level "high"
940
983
  }
984
+ models "deepseek-v4.1-flash-1017" {
985
+ routing-family "factory"
986
+ upstream-rotation "fireworks" "baseten" "databricks"
987
+ credit-rates { input 0.12; output 4; cache-read 0.024 }
988
+ // No bundled Fireworks row for the 1017 slug; Fireworks prices it like V4.1 Flash.
989
+ list-price-from "fireworks" "deepseek-v4.1-flash"
990
+ thinking-efforts "low" "high" "max"
991
+ thinking-requires-effort #false
992
+ thinking-default-level "high"
993
+ entitlement { feature-flag "deepseek_v4_1_flash_1017" }
994
+ }
941
995
  models "deepseek-v4.1-flash" {
942
996
  routing-family "factory"
943
997
  upstream-rotation "fireworks" "baseten" "databricks"
@@ -1094,6 +1148,13 @@ provider "factory-droid" {
1094
1148
  synthetic-reasoning-content-fallback " "
1095
1149
  }
1096
1150
  }
1151
+ // Droid 0.250.0 configures the 1017 checkpoint's Baseten route with
1152
+ // thinkingMode "reasoning-effort": thinking off is sent as `none`.
1153
+ models "deepseek-v4.1-flash-1017" {
1154
+ on-upstream "baseten" {
1155
+ completions-reasoning-mode "effort"
1156
+ }
1157
+ }
1097
1158
  // The replay codec follows the selected route, including EU GLM routes.
1098
1159
  on-upstream "mistral" {
1099
1160
  models "glm-*" "mistral-medium-3.5" "mistral-large-4" {
@@ -1130,6 +1191,12 @@ provider "factory-droid" {
1130
1191
  on-upstream "snowflake" {
1131
1192
  disabled-thinking "disabled"
1132
1193
  }
1194
+ // Factory's proxy honors `ttl: "1h"` without the extended-cache-ttl beta
1195
+ // and the Anthropic and Bedrock upstreams reject the beta.
1196
+ extended-cache-ttl-beta #false
1197
+ on-upstream "anthropic" "vertex_anthropic" "bedrock_anthropic" "azure_anthropic" {
1198
+ supports-long-cache-retention #true
1199
+ }
1133
1200
  }
1134
1201
  // Adaptive models the registry marks `supportsDisabledThinking` send the
1135
1202
  // explicit disabled form at Off on every upstream.
@@ -1137,8 +1204,13 @@ provider "factory-droid" {
1137
1204
  "claude-opus-4-8-fast" "claude-opus-5" "claude-opus-5-fast" "claude-haiku-5-5" {
1138
1205
  disabled-thinking "disabled"
1139
1206
  }
1207
+ // Cache entry lifetimes per retention tier, in seconds, for the cache warmer.
1140
1208
  models "claude-*" "atlas-07-21" "aster-07-15" {
1141
1209
  anthropic-thinking "adaptive-summarized"
1210
+ prompt-cache {
1211
+ short 300
1212
+ long 3600
1213
+ }
1142
1214
  }
1143
1215
  models "claude-opus-4-6" "claude-sonnet-4-6" {
1144
1216
  anthropic-thinking "adaptive"
@@ -52,6 +52,13 @@ provider "google-antigravity" {
52
52
  prompt-cache {
53
53
  short 300
54
54
  }
55
+ // Cloud Code Assist rejects Claude 4.x requests over 64,000 output
56
+ // tokens with a 400 (`Request contains an invalid argument`) even when
57
+ // the roster advertises 65,536 (#3067). The ceiling also lowers the
58
+ // discovered per-SKU wire caps the transport sends verbatim.
59
+ revision "<5" {
60
+ max-tokens-ceiling 64000
61
+ }
55
62
  family "opus" {
56
63
  thinking-mode "budget"
57
64
  }
@@ -4,6 +4,9 @@ provider "google-vertex" {
4
4
  default-model "gemini-3.1-pro-preview"
5
5
  allow-unauthenticated #true
6
6
  image-count-budget 200
7
+ // Vertex publishes Anthropic ids pinned to a revision (`claude-opus-4-8@default`);
8
+ // `google-vertex/claude-opus-4-8` names that model exactly.
9
+ selector-revision-suffix "@default"
7
10
 
8
11
  // Replaces google-shared.ts stripping functionCall/functionResponse ids for Vertex.
9
12
  supports-function-part-id #false
@@ -2,6 +2,7 @@
2
2
 
3
3
  provider "kimi-code" {
4
4
  default-model "kimi-for-coding"
5
+ dynamic-models-authoritative #true
5
6
  discovery label="Kimi Code" {
6
7
  env "KIMI_API_KEY"
7
8
  }
@@ -39,16 +40,41 @@ provider "kimi-code" {
39
40
  thinking-efforts "minimal" "low" "medium" "high"
40
41
  thinking-format "zai"
41
42
  }
43
+ // K2.7 Code Highspeed always thinks (`supports_thinking_type: "only"`) but
44
+ // exposes no adjustable effort ladder (`think_efforts` is omitted).
45
+ models "kimi-for-coding-highspeed" {
46
+ thinking-efforts
47
+ }
42
48
 
43
49
  // /coding/v1/models carries no pricing. `cost-fallback` seeds the public
44
50
  // Moonshot list price only when discovery reports $0, so a future priced
45
51
  // envelope keeps its real rates. `kimi-for-coding` is K2.8 Preview — no
46
52
  // public API SKU exists yet, so it uses the K2.7 Code line rate.
53
+ // K3 bills cache writes at the default 5m TTL rate (omp never requests
54
+ // 1h); K2.x SKUs have no cache-write charge.
55
+ // https://platform.kimi.ai/docs/guide/context-caching
47
56
  models "k3" "k3-256k" {
48
57
  cost-fallback {
49
58
  input 3.0
50
59
  output 15.0
51
60
  cache-read 0.3
61
+ cache-write 3.0
62
+ }
63
+ }
64
+ models "k3.1-pro" {
65
+ cost-fallback {
66
+ input 2.0
67
+ output 10.0
68
+ cache-read 0.2
69
+ cache-write 2.0
70
+ }
71
+ }
72
+ models "k3.1-pro-highspeed" {
73
+ cost-fallback {
74
+ input 4.0
75
+ output 20.0
76
+ cache-read 0.2
77
+ cache-write 4.0
52
78
  }
53
79
  }
54
80
  models "kimi-for-coding" {
@@ -29,6 +29,14 @@ provider "mistral" {
29
29
  // without it, requests only hit replica-local implicit cache. Same shape as
30
30
  // the kimi-code rule (#6049).
31
31
  supports-prompt-cache-key #true
32
+ // The gateway accepts assistant reasoning as text, not DeepSeek's native
33
+ // reasoning_content field, even when it serves DeepSeek-family models.
34
+ requires-reasoning-content-for-tool-calls #false
35
+ requires-reasoning-content-for-all-assistant-turns #false
36
+ // Reasoning streams and replays as typed `thinking` content parts
37
+ // (https://docs.mistral.ai/studio/conversations/reasoning) for every
38
+ // reasoning model the host serves, including GLM and DeepSeek (#17375).
39
+ mistral-reasoning-content-parts #true
32
40
  class "unknown" {
33
41
  thinking-efforts "minimal" "low" "medium" "high" "xhigh"
34
42
  }
@@ -14,6 +14,12 @@ provider "moonshot" {
14
14
  thinking-format "zai"
15
15
  family "k3" {
16
16
  thinking-format "openai"
17
+ // K3 and K3.1 Pro default `max_completion_tokens` to 131072 and
18
+ // accept up to the whole 1M window; the shared catalog reports that
19
+ // ceiling as the output limit, leaving no room for input. Pin the
20
+ // documented default, as `model-limits` does for /models rows.
21
+ // https://platform.kimi.ai/docs/guide/kimi-k3-1-pro-quickstart
22
+ max-tokens-ceiling 131072
17
23
  }
18
24
  thinking-mode "effort"
19
25
  }
@@ -44,6 +50,25 @@ provider "moonshot" {
44
50
  cache-write 3.0
45
51
  }
46
52
  }
53
+ // Official K3.1 Pro rates. The discovery mapper seeds K3 list pricing on
54
+ // every $0 K3-family row, so these must patch rather than fall back.
55
+ // https://platform.kimi.ai/docs/pricing/chat
56
+ models "kimi-k3.1-pro" {
57
+ cost-patch {
58
+ input 2.0
59
+ output 10.0
60
+ cache-read 0.2
61
+ cache-write 2.0
62
+ }
63
+ }
64
+ models "kimi-k3.1-pro-highspeed" {
65
+ cost-patch {
66
+ input 4.0
67
+ output 20.0
68
+ cache-read 0.2
69
+ cache-write 4.0
70
+ }
71
+ }
47
72
  // The /models roster carries no modality metadata for the named vision/vl
48
73
  // SKUs; the bounded id token is the census signal.
49
74
  models token="vision" {
@@ -71,7 +71,7 @@ provider "muse-code" {
71
71
  // Spark 1.3 Contributor warmed siblings hit 10/10 vs 0/10 with per-child keys (2026-10-12).
72
72
  // Meta documents shared-prefix prompt_cache_key routing; keep the opt-in on these exact Muse Code IDs.
73
73
  models "muse-spark-1.3" "muse-spark-1.3-contributor" "muse-wonder-1.0" "muse-wonder-1.0-contributor" "muse-wonder-full-1.0" "muse-wonder-full-1.0-contributor" {
74
- task-sibling-prompt-cache #true
74
+ shared-prompt-cache #true
75
75
  }
76
76
  }
77
77
  // Same capability-less `/v1/models` as Meta: unknown ids are opt-in.
@@ -140,6 +140,19 @@ provider "openai-codex" {
140
140
  ultrafast 8
141
141
  }
142
142
  }
143
+ // GPT-6.1 Terra lists at half GPT-6.1 Sol: $1/$5 with $0.05 cached input
144
+ // (OpenAI API docs, 2026-10-26). OpenAI documents 922K max input (1.05M
145
+ // total); the curated maximum applies only with extended context on, and a
146
+ // higher live maximum still wins. Codex ships no Ultrafast tier for it.
147
+ models "gpt-6.1-terra" "gpt-6.1-terra-wm" {
148
+ cost-patch {
149
+ input 1.0
150
+ output 5.0
151
+ cache-read 0.05
152
+ cache-write 0
153
+ }
154
+ max-context-window 922000
155
+ }
143
156
  models "gpt-6-luna" "gpt-6-luna-wm" {
144
157
  cost-patch {
145
158
  input 0.1
@@ -209,10 +222,10 @@ provider "openai-codex" {
209
222
  models "gpt-5.6-sol*" "gpt-5.6" {
210
223
  long-context-cost {
211
224
  input-threshold 272000
212
- input 10.0
213
- output 45.0
214
- cache-read 1.0
215
- cache-write 12.5
225
+ input 8.0
226
+ output 30.0
227
+ cache-read 0.8
228
+ cache-write 10.0
216
229
  }
217
230
  }
218
231
  models "gpt-5.6-terra*" {