@plurnk/plurnk-providers 1.4.0 → 1.6.0

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 (90) hide show
  1. package/.env.defaults +40 -34
  2. package/README.md +3 -0
  3. package/SPEC.md +153 -62
  4. package/dist/AiSdkProvider.d.ts +19 -25
  5. package/dist/AiSdkProvider.d.ts.map +1 -1
  6. package/dist/AiSdkProvider.js +353 -120
  7. package/dist/AiSdkProvider.js.map +1 -1
  8. package/dist/Mock.d.ts +7 -13
  9. package/dist/Mock.d.ts.map +1 -1
  10. package/dist/Mock.js +36 -8
  11. package/dist/Mock.js.map +1 -1
  12. package/dist/Pool.d.ts +2 -21
  13. package/dist/Pool.d.ts.map +1 -1
  14. package/dist/Pool.js +19 -14
  15. package/dist/Pool.js.map +1 -1
  16. package/dist/accounting.d.ts +6 -0
  17. package/dist/accounting.d.ts.map +1 -0
  18. package/dist/accounting.js +168 -0
  19. package/dist/accounting.js.map +1 -0
  20. package/dist/aiSdkTransport.d.ts +11 -3
  21. package/dist/aiSdkTransport.d.ts.map +1 -1
  22. package/dist/aiSdkTransport.js +198 -29
  23. package/dist/aiSdkTransport.js.map +1 -1
  24. package/dist/catalogProvider.d.ts +7 -2
  25. package/dist/catalogProvider.d.ts.map +1 -1
  26. package/dist/catalogProvider.js +32 -26
  27. package/dist/catalogProvider.js.map +1 -1
  28. package/dist/compatibleProvider.d.ts.map +1 -1
  29. package/dist/compatibleProvider.js +18 -7
  30. package/dist/compatibleProvider.js.map +1 -1
  31. package/dist/cost.d.ts +10 -10
  32. package/dist/cost.d.ts.map +1 -1
  33. package/dist/cost.js +88 -43
  34. package/dist/cost.js.map +1 -1
  35. package/dist/env.d.ts +5 -7
  36. package/dist/env.d.ts.map +1 -1
  37. package/dist/env.js +30 -32
  38. package/dist/env.js.map +1 -1
  39. package/dist/errors.d.ts +14 -2
  40. package/dist/errors.d.ts.map +1 -1
  41. package/dist/errors.js +60 -2
  42. package/dist/errors.js.map +1 -1
  43. package/dist/index.d.ts +4 -4
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +3 -2
  46. package/dist/index.js.map +1 -1
  47. package/dist/ollama.js +3 -3
  48. package/dist/ollama.js.map +1 -1
  49. package/dist/sdkModels.d.ts +6 -0
  50. package/dist/sdkModels.d.ts.map +1 -1
  51. package/dist/sdkModels.js +46 -3
  52. package/dist/sdkModels.js.map +1 -1
  53. package/dist/types.d.ts +40 -29
  54. package/dist/types.d.ts.map +1 -1
  55. package/dist/usage.d.ts +21 -4
  56. package/dist/usage.d.ts.map +1 -1
  57. package/dist/usage.js +188 -74
  58. package/dist/usage.js.map +1 -1
  59. package/package.json +9 -7
  60. package/src/AiSdkProvider.test.ts +1039 -182
  61. package/src/AiSdkProvider.ts +428 -141
  62. package/src/Mock.test.ts +37 -12
  63. package/src/Mock.ts +46 -12
  64. package/src/Pool.test.ts +19 -6
  65. package/src/Pool.ts +20 -16
  66. package/src/ProviderRegistry.test.ts +16 -11
  67. package/src/accounting.test.ts +94 -0
  68. package/src/accounting.ts +190 -0
  69. package/src/aiSdkTransport.test.ts +42 -49
  70. package/src/aiSdkTransport.ts +218 -32
  71. package/src/boundaries.test.ts +2 -0
  72. package/src/catalogProvider.test.ts +271 -24
  73. package/src/catalogProvider.ts +44 -28
  74. package/src/compatibleProvider.test.ts +6 -3
  75. package/src/compatibleProvider.ts +20 -7
  76. package/src/cost.test.ts +55 -35
  77. package/src/cost.ts +110 -54
  78. package/src/defaults.test.ts +13 -3
  79. package/src/env.test.ts +50 -26
  80. package/src/env.ts +43 -42
  81. package/src/errors.test.ts +47 -2
  82. package/src/errors.ts +68 -3
  83. package/src/index.ts +21 -5
  84. package/src/ollama.test.ts +4 -1
  85. package/src/ollama.ts +3 -3
  86. package/src/sdkModels.test.ts +94 -3
  87. package/src/sdkModels.ts +53 -3
  88. package/src/types.ts +91 -33
  89. package/src/usage.test.ts +112 -108
  90. package/src/usage.ts +233 -84
package/.env.defaults CHANGED
@@ -16,14 +16,13 @@
16
16
  # --- Side-channel reasoning (SPEC §4, #32/#33/#399) ---
17
17
  # ACTIVATION and BUDGET are separate so a numeric can never silently flip wire flags.
18
18
  # off | adaptive | on. The provider maps intent to each backend's native mechanism
19
- # (reasoning_effort, enable_thinking, think, ...). Default ADAPTIVE (owner ruling,
20
- # #399): reasoning ACTIVE on a fresh install, each backend's own adaptive depth,
21
- # no shipped magnitude - a reasoning model that ships un-reasoning blind-edits and
22
- # declares done.
19
+ # (reasoning_effort, enable_thinking, think, ...). Default ADAPTIVE (#399):
20
+ # defer activation and depth to the backend's documented default. Use an alias-scoped
21
+ # ON when a reasoning-capable model defaults off and the operator wants it enabled.
23
22
  PLURNK_PROVIDERS_REASONING=adaptive
24
- # Positive int, REQUIRED iff REASONING=on - the magnitude for tier/budget mapping.
25
- # On llama-server it is a request-scoped reasoning allowance and may tighten, but
26
- # cannot exceed, the resolved PLURNK_PROVIDERS_REASONING_RESERVE.
23
+ # Optional positive int when REASONING=on. Without one, ON activates reasoning at
24
+ # the adapter's ordinary enabled posture. On llama-server an explicit value is a
25
+ # request-scoped allowance and may tighten, but cannot exceed, the resolved reserve.
27
26
  # PLURNK_PROVIDERS_REASONING_BUDGET=4096
28
27
 
29
28
  # Response-content interpretation ({§provider-tagged-reasoning}) is independent
@@ -48,10 +47,14 @@ PLURNK_PROVIDERS_FREQUENCY_PENALTY=0
48
47
  # Fixed provider service tier. Fireworks accepts auto|default|flex|priority;
49
48
  # normally set per alias so a paid routing choice is explicit.
50
49
  # PLURNK_PROVIDERS_SERVICE_TIER_myfireworks=priority
51
- # Compatible endpoints verified to accept the OpenAI prompt_cache_key use the
52
- # stable worker id for replica-local prefix affinity. Official native SDKs own
53
- # their cache mechanisms and do not receive this compatible extension.
54
- PLURNK_PROVIDERS_PROMPT_CACHE_KEY=1
50
+ # Route adapters project the stable worker identity through only the provider's
51
+ # documented session/cache-affinity control. Unknown compatible routes receive
52
+ # no guessed field. Disable globally or per alias only for operational diagnosis.
53
+ PLURNK_PROVIDERS_CACHE_AFFINITY=1
54
+ # Explicit cache writes are distinct from affinity and may affect billing.
55
+ # stable-system marks only the reusable system boundary on supported Claude
56
+ # routes; off requests no explicit cache write. Provider-default lifetime is 5m.
57
+ PLURNK_PROVIDERS_CACHE_WRITE_POLICY=stable-system
55
58
  # #567: DRY is a llama.cpp-only repeated-sequence penalty. It can reduce
56
59
  # degenerate loops, but it can also corrupt exact source, identifiers, quoted
57
60
  # evidence, and other repetition required by PLURNK operations. The portable
@@ -64,16 +67,27 @@ PLURNK_PROVIDERS_DRY_MULTIPLIER=0
64
67
  # Set it per alias only from measured model behavior.
65
68
  # PLURNK_PROVIDERS_REPEAT_LAST_N_<alias>=512
66
69
 
67
- # --- Transport budgets (§4, #18) ---
68
- # Total generation-operation timeout (ms), including retries; caller cancellation also spans the operation.
70
+ # --- Connectivity budgets ({§provider-connectivity}, #240) ---
71
+ # Complete logical generation deadline (ms), spanning every physical attempt
72
+ # and retry delay. Zero disables this outer deadline; caller cancellation still
73
+ # spans the operation. The floor leaves all four ten-minute attempts plus normal
74
+ # backoff available under the three-retry floor.
75
+ PLURNK_PROVIDERS_OPERATION_TIMEOUT=2700000
76
+ # Maximum duration (ms) of one physical generation attempt. Zero disables the
77
+ # per-attempt deadline without changing the operation deadline.
69
78
  PLURNK_PROVIDERS_FETCH_TIMEOUT=600000
70
- # Maximum silence (ms) between streamed response-body chunks after response
71
- # streaming begins. Disabled at the portable floor: slow local inference may
72
- # pause legitimately. Enable per alias only from measured endpoint behavior.
73
- PLURNK_PROVIDERS_STREAM_IDLE_TIMEOUT=0
74
- # PLURNK_PROVIDERS_STREAM_IDLE_TIMEOUT_firefast=120000
75
- # Transient-failure retries: 0 = surface the first failure; N = retries on 429/5xx/timeout
76
- # with exponential backoff (Retry-After wins). RETRY_DELAY is the backoff base (ms).
79
+ # Maximum wait (ms) from response-stream start to first semantic model content.
80
+ # Transport metadata and empty deltas do not satisfy it. The portable floor
81
+ # allows endpoints that intentionally buffer a full attempt; tighten per alias
82
+ # from measured time-to-first-content. Zero disables it.
83
+ PLURNK_PROVIDERS_FIRST_CONTENT_TIMEOUT=600000
84
+ # Maximum silence (ms) between semantic streamed-content chunks after content
85
+ # begins. Zero disables it. Both content deadlines consume the ordinary retry
86
+ # budget when they expire.
87
+ PLURNK_PROVIDERS_STREAM_IDLE_TIMEOUT=120000
88
+ # Transient-failure retries: 0 = surface the first failure; N = retries on
89
+ # network failure, 408/409/429/ordinary 5xx, or an inner deadline, with the AI
90
+ # SDK's backoff (Retry-After wins).
77
91
  PLURNK_PROVIDERS_RETRY_ATTEMPTS=3
78
92
  # Maximum characters retained from an upstream provider diagnostic in the
79
93
  # public Problem detail. Structured failure facts are not truncated.
@@ -89,26 +103,18 @@ PLURNK_PROVIDERS_PROBE_DELAY=250
89
103
  # Unset by default. Set per alias only for a local llama-server whose GBNF
90
104
  # transport is detected or pinned. Cloud and endpoint-managed model settings do
91
105
  # not use this knob.
92
- # PLURNK_PROVIDERS_GBNF=plurnk.gbnf
106
+ # PLURNK_PROVIDERS_GBNF=plurnk.qwen.gbnf
93
107
  # Debug toggle: validate but withhold a configured local GBNF, then report the
94
108
  # unconstrained output's divergence. Development aid; leave unset in production.
95
109
  # PLURNK_PROVIDERS_GBNF_DEBUG=0
96
110
 
97
111
  # --- Window ({§model-fact-resolution}) ---
98
- # Physical provider context only. Unset derives from a live endpoint probe (n_ctx) or
99
- # models.dev, else null (surfaced once via PLURNK_CONTEXT_UNKNOWN). A configured value
100
- # caps detected physics or declares it when unknown. Prompt packing and model-facing
101
- # pressure are consumer policy, not provider configuration.
112
+ # Effective total context envelope. Unset derives natural capacity from a live endpoint probe
113
+ # (n_ctx) or models.dev, else null (surfaced once via PLURNK_CONTEXT_UNKNOWN). A configured
114
+ # value is a final hard cap on known capacity or declares the envelope when unknown. Model-facing
115
+ # prompt pressure is separate consumer policy.
102
116
  # PLURNK_PROVIDERS_CONTEXT_WINDOW=200000
103
117
 
104
- # --- Model pricing override (USD per million tokens; {§model-fact-resolution}) ---
105
- # Models.dev owns catalog rates. Set these together for a model absent from the
106
- # snapshot or to deliberately override its rates. Cached input defaults to the
107
- # input rate when omitted. All three knobs are per-alias scopable.
108
- # PLURNK_PROVIDERS_INPUT_USD_PER_MILLION=1
109
- # PLURNK_PROVIDERS_CACHE_READ_USD_PER_MILLION=0.1
110
- # PLURNK_PROVIDERS_OUTPUT_USD_PER_MILLION=5
111
-
112
118
  # --- llama-server detection pin (#34) ---
113
119
  # Unset = auto-detect from the /v1/models fingerprint. 1 = pin llama-server capabilities
114
120
  # (grammar transport, slot pinning, /tokenize) WITHOUT trusting the probe; 0 = force plain
@@ -171,7 +177,7 @@ OPENAI_BASE_URL=https://api.openai.com/v1
171
177
  PLURNK_BASE_URL=https://plurnk.ai/v1
172
178
  # PLURNK_BASE_URL=http://plurnksnr2kihuukt6v22ko72r34dxeatbsfhgow3hvnlw6btanxphad.onion/v1 # Tor
173
179
 
174
- # --- Generation envelope (#507, owner-ruled) - sane defaults from the DETECTED window ---
180
+ # --- Generation envelope (#507) - sane defaults from the DETECTED window ---
175
181
  # When a backend advertises its context window (llama-server n_ctx, the plurnk.ai router,
176
182
  # a cataloged cloud model), the reserves derive from it automatically - ZERO operator
177
183
  # tuning. Each accepts a percentage of the window ("10%") or an absolute token count
package/README.md CHANGED
@@ -142,3 +142,6 @@ record of that procedure, never a substitute for it.
142
142
  npm run test:lint -w @plurnk/plurnk-providers
143
143
  npm run test:unit -w @plurnk/plurnk-providers
144
144
  ```
145
+
146
+ `npm run test:providersPing` is an explicit paid diagnostic; it calls each
147
+ keyed provider once and prints the retained sanitized evidence directory.
package/SPEC.md CHANGED
@@ -42,24 +42,23 @@ interface Provider {
42
42
  signal?: AbortSignal,
43
43
  ): Promise<PromptTokenMeasurement>;
44
44
  tokenize?(text: string): Promise<number[]>;
45
- calculateCost(usage: ProviderUsage): number;
46
- calculateCharge?(usage: ProviderUsage): Exclude<ProviderCost, { kind: "authoritative" }>;
47
45
  generate(args: GenerateArgs): Promise<ProviderResponse>;
48
46
  }
49
47
  ```
50
48
 
51
- `contextWindow` is provider physics and resolves under
52
- {§model-fact-resolution}. `null` means genuinely unknown; a consumer MUST NOT
53
- invent a stand-in. The context-window knob never carries model-facing prompt
54
- policy or grinder pressure.
49
+ `contextWindow` is the effective total context envelope resolved under
50
+ {§model-fact-resolution}: the minimum of known model capacity and any stricter
51
+ operator cap. `null` means genuinely unknown; a consumer MUST NOT invent a
52
+ stand-in. The context-window knob is a hard cap, never model-facing grinder
53
+ pressure.
55
54
 
56
55
  `PromptTokenMeasurement` is a discriminated request-level result:
57
56
 
58
- | `kind` | Meaning | May authorize physical admission |
59
- | ------------- | ------------------------------------------------------ | -------------------------------- |
60
- | `exact` | Exact count for the complete provider request. | Yes. |
61
- | `upper_bound` | Proven upper bound for the complete provider request. | Yes. |
62
- | `estimate` | Empirical prediction with required causal `detail`. | No. |
57
+ | `kind` | Meaning | May authorize hard context-envelope admission |
58
+ | ------------- | ------------------------------------------------------ | --------------------------------------------- |
59
+ | `exact` | Exact count for the complete provider request. | Yes. |
60
+ | `upper_bound` | Proven upper bound for the complete provider request. | Yes. |
61
+ | `estimate` | Empirical prediction with required causal `detail`. | No. |
63
62
 
64
63
  Every result carries a non-negative integer `tokens` and a non-empty `source`.
65
64
  `countPromptTokens` receives the same messages supplied to `generate` and may
@@ -74,37 +73,72 @@ hard; consumers do not reinterpret it as ordinary unavailability.
74
73
  endpoint exposes its real vocabulary. Content tokenization does not substitute
75
74
  for complete-request measurement.
76
75
 
77
- §provider-monetary-evidence A provider response may carry an authoritative
78
- settled `charge`; it wins over every local calculation. Otherwise
79
- `calculateCharge` returns estimated, explicitly free, or unknown evidence under
80
- {§provider-cost}. The numeric `calculateCost` method remains only as a frozen
81
- 1.x compatibility surface: a positive value adapts to an estimate, while zero
82
- adapts to unknown because it cannot prove free.
76
+ §provider-monetary-evidence One precedence path converts each physical provider
77
+ request into {§provider-cost} evidence before the request leaves the provider
78
+ boundary:
79
+
80
+ | Precedence | Evidence | Result |
81
+ | --- | --- | --- |
82
+ | 1 | A documented monetary field on that response or error | The adapter validates and preserves its documented `charged` or `estimated` character; its exact amount wins. |
83
+ | 2 | Known response usage and the exact model's Models.dev rates | The adapter returns an exact decimal USD `estimated` amount only when every differently-priced applicable category is known. |
84
+ | 3 | Neither | `unknown` with a concrete reason. |
85
+
86
+ Models.dev is the sole supported fallback rate table. Missing usage, a missing
87
+ applicable category, or missing rates never proves zero. An exact zero rate
88
+ produces an ordinary estimated amount of USD `0`. Rate calculation is internal
89
+ to the provider request; Core, digest, ping, and clients never call a parallel
90
+ pricing method.
83
91
 
84
92
  ### Generation
85
93
 
86
- `generate` requires a non-empty, stable, opaque `workerId`. It accepts:
94
+ §provider-cache-identity `generate` requires a non-empty, stable, opaque
95
+ `workerId`. A durable worker uses one globally unique value for its lifetime;
96
+ independent databases and processes cannot mint the same local sequence. A
97
+ `bare` call instead uses a fresh per-call value, preventing unrelated prompts
98
+ from acquiring affinity with either the parent worker or another BARE call.
99
+ Providers MUST NOT interpret either value.
100
+
101
+ `generate` accepts:
87
102
 
88
103
  - `messages`: system, user, and assistant text messages;
89
104
  - caller cancellation through `signal`;
90
105
  - optional `grammar` and `maxTokens`;
91
106
  - standard `sampling` intent;
107
+ - the caller-owned `callKind` output contract when one applies;
92
108
  - opaque attribution tags plus client, strike, workspace, loop, and turn metadata.
93
109
 
110
+ §provider-call-kind `callKind` is either `emission` (the response is a PLURNK
111
+ turn emission) or `bare` (the response is unconstrained answer text). The
112
+ consumer states this semantic fact explicitly; providers MUST NOT infer it from
113
+ message count, grammar presence, worker identity, or another incidental request
114
+ shape. The first-party adapter transports a supplied value as
115
+ `Plurnk-Call-Kind`; the metadata gate drops it for every third-party backend.
116
+ The signal is request metadata and never enters model-facing messages. Generic
117
+ provider callers MAY omit it; Core supplies it for every model call.
118
+
94
119
  A successful return carries the model's raw content and reasoning, normalized
95
- usage, normalized finish reason, model identity, opaque evidence, optional
96
- metadata, and optional notices. The provider transports and observes model
120
+ finish reason, model identity, its ordered {§provider-request-accounting},
121
+ opaque evidence, optional metadata, and optional notices. A `ProviderError`
122
+ carries the same accounting array. The provider transports and observes model
97
123
  output; it never retries, discards, or repairs an otherwise completed exchange
98
124
  because PLURNK grammar did not accept it.
99
125
 
100
- Usage obeys:
126
+ §provider-request-observer When a consumer supplies the request observer, the
127
+ provider opens one durable identity through it immediately before each physical
128
+ I/O and settles that identity with the resulting
129
+ `ProviderRequestAccounting`. This applies to every automatic retry and capacity
130
+ failover request. The observer is a durability sink, not an alternate evidence
131
+ representation; the same ordered records remain on the final response or error.
132
+
133
+ Usage obeys {§provider-usage}:
101
134
 
102
135
  ```text
103
- total = prompt + completion + reasoning
104
- cached ⊆ prompt
136
+ totalTokens = inputTokens + outputTokens
137
+ cacheReadTokens, cacheWriteTokens ⊆ inputTokens
138
+ reasoningTokens ⊆ outputTokens
105
139
  ```
106
140
 
107
- `completion` excludes reasoning. Ordinary vendor finish reasons normalize to
141
+ Unknown fields remain absent. Ordinary vendor finish reasons normalize to
108
142
  `stop`, `length`, `tool_calls`, or `content_filter`; an unknown value becomes
109
143
  `null` and emits a warning. `resource_interrupted` is the distinct failed-attempt
110
144
  disposition defined by {§provider-interrupted-attempt}.
@@ -124,9 +158,9 @@ explicit alias-scoped response style:
124
158
 
125
159
  Tag projection never runs when readable structured reasoning is already
126
160
  present. Streamed and buffered transports converge on this response boundary.
127
- When the upstream reports only combined output usage, the existing
128
- sum-preserving text-proportion estimate reclassifies completion versus reasoning
129
- without changing prompt, cached input, total output, or billed output.
161
+ When the upstream reports only combined output usage, that value remains
162
+ `outputTokens` and its unavailable text/reasoning detail stays absent. The
163
+ adapter never apportions tokens from character lengths.
130
164
 
131
165
  Grammar evidence retains the exact pre-projection sentence and its Unicode
132
166
  content offset. Response classification cannot rewrite what a transported GBNF
@@ -136,8 +170,10 @@ rail observed.
136
170
 
137
171
  §provider-sdk-boundary Cataloged providers instantiate their
138
172
  Models.dev-declared AI SDK package.
139
- Standard request shaping, streaming, retries, cancellation, timeouts, usage,
140
- and vendor error parsing belong to the SDK.
173
+ Standard request shaping, streaming, usage, and vendor error parsing belong to
174
+ the SDK. PLURNK supplies cancellation and deadline signals and owns the sole
175
+ cross-attempt scheduler so every physical request remains observable and
176
+ accountable.
141
177
 
142
178
  PLURNK maps its generic settings to AI SDK call settings:
143
179
 
@@ -145,19 +181,48 @@ PLURNK maps its generic settings to AI SDK call settings:
145
181
  - presence and frequency penalties;
146
182
  - stop sequences and seed;
147
183
  - output-token ceiling;
148
- - `off`, `adaptive`, or budget-derived reasoning intent.
184
+ - `off`, provider-default `adaptive`, or explicit `on` reasoning intent, with
185
+ an optional operator budget.
149
186
 
150
187
  Provider-specific options are permitted only where they preserve a documented
151
188
  PLURNK product contract the generic SDK surface cannot express.
152
189
 
190
+ §provider-readable-reasoning When the effective reasoning posture is not
191
+ `off`, a native adapter MUST request readable reasoning summaries if its
192
+ provider requires a separate response-visibility option. That option neither
193
+ activates reasoning nor selects its depth. The exact wire projection belongs to
194
+ the provider adapter; Models.dev's reasoning bit remains capability metadata.
195
+
196
+ The portable SDK surface has no boolean-enabled reasoning value. An unqualified
197
+ `on` therefore projects to its conventional `medium` enabled posture. This is a
198
+ wire activation value, not a reasoning reserve or output-token ceiling.
199
+
200
+ §provider-cache-affinity **Cache affinity is route-owned request projection.**
201
+ When a provider documents a semantics-preserving conversation, session, or
202
+ prompt-cache routing key, its catalog adapter projects `workerId` through that
203
+ provider's documented header, body field, or native SDK option. The common
204
+ transport neither guesses from protocol resemblance nor sends a generic cache
205
+ field to an unknown provider. The operator may disable affinity globally or per
206
+ alias; automatic provider caching without an affinity control remains untouched.
207
+
208
+ §provider-cache-write-policy **Cache-write policy is separate from affinity.**
209
+ `PLURNK_PROVIDERS_CACHE_WRITE_POLICY` is `off` or `stable-system`. The latter
210
+ marks only the final leading system instruction as an explicit reusable cache
211
+ boundary, and only on routes whose native SDK documents that control. It does
212
+ not mark the changing user packet or enable an API-wide automatic cache mode.
213
+ Unsupported routes receive no invented option. The default five-minute
214
+ provider lifetime is used; a longer, differently priced lifetime is not an
215
+ implicit transport choice.
216
+
153
217
  §deepseek-reasoning-request The direct DeepSeek catalog path maps the common
154
218
  reasoning intent to its OpenAI-compatible controls:
155
219
 
156
- | PLURNK mode | `thinking` | `reasoning_effort` |
157
- | ----------- | --------------------- | -------------------- |
158
- | `off` | `{ type: disabled }` | omitted |
159
- | `adaptive` | omitted | omitted |
160
- | `on` | `{ type: enabled }` | budget-derived tier |
220
+ | PLURNK posture | `thinking` | `reasoning_effort` |
221
+ | --------------- | --------------------- | -------------------- |
222
+ | `off` | `{ type: disabled }` | omitted |
223
+ | `adaptive` | omitted | omitted |
224
+ | `on` | `{ type: enabled }` | omitted |
225
+ | `on` + budget | `{ type: enabled }` | budget-derived tier |
161
226
 
162
227
  The compatible transport is deliberately retained for:
163
228
 
@@ -187,11 +252,10 @@ The universal groups are:
187
252
  - reasoning activation and optional explicit budget;
188
253
  - explicit reasoning response-content style;
189
254
  - decode tuning;
190
- - request, stream-idle, retry, and probe budgets;
255
+ - operation, physical-attempt, first-content, stream-idle, retry, and probe budgets;
191
256
  - local GBNF and llama-server capability pins;
192
257
  - context-window and generation-envelope overrides;
193
- - explicit input, cached-input, and output USD-per-million rates for models
194
- absent from the snapshot or deliberate operator overrides;
258
+ - provider-documented cache affinity and explicit cache-write policy;
195
259
  - opt-in logprob and raw-body capture.
196
260
 
197
261
  Operator secrets and machine-specific values never belong in committed
@@ -213,12 +277,11 @@ Provider and model facts resolve independently:
213
277
  | Context window | Catalog metadata or a local endpoint probe. | `PLURNK_PROVIDERS_CONTEXT_WINDOW`. | Minimum when both exist; the sole value otherwise. A cataloged cloud miss fails construction; a compatible probe miss remains `null` with one warning. |
214
278
  | Completion envelope | Catalog `maxOutput`; there is no live limit probe. | `PLURNK_PROVIDERS_COMPLETION_RESERVE`. | An absolute reserve wins. A percentage derives from the effective window and is capped by catalog `maxOutput` when present. |
215
279
  | Reasoning capability | Catalog `reasoning: true`, exposed by snapshot lookup. | Runtime activation, reserve, and adapter wire style. | The catalog bit is informational; provider construction neither activates nor blocks reasoning from it. |
216
- | Estimated USD rates | Catalog input, output, and optional cache-read rates. | Complete input/output rate override; cache optional. | Operator rates win; otherwise catalog rates apply. Missing rates produce unknown evidence; explicit all-zero rates produce free evidence. No live price fetch exists. |
280
+ | Estimated USD rates | Models.dev input, output, and optional cache-read/cache-write rates. | None. | Missing differently-priced categories or rates produce unknown evidence; exact all-zero rates produce an estimated USD zero. No live price fetch exists. |
217
281
 
218
- The cached-input override defaults to the explicit input rate when omitted.
219
- Catalog cache-read cost likewise defaults to catalog input cost. Catalog
220
- cache-write cost remains snapshot information; the current usage estimator has
221
- no cache-write quantity to price.
282
+ Models.dev cache-read and cache-write cost default to input cost when omitted.
283
+ When either differs from input, the corresponding usage detail must be known or
284
+ the request estimate is unknown.
222
285
 
223
286
  `instantiateProvider` resolves in this order:
224
287
 
@@ -239,6 +302,11 @@ Model IDs resolve exactly first. A unique catalog suffix is accepted to avoid
239
302
  forcing a vendor-owned resource prefix into PLURNK aliases. Ambiguous suffixes
240
303
  fail to resolve.
241
304
 
305
+ The catalog package identifies the protocol family, not a mandatory client
306
+ implementation. xAI uses its documented OpenAI-compatible response directly
307
+ because that wire includes exact cost ticks the corresponding AI SDK projection
308
+ omits.
309
+
242
310
  Provider declarations configure facts, not credentials:
243
311
 
244
312
  ```dotenv
@@ -301,16 +369,20 @@ OpenAI-compatible generation endpoint through the SDK adapter.
301
369
  For a detected llama-server, PLURNK sends the complete reasoning contract on
302
370
  every request:
303
371
 
304
- | Mode | Template activation | `thinking_budget_tokens` |
372
+ | Posture | Template activation | `thinking_budget_tokens` |
305
373
  |---|---:|---:|
306
374
  | `off` | false | `0` |
307
375
  | `adaptive` | true | resolved reasoning reserve |
308
- | `on` | true | explicit reasoning budget |
376
+ | `on` | true | resolved reasoning reserve |
377
+ | `on` + budget | true | explicit reasoning budget |
309
378
 
310
379
  The explicit budget may tighten but MUST NOT exceed the resolved reasoning
311
- reserve. `reasoning_format: "auto"` requests a separate readable reasoning
312
- channel. Process-wide llama-server flags are fallback server configuration, not
313
- part of the PLURNK contract and need not be synchronized with an alias.
380
+ reserve. Template calls normally use `reasoning_format: "auto"` for a separate
381
+ readable channel. A GBNF-bearing call uses `"none"` so the exact constrained
382
+ sentence survives response projection; the adapter separates its leading
383
+ reasoning enclosure only after preserving grammar evidence. Process-wide
384
+ llama-server flags are fallback server configuration, not part of the PLURNK
385
+ contract and need not be synchronized with an alias.
314
386
 
315
387
  §llama-reasoning-request The allowance is cumulative across the complete response. Opening a second or
316
388
  later reasoning block does not replenish it. Template parsing, the reasoning
@@ -329,7 +401,7 @@ intent. It cannot override:
329
401
  - data-capture settings;
330
402
  - tool, modality, or multi-choice behavior;
331
403
  - the consumer-owned output envelope;
332
- - prompt-cache identity.
404
+ - cache affinity identity or cache-write policy.
333
405
 
334
406
  Generic AI SDK calls accept only settings represented by the SDK's portable
335
407
  surface. Compatible endpoints may carry additional sampling keys after reserved
@@ -353,13 +425,30 @@ normal value. Retry exhaustion is preserved as `attempts` and
353
425
  `retryExhausted`, and the resulting Problem is not marked retryable after the
354
426
  provider has consumed its automatic retry budget.
355
427
 
356
- The AI SDK owns attempt scheduling. `PLURNK_PROVIDERS_RETRY_ATTEMPTS` is the
357
- maximum retry count. Caller cancellation spans the operation. Total and
358
- stream-chunk deadlines are separately configurable.
428
+ §provider-connectivity The provider adapter owns one attempt scheduler around
429
+ the complete generation exchange; SDK-internal retries are disabled.
430
+ `PLURNK_PROVIDERS_RETRY_ATTEMPTS=N` permits at most `N + 1` physical requests.
431
+ The layers are independent and a configured value of zero disables only that
432
+ deadline:
433
+
434
+ | Layer | Operator knob | Boundary | Expiry |
435
+ | --- | --- | --- | --- |
436
+ | Operation | `PLURNK_PROVIDERS_OPERATION_TIMEOUT` | Complete logical call, including every attempt and retry delay. | Final `deadline_exceeded` Problem at 504 with `timeoutPhase=operation`; never retried. |
437
+ | Attempt | `PLURNK_PROVIDERS_FETCH_TIMEOUT` | One physical generation request, including response consumption. | Retryable `network_failure` with `timeoutPhase=attempt`. |
438
+ | First content | `PLURNK_PROVIDERS_FIRST_CONTENT_TIMEOUT` | Response-stream start through first semantic model content; metadata, empty deltas, and transport activity do not satisfy it. | Retryable `network_failure` with `timeoutPhase=first_content`. |
439
+ | Stream idle | `PLURNK_PROVIDERS_STREAM_IDLE_TIMEOUT` | Silence between semantic content chunks after content begins. | Retryable `network_failure` with `timeoutPhase=stream_idle`. |
440
+
441
+ Caller cancellation spans the operation and preserves the caller's reason.
442
+ Inner deadline failures consume the ordinary retry budget; retry exhaustion
443
+ adds `attempts` and `retryExhausted`, retains the inner `timeoutPhase` and
444
+ `timeoutMs`, and is final. Every scheduler iteration opens and settles exactly
445
+ one ordered {§provider-request-accounting} record, including response-less
446
+ network failures and timed-out attempts.
359
447
 
360
448
  HTTP 408, 409, 429, and ordinary 5xx responses are retryable unless the endpoint
361
- explicitly says otherwise. Endpoint control responses 520–527 are final so a
362
- router can prevent multiplicative retries behind its own retry policy.
449
+ explicitly says otherwise through `X-Should-Retry`. That header is authoritative;
450
+ without an explicit directive, endpoint control responses 520–527 are final so
451
+ a router can prevent multiplicative retries behind its own policy.
363
452
 
364
453
  ### §provider-interrupted-attempt Provider-declared interruption
365
454
 
@@ -370,10 +459,10 @@ completed exchange.
370
459
  | Concern | Contract |
371
460
  | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
372
461
  | Normalized finish reason | Exact `insufficient_system_resource` becomes `resource_interrupted`; the raw value remains in `assistantRaw`. |
373
- | `generate` outcome | Throw `ProviderError(kind="resource_interrupted")` at local status 503 with the normalized attempt on `error.attempt`. |
462
+ | `generate` outcome | Throw `ProviderError(kind="resource_interrupted")` at local status 503 with the normalized attempt on `error.attempt` and the same accounting on `error.accounting`. |
374
463
  | Partial response | Preserve content, reasoning, usage, model, metadata, optional raw body, and other evidence without admitting it as success. |
375
464
  | Automatic replay | None; the Problem has `retryable: false`, and AI SDK retry scheduling has already completed at the successful transport. |
376
- | Capacity-pool overflow | None; a sibling success would erase the known billed failed attempt from the current `ProviderResponse` surface. |
465
+ | Capacity-pool overflow | None under the existing routing policy; when other overflow-eligible failures do reach a sibling, the pool concatenates their request accounting. |
377
466
  | Consumer admission | Persist the evidence as an unaccepted attempt; never parse it into executable work, even when its frame looks complete. |
378
467
 
379
468
  ## §10 Grammar
@@ -382,8 +471,9 @@ GBNF is a local llama-server capability, not a generic provider expectation.
382
471
  The consumer chooses whether to supply a grammar. The provider never creates or
383
472
  rewrites one.
384
473
 
385
- GBNF defines the accepted raw sampled text; it runs before response reasoning
386
- is separated from regular content. The shipped PLURNK sentence is owned by
474
+ GBNF defines the accepted sampled text; it runs before response reasoning is
475
+ separated from regular content. A generated rail may declare a response root
476
+ that composes a template-provided prefix for independent evidence grading. The shipped PLURNK sentence is owned by
387
477
  `plurnk-contracts` {§gbnf-turn-shape} and {§gbnf-reasoning-boundary}; this package does
388
478
  not restate or rewrite it.
389
479
 
@@ -391,10 +481,11 @@ When a grammar-capable adapter receives a grammar, `ProviderResponse` carries
391
481
  `grammarEvidence: { input, contentStart, transported }`. `input` is the exact
392
482
  pre-projection sentence represented by the response, `contentStart` is its
393
483
  Unicode-code-point offset to `assistant.content`, and `transported` says whether
394
- the grammar was actually sent. For active llama-server template reasoning, the
395
- adapter reconstructs the Harmony enclosure only when the response demonstrates
396
- that `reasoning_format: "auto"` projected it; otherwise it cannot claim evidence.
397
- For an unsplit response, `input` is `content` and `contentStart` is zero.
484
+ the grammar was actually sent. Active llama-server template reasoning requests
485
+ the unprojected sentence, records it, and then separates its leading enclosure;
486
+ an empty body therefore remains observable. An endpoint that projects despite
487
+ that request supplies no independent evidence. For an unsplit response, `input`
488
+ is `content` and `contentStart` is zero.
398
489
 
399
490
  §gbnf-response-observation The provider transports and represents; it does not grade its own enforcement.
400
491
  The consumer validates `grammarEvidence.input` outside the enforcer's failure
@@ -1,17 +1,29 @@
1
- import type { ChatMessage, PromptTokenMeasurement, Provider, ProviderResponse, ProviderUsage } from "./types.ts";
1
+ import type { ChatMessage, PromptTokenMeasurement, Provider, ProviderCostNormalizer, ProviderGenerateArgs, ProviderResponse, ProviderUsage } from "./types.ts";
2
2
  import type { ProviderCost } from "@plurnk/plurnk-contracts";
3
+ import type { JSONValue } from "ai";
3
4
  import type { Reasoning, ReasoningResponseStyle, ReserveSpec } from "./env.ts";
4
5
  import type { LanguageModel } from "ai";
5
6
  import type { PluginAttribution, PluginAttributionContext } from "@plurnk/plurnk-meta";
6
7
  export type ProviderFetch = typeof globalThis.fetch;
7
8
  export type ReasoningStyle = "none" | "think" | "include_reasoning" | "effort" | "effort_explicit" | "thinking_effort" | "template" | "anthropic";
8
9
  export type GrammarStyle = "none" | "llamacpp";
10
+ export type CacheAffinity = {
11
+ readonly target: "header" | "body";
12
+ readonly name: string;
13
+ } | {
14
+ readonly target: "provider-option";
15
+ readonly provider: string;
16
+ readonly name: string;
17
+ };
18
+ export type AiSdkProviderOptions = Record<string, Record<string, JSONValue | undefined>>;
9
19
  export type AiSdkProviderConfig = {
10
20
  model: string;
11
21
  url?: string;
12
22
  languageModel?: LanguageModel;
13
23
  attributions?: (context: PluginAttributionContext) => PluginAttribution;
14
24
  fetchTimeoutMs: number;
25
+ operationTimeoutMs: number;
26
+ firstContentTimeoutMs: number;
15
27
  streamIdleTimeoutMs?: number;
16
28
  headers?: Record<string, string>;
17
29
  fetch?: ProviderFetch;
@@ -19,13 +31,13 @@ export type AiSdkProviderConfig = {
19
31
  reasoningStyle?: ReasoningStyle;
20
32
  reasoningResponseStyle?: ReasoningResponseStyle;
21
33
  countPromptTokens?: (messages: readonly ChatMessage[], signal?: AbortSignal) => PromptTokenMeasurement | Promise<PromptTokenMeasurement>;
22
- calculateCost?: (usage: ProviderUsage) => number;
23
- calculateCharge?: (usage: ProviderUsage) => Exclude<ProviderCost, {
24
- kind: "authoritative";
25
- }>;
34
+ estimateCost?: (usage: ProviderUsage | undefined) => ProviderCost;
35
+ normalizeCost?: ProviderCostNormalizer;
26
36
  source?: string;
27
37
  grammarStyle?: GrammarStyle;
28
- promptCacheKey?: boolean;
38
+ cacheAffinity?: CacheAffinity;
39
+ systemCacheProviderOptions?: AiSdkProviderOptions;
40
+ reasoningResponseProviderOptions?: AiSdkProviderOptions;
29
41
  serviceTier?: string;
30
42
  gbnfDebug?: boolean;
31
43
  streaming?: boolean;
@@ -68,24 +80,6 @@ export default class AiSdkProvider implements Provider {
68
80
  get requiresMaxTokens(): boolean | undefined;
69
81
  get constrainsOutput(): boolean;
70
82
  countPromptTokens(messages: readonly ChatMessage[], signal?: AbortSignal): Promise<PromptTokenMeasurement>;
71
- calculateCost(usage: ProviderUsage): number;
72
- calculateCharge(usage: ProviderUsage): Exclude<ProviderCost, {
73
- kind: "authoritative";
74
- }>;
75
- generate({ messages, workerId, primaryWorkerId, signal, grammar, maxTokens, attributions, client, strikes, workspaceId, loop, turn, sampling }: {
76
- messages: ChatMessage[];
77
- workerId: string;
78
- primaryWorkerId?: string;
79
- signal?: AbortSignal;
80
- grammar?: string;
81
- maxTokens?: number;
82
- attributions?: string[];
83
- client?: string;
84
- strikes?: number;
85
- workspaceId?: string;
86
- loop?: number;
87
- turn?: number;
88
- sampling?: Record<string, unknown>;
89
- }): Promise<ProviderResponse>;
83
+ generate({ messages, workerId, primaryWorkerId, signal, grammar, maxTokens, attributions, client, strikes, workspaceId, loop, turn, sampling, observeRequest, callKind }: ProviderGenerateArgs): Promise<ProviderResponse>;
90
84
  }
91
85
  //# sourceMappingURL=AiSdkProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AiSdkProvider.d.ts","sourceRoot":"","sources":["../src/AiSdkProvider.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAmB,sBAAsB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAClI,OAA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