narrarium-engine 0.1.24 → 0.1.26
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.
- package/README.md +21 -3
- package/dist/ai/config.d.ts +27 -0
- package/dist/ai/config.d.ts.map +1 -1
- package/dist/ai/config.js +16 -1
- package/dist/ai/config.js.map +1 -1
- package/dist/ai/fetch-client.d.ts +2 -2
- package/dist/ai/fetch-client.d.ts.map +1 -1
- package/dist/ai/fetch-client.js +54 -5
- package/dist/ai/fetch-client.js.map +1 -1
- package/dist/ai/memory.d.ts +30 -6
- package/dist/ai/memory.d.ts.map +1 -1
- package/dist/ai/memory.js +15 -2
- package/dist/ai/memory.js.map +1 -1
- package/dist/ai/prompt-cache.d.ts +41 -0
- package/dist/ai/prompt-cache.d.ts.map +1 -0
- package/dist/ai/prompt-cache.js +76 -0
- package/dist/ai/prompt-cache.js.map +1 -0
- package/dist/ai/request.d.ts +6 -1
- package/dist/ai/request.d.ts.map +1 -1
- package/dist/ai/request.js +76 -1
- package/dist/ai/request.js.map +1 -1
- package/dist/ai/router.d.ts +5 -1
- package/dist/ai/router.d.ts.map +1 -1
- package/dist/ai/router.js +2 -1
- package/dist/ai/router.js.map +1 -1
- package/dist/ai/routing.d.ts.map +1 -1
- package/dist/ai/routing.js +7 -2
- package/dist/ai/routing.js.map +1 -1
- package/dist/ai/types.d.ts +19 -1
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/types.js.map +1 -1
- package/dist/autopilot/campaign.d.ts +9 -2
- package/dist/autopilot/campaign.d.ts.map +1 -1
- package/dist/autopilot/campaign.js +84 -14
- package/dist/autopilot/campaign.js.map +1 -1
- package/dist/autopilot/estimate-texts.d.ts +5 -0
- package/dist/autopilot/estimate-texts.d.ts.map +1 -1
- package/dist/autopilot/estimate-texts.js +9 -3
- package/dist/autopilot/estimate-texts.js.map +1 -1
- package/dist/autopilot/estimate.d.ts +25 -3
- package/dist/autopilot/estimate.d.ts.map +1 -1
- package/dist/autopilot/estimate.js +70 -20
- package/dist/autopilot/estimate.js.map +1 -1
- package/dist/autopilot/frozen.d.ts +2 -0
- package/dist/autopilot/frozen.d.ts.map +1 -1
- package/dist/autopilot/frozen.js.map +1 -1
- package/dist/autopilot/planner.d.ts +1 -0
- package/dist/autopilot/planner.d.ts.map +1 -1
- package/dist/autopilot/planner.js +133 -12
- package/dist/autopilot/planner.js.map +1 -1
- package/dist/autopilot/review-policy.d.ts +25 -5
- package/dist/autopilot/review-policy.d.ts.map +1 -1
- package/dist/autopilot/review-policy.js +84 -2
- package/dist/autopilot/review-policy.js.map +1 -1
- package/dist/autopilot/review-readers.d.ts +69 -0
- package/dist/autopilot/review-readers.d.ts.map +1 -0
- package/dist/autopilot/review-readers.js +79 -0
- package/dist/autopilot/review-readers.js.map +1 -0
- package/dist/autopilot/runner.d.ts +2 -0
- package/dist/autopilot/runner.d.ts.map +1 -1
- package/dist/autopilot/runner.js +22 -0
- package/dist/autopilot/runner.js.map +1 -1
- package/dist/autopilot/state.d.ts +11 -0
- package/dist/autopilot/state.d.ts.map +1 -1
- package/dist/autopilot/state.js +60 -5
- package/dist/autopilot/state.js.map +1 -1
- package/dist/autopilot/tasks.d.ts.map +1 -1
- package/dist/autopilot/tasks.js +138 -60
- package/dist/autopilot/tasks.js.map +1 -1
- package/dist/autopilot/types.d.ts +93 -11
- package/dist/autopilot/types.d.ts.map +1 -1
- package/dist/autopilot/types.js +2 -0
- package/dist/autopilot/types.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/server/client.d.ts.map +1 -1
- package/dist/server/client.js +9 -2
- package/dist/server/client.js.map +1 -1
- package/dist/server/protocol.d.ts +20 -0
- package/dist/server/protocol.d.ts.map +1 -1
- package/dist/server/protocol.js +24 -0
- package/dist/server/protocol.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -205,6 +205,14 @@ Values are read as the author wrote them: an autonomy whatever its case (`Full`,
|
|
|
205
205
|
|
|
206
206
|
`options.review` (`ReviewPolicy`, `normalizeReviewPolicy`) changes, for a run, the vote a chapter and the book must reach (`targetScore`, 1-10 to a tenth; the plan keeps the director's), the rounds of a chapter (`maxRounds`, 1-10), the first rounds the readers read in (`readerRounds`, 1-10; 1 by default) and the rounds a review of the book makes before it waits (`campaignMaxRounds`; 0 none). What it does not say is the profile's; `null` takes a value back. `reviewTarget`, `reviewMaxRounds` and `reviewReaderRounds` say what wins: the review of the book in progress, the policy, the profile. Without a policy every prompt is the one it always was. A chapter keeps its last `MAX_CHAPTER_ROUNDS` (30) rounds.
|
|
207
207
|
|
|
208
|
+
### Targets for the readers
|
|
209
|
+
|
|
210
|
+
`options.review` also says what the simulated readers must give: `readersTarget` (the vote the average of the readers that count must reach), `readerTargets` (the vote each reader must reach, by slug) and `readersExcluded` (the readers that **do not count**: still read and shown, left out of the average and of the targets). They are read softly by `normalizeReviewPolicy` (a vote is brought into 1-10 to a tenth, what cannot be read is left out; the last two are given whole, and `null` takes each back). The average is the plain mean of the votes: the director's weights say how much to listen to a reader, they do not weigh it.
|
|
211
|
+
|
|
212
|
+
A target for the average or for a reader makes the review a gate (`readerGate`; only while the readers read, and one that counts is active). After the director's last corrections the readers read the chapter again if they have not read the text as it is, as a round of its own (`ChapterRound.reading: "end"`, with its `round` and each vote in `readerVotes`; the first-draft vote stays in the history); the chapter is closed when the director's target, the readers' average and each reader's target are all reached (`readerStanding`). When one is missed the readers' corrections go to the director in another round, while the rounds allowed last and the corrections get closer; else it is closed all the same, and the insight `readersTargetMissed` names what stood in the way («the readers' average 6.4/10 is under 7.5/10»).
|
|
213
|
+
|
|
214
|
+
A review of the book takes the same three fields (`ReviewBookInput`) and takes up the chapters under any target. A chapter whose director's vote is at the target but has no vote of the readers on its text as it is (`chapterReading`, `chapterStanding`) is only read by them (`reading: "check"`), and reviewed whole if a target is missed. `ReviewVotes.readers` is the lowest average of the readers, and a plateau says which target the chapters kept missing. Without any of the three fields nothing changes. `estimateAutopilotRun` counts the closing readings, and `progress.checkOnly` the chapters only read.
|
|
215
|
+
|
|
208
216
|
### Profiles that cannot be read
|
|
209
217
|
|
|
210
218
|
`parseDirector`, `parseGhostwriter`, `parseReaderPersona` and `parseEvaluationStyle` never throw and never hide a problem: they return `warnings: string[]` (empty when the file is as it says), each naming the file. A warning is YAML that cannot be read (with its line), a value that is not understood (an autonomy nobody knows, a score that is not a number, a list that is not a list, a reader type that is none of `standard`, `genre`, `custom`, a switch that is neither yes nor no, a criterion of the evaluation style that cannot be read), and the profile then has the default for that value, as it always had. The defaults themselves carry `warnings: []`.
|
|
@@ -467,7 +475,7 @@ const estimate = estimateAutopilotRun({
|
|
|
467
475
|
- `cost` is `{ min, max, currency? }` and is `null` when a capability that makes calls has a model with no price (or no model): `unpriced` lists which. A price of `0` is a price. The price of a model is known when it has both `inputPerMTok` and `outputPerMTok`.
|
|
468
476
|
- `minutes` is `{ min, max }` and is `null` unless every capability that makes calls has a speed (`tokensPerSecond`, a number above zero): `unmeasured` lists which. Time is never guessed.
|
|
469
477
|
- A capability that makes no call (no readers, for example) needs no model, no price and no speed: its `cost` and `minutes` are `{ min: 0, max: 0 }` and it warns about nothing.
|
|
470
|
-
- `cachedInputTokens` is the fixed start of every request (the system message and the function), for the capabilities whose model declares `pricing.cachedPerMTok`; `cost.min` counts it at that price and `cost.max` counts no cache. Without a cached price it is `{ min: 0, max: 0 }`.
|
|
478
|
+
- `cachedInputTokens` is the fixed start of every request (the system message and the function), for the capabilities whose model declares `pricing.cachedPerMTok`; `cost.min` counts it at that price and `cost.max` counts no cache. Without a cached price it is `{ min: 0, max: 0 }`. A model can also say `promptCaching` (`unsupported`: no cache counted) and `cacheHitRate` (0 to 1, measured by the host from its ledger; `estimateModelsFromConfig(config, speeds, rates)` takes the rates by model name): the best case counts the rate at the cached price, else the fixed start of the requests where it holds the 1,024 tokens a provider caches, and the worst case counts no cache and bills the start of every request at `pricing.cacheWritePerMTok` when that is above the input price. `cacheBasis` (`none`, `structural`, `measured`) says what a capability counted on.
|
|
471
479
|
|
|
472
480
|
### The interval
|
|
473
481
|
|
|
@@ -724,6 +732,15 @@ What a model takes with tools differs by family, and the documentation of Azure
|
|
|
724
732
|
|
|
725
733
|
When a way answers, the model is remembered by it, once: `AiModelMemory` (`createModelMemory()`) is what a host keeps of its models between calls, given to the client as `options.memory` or per call as `request.memory`, and every later request **with tools** to that model (same integration and model) goes the way that answered from the start (`thinkingMode: "not-sent"` for the level left out, `"none"` for none, and `thinkingWhy: "tools"` in both, with a note in the attempt), while a request **without tools** to the same model keeps its level. `AiChatModelConfig.noThinkingWithTools` is the same fact set by the author: `true` leaves the level out, `"none"` sends `none`; it is read from the configuration (and kept by `pickAiRuntimeConfig`, any other value dropped, and shown by `redactAiRuntimeConfig`), so that no request is wasted to learn it, and what the memory learned (`none`) wins over a `true` that was wrong. `onLearned(learning)` (on the client's options or on the request) says it once, when a call learns it: `{ kind: "no-thinking-with-tools", integrationId, integrationName, model, off, body }` (`off`: `omit` or `none`; `body`: what the provider said the first time). The `AutopilotSession` owns one memory (or takes the host's, `config.memory`) and gives it to every call of its runs: a server-hosted run learns it at once, and `snapshot().learned` lists what the session has learned, for a client that connects later. The runner says it as the `model-learned` event and as an `insight` with the code `modelLearned`, whose words are the provider's, what was done (thinking off for the requests with tools, for this model only; asked with `none` when that is the way) and the two ways out: the Responses API first, when the provider's words tell to use `/v1/responses` (`suggestsResponsesApi`), then turning thinking off, which is what was done. The author's choice of the Responses API is the model's `apiProtocol`, which the host sets (the web app does it with a button of the notice); it is never set by the engine.
|
|
726
734
|
|
|
735
|
+
### Prompt caching
|
|
736
|
+
|
|
737
|
+
A provider caches the start of a prompt of 1,024 tokens or more, in steps of 128 (`servedFromCache`). The usage says what it served as `usage.cachedInputTokens` and what it wrote, when anything, as `usage.cacheWriteInputTokens`.
|
|
738
|
+
|
|
739
|
+
- **Keeps the start of a prompt the same.** The specialists, the director's review, the repair of a scene and the reviews of the plan carry the data first (what stays the same, then what changes with the round) and the request last, and say where the stable start ends (`AiRequest.cacheBreak`, a number of characters of `user`): two rounds of an unchanged chapter share over 90% of those prompts.
|
|
740
|
+
- **Tells the provider where to look**, behind a flag and only where it is documented: `AiRequest.cacheKey` (`<book>/<task>` in the autopilot) goes as the hash `prompt_cache_key` to OpenAI and Azure OpenAI, at their addresses or at a gateway whose model says `promptCaching: supported`; `cache_control` blocks (four at most) go to an Anthropic model, at OpenRouter or at a gateway whose model says it caches, over Chat Completions only. Nothing goes to GitHub Models, to an `unsupported` model or to a gateway nobody said caches, and a `cacheBreak` part is joined to its neighbours for any other provider. `AiRuntimeConfig.promptCacheHints: false` (`aiPromptCacheHints`) turns the hints off; `GET /api/v1/ai` says it.
|
|
741
|
+
|
|
742
|
+
`AiChatModelConfig.promptCaching` is `supported`, `unsupported`, `learned` or absent (not known). A 400 or 422 that names `prompt_cache_key` or `cache_control` (`refusesCacheHint`) is asked again once without it, and the model is learned not to take it (`AiModelMemory.promptCacheHintsRefused`); a response that reports cached tokens from a model that said nothing teaches that it caches (`AiModelMemory.promptCaching`). The autopilot says both as `prompt-caching-learned`, an event of its own, so that an older client never reads it as a refusal of thinking.
|
|
743
|
+
|
|
727
744
|
### Tools only
|
|
728
745
|
|
|
729
746
|
Every autopilot agent answers through a function of its own (the concept, the plan, a reader's evaluation, the director's decisions, the summary of a scene… each has its schema, and the request forces the call with `tool_choice`): the answer is a field that is parsed, not a JSON that the message asked for and that the engine had to find in some text. *Tools only* makes that the only way. It is on unless the configuration turns it off: `AiRuntimeConfig.toolsOnly`, which `pickAiRuntimeConfig` reads from `settings.aiToolsOnly` (and from `toolsOnly` in a configuration that was already picked, which is what a personal server stores and reads back; the settings' own word wins when both are there, and a value that is not a boolean is ignored). A host with no such setting has it on. `redactAiRuntimeConfig(config).toolsOnly` says what is in force.
|
|
@@ -767,7 +784,7 @@ The levels, and who sets them (the target, the integration, `automatic`), are th
|
|
|
767
784
|
|
|
768
785
|
### Costs and budgets
|
|
769
786
|
|
|
770
|
-
`estimateCost` bills cached tokens like normal input unless the model has a `cachedPerMTok`. A reply carries `usageKnown` and `costKnown`: when the provider reports no tokens, `usage` is an estimate (`usageKnown: false`, `costKnown: false`); a model without a price has no `cost`. The autopilot counts those calls in `stats.usageUnknownCalls` and `stats.costUnknownCalls`, says once per run that the money budget (`options.budgetLimit`) cannot apply to a model without a price (`budgetNotApplicable`), and `options.budgetTokens` stops the run at a number of tokens instead (0 = off). Both compare the book's totals (`stats`, of every run, set back only by a reset): the run stops before its next step (`budgetReached`, `tokenBudgetReached`) with `state.limitReached` (`{ kind, used, limit, currency? }`, in the summary too), and again at every start until the cap is raised.
|
|
787
|
+
`estimateCost` bills cached tokens like normal input unless the model has a `cachedPerMTok`, and cache writes (`usage.cacheWriteInputTokens`) like normal input unless it has a `cacheWritePerMTok`. A reply carries `usageKnown` and `costKnown`: when the provider reports no tokens, `usage` is an estimate (`usageKnown: false`, `costKnown: false`); a model without a price has no `cost`. The autopilot counts those calls in `stats.usageUnknownCalls` and `stats.costUnknownCalls`, says once per run that the money budget (`options.budgetLimit`) cannot apply to a model without a price (`budgetNotApplicable`), and `options.budgetTokens` stops the run at a number of tokens instead (0 = off). Both compare the book's totals (`stats`, of every run, set back only by a reset): the run stops before its next step (`budgetReached`, `tokenBudgetReached`) with `state.limitReached` (`{ kind, used, limit, currency? }`, in the summary too), and again at every start until the cap is raised.
|
|
771
788
|
|
|
772
789
|
### Retries
|
|
773
790
|
|
|
@@ -944,6 +961,7 @@ The runner writes one call per `ai()` call of a task: `begin` before the request
|
|
|
944
961
|
- `task-progress` gains `callId` (when the book keeps records) and `callSeq` (always: the call's number in its step, from 1). A structured step that streams its JSON says it with `kind: "json"`, `preview` (the last 700 characters of the JSON so far) and `characters`, and without `bytes`; a shorter JSON (`""` too) is a new attempt, said at once. The numbers event of a structured step keeps its shape (`bytes`, `characters`), with the same `preview` and, once the JSON streams, the JSON's `characters`: the tail, the pace and the count are the call's own, never the ones of the call before. See *The step that is answering* for how a client follows them (`applyLiveProgress`).
|
|
945
962
|
- `call-attempt`: `activityId`, `callSeq`, `callId` (with records), `attempt`, `attempts`, `candidateIndex`, `candidateCount`, `fallback`, `integrationId`, `integrationName`, `provider`, `model`, `thinking`, `thinkingWhy?`, `streamMode`: which candidate of the route the call asks now, said at the start of every attempt, with or without records (see *Which candidate answers*). Names and numbers, never text.
|
|
946
963
|
- `model-learned`: `activityId?`, `learned` (`no-thinking-with-tools`), `integrationId`, `integrationName`, `model`, `off` (`omit` or `none`: the way that answered), `body` (what the provider said, in its own words), `responses` (its words tell to use the Responses API): a call learned from a refusal that the model does not take a thinking level when the request carries tools, was asked again without it (or with `none`), and the session remembers it (see *A provider that refuses thinking with tools*). Kept in the replay of the session; a host that keeps settings persists it as the model's `noThinkingWithTools`. An `insight` with the code `modelLearned` says it in words (it carries the `model`).
|
|
964
|
+
- `prompt-caching-learned`: `activityId?`, `integrationId`, `integrationName`, `model`, `learned` (`cached` or `hints-rejected`), `inputTokens?`, `cachedInputTokens?`, `hint?`, `body?`: what a call learned of a model's prompt caching (see *Prompt caching*). No insight goes with it.
|
|
947
965
|
- `insight` with the code `callsStoreFailed`: the store failed or is full (`AiCallDiskFullError`). The run goes on without records until the next run. It is said once per run.
|
|
948
966
|
|
|
949
967
|
The status `aborted` is what a call that the run stopped in the middle of its reply ends as (a «Pause now», or a server stopping), with the text that arrived, `partial` set.
|
|
@@ -1002,7 +1020,7 @@ A skipped file is not recorded as synced (a file that was never synced stays out
|
|
|
1002
1020
|
The `code` of a refusal of a rule is the `code` of the engine's `AutopilotRuleError` (`AUTOPILOT_RULE_ERROR_CODES`: `rule_empty`, `rule_too_long`, `rule_not_found`, `rule_changed`, `rule_duplicate`), which a server can answer as it is (`400` for the first, the third and the last, `404` for `rule_not_found`, `409` for `rule_changed`); `isAutopilotRuleErrorCode(error.code)` tells a refusal of a rule from the other codes of `ServerRequestError`. The client sends the text as it is given and an index as it is given (a number that names no rule is `404 rule_not_found`), and what it gets back is the error it always gives, with the status and the code of the server. The answer to a question of the director that is kept as a rule needs nothing new: `answer(bookId, { questionId, answer, asRule: true })` has always carried `asRule` (`QuestionAnswer`), and a note used once is still the default.
|
|
1003
1021
|
|
|
1004
1022
|
- **Frozen chapters.** The changes of the frozen chapters and the decisions about them (see *Frozen chapters*) go through three routes, which the engine's session already serves (`session.frozenStatus`, `session.resolveFrozenChange`, `session.freezeChapter` and `unfreezeChapter`). A server that implements them announces `SERVER_FEATURE_AUTOPILOT_FROZEN` (`"autopilot-frozen"`) in the `features` of `GET /api/v1/info`, and `serverSupportsFrozenChapters(info)` reads it (never throws; an older server, or an odd answer, says no): an older server answers `404 not_found` to the routes. The question needs no new route: an answer is the `answer` of `POST …/autopilot/answer` (the `id` of a choice, or its label), which every server forwards. Every call also answers `401 unauthorized`, `403 scope` and `404 book_not_found`, and `503 maintenance` while the server is about to restart.
|
|
1005
|
-
- **Campaigns.** `reviseChapters(bookId, input)` and `cancelRevisionCampaign(bookId)` are `POST` and `DELETE …/autopilot/campaign` (the session's), answering `{ campaign, frozen }`, on a server that announces the feature of the reason (`CAMPAIGN_FEATURES`: `autopilot-outline-apply`, `serverSupportsOutlineApply`; a cancel, any; else `501 feature_unavailable` before sending). Refusals: `400 invalid_request` (an unknown key too), `409 campaign_active`, `not_changed`, `stale`; scope `run`. `reviewBook(bookId, input)` is `POST …/autopilot/review` (`autopilot-review-book`, `serverSupportsReviewBook`), also refused `409 not_finished`, `nothing_to_review`. `options.review` in `configure` and `start` needs `autopilot-review-policy` (`serverSupportsReviewPolicy`), else `501 feature_unavailable
|
|
1023
|
+
- **Campaigns.** `reviseChapters(bookId, input)` and `cancelRevisionCampaign(bookId)` are `POST` and `DELETE …/autopilot/campaign` (the session's), answering `{ campaign, frozen }`, on a server that announces the feature of the reason (`CAMPAIGN_FEATURES`: `autopilot-outline-apply`, `serverSupportsOutlineApply`; a cancel, any; else `501 feature_unavailable` before sending). Refusals: `400 invalid_request` (an unknown key too), `409 campaign_active`, `not_changed`, `stale`; scope `run`. `reviewBook(bookId, input)` is `POST …/autopilot/review` (`autopilot-review-book`, `serverSupportsReviewBook`), also refused `409 not_finished`, `nothing_to_review`. `options.review` in `configure` and `start` needs `autopilot-review-policy` (`serverSupportsReviewPolicy`), else `501 feature_unavailable`; its `readersTarget`, `readerTargets` and `readersExcluded` (also in a review of the book) need `autopilot-review-targets` (`serverSupportsReviewTargets`, `asksReviewTargets`).
|
|
1006
1024
|
|
|
1007
1025
|
| Client method | Request | Answer |
|
|
1008
1026
|
|---|---|---|
|
package/dist/ai/config.d.ts
CHANGED
|
@@ -59,9 +59,21 @@ export declare function addressPath(value: unknown): string | undefined;
|
|
|
59
59
|
export declare function looksLikeResponsesUrl(value: unknown): boolean;
|
|
60
60
|
export interface AiPricingConfig {
|
|
61
61
|
inputPerMTok?: number;
|
|
62
|
+
/** What a million input tokens served from the provider's cache cost (a fraction of `inputPerMTok`: a tenth for GPT-5 and Claude, a quarter for GPT-4.1, a half for GPT-4o). Absent: they cost like any input. */
|
|
62
63
|
cachedPerMTok?: number;
|
|
64
|
+
/** What a million input tokens that the provider writes to its cache cost, for the providers that charge for the write (Anthropic: 1.25 times the input; GPT-5.6 and later: the same). Absent: the write costs like any input. */
|
|
65
|
+
cacheWritePerMTok?: number;
|
|
63
66
|
outputPerMTok?: number;
|
|
64
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Whether a model caches the start of the prompts it is sent (`AiChatModelConfig.promptCaching`), which decides whether the engine sends the hints that help a provider find its cache, and whether an estimate counts on one:
|
|
70
|
+
* `supported` (the author says it does), `unsupported` (the author says it does not: no hint is sent, no saving is counted on), `learned` (a response of this model reported tokens served from its cache: set by
|
|
71
|
+
* the engine, never by the author) and `unknown` (nothing is said, which is what an absent value means: the requests are what they always were, and the engine learns). It changes no request but for the hints.
|
|
72
|
+
*/
|
|
73
|
+
export declare const AI_PROMPT_CACHING: readonly ["unknown", "supported", "unsupported", "learned"];
|
|
74
|
+
export type AiPromptCaching = (typeof AI_PROMPT_CACHING)[number];
|
|
75
|
+
/** A prompt-caching state as the engine keeps it: `supported`, `unsupported` or `learned`, spelled exactly; `unknown` is the absence of a value, and anything else is no value. */
|
|
76
|
+
export declare function normalizePromptCaching(value: unknown): Exclude<AiPromptCaching, "unknown"> | undefined;
|
|
65
77
|
export interface AiChatModelConfig {
|
|
66
78
|
id: string;
|
|
67
79
|
name: string;
|
|
@@ -93,6 +105,12 @@ export interface AiChatModelConfig {
|
|
|
93
105
|
* It is a rule of Chat Completions: a model asked through the Responses API (`apiProtocol`) is sent its level with tools, whatever this says.
|
|
94
106
|
*/
|
|
95
107
|
noThinkingWithTools?: AiNoThinkingWithTools;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the model caches the start of the prompts it is sent (`AiPromptCaching`): `supported` and `learned` let the engine send the hints that route a request to the cache of an earlier one and let an estimate count on
|
|
110
|
+
* the cached price (`pricing.cachedPerMTok`); `unsupported` sends no hint and counts on no saving. The engine learns it (`learned`) from the first response that reports tokens served from the cache, never over what
|
|
111
|
+
* the author said. Absent: `unknown`.
|
|
112
|
+
*/
|
|
113
|
+
promptCaching?: AiPromptCaching;
|
|
96
114
|
/**
|
|
97
115
|
* The API version this model's requests carry (Azure OpenAI's `api-version`): each deployment may need its own. Absent or empty: the integration's `apiVersion`, else
|
|
98
116
|
* `DEFAULT_AZURE_API_VERSION`. `effectiveApiVersion` is the one place that says which is used; it only has an effect for an Azure OpenAI integration.
|
|
@@ -216,6 +234,11 @@ export interface AiRuntimeConfig {
|
|
|
216
234
|
* calls is not used for one. Absent or true: on. False: a model without tool calls gets the schema in the message, and a JSON in the reply's text is read.
|
|
217
235
|
*/
|
|
218
236
|
toolsOnly?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* The hints that help a provider find the cache of an earlier request (`prompt_cache_key` for OpenAI and Azure OpenAI, `cache_control` for an Anthropic model): sent unless this is false. A model whose
|
|
239
|
+
* `promptCaching` is `unsupported` gets none whatever this says, and a provider that refuses one is not sent it again (`AiModelMemory`). The settings call it `aiPromptCacheHints`.
|
|
240
|
+
*/
|
|
241
|
+
promptCacheHints?: boolean;
|
|
219
242
|
}
|
|
220
243
|
/** The routing limits with the web app's normalization: whole numbers within the same bounds, the same defaults. */
|
|
221
244
|
export declare function normalizeRoutingExecution(raw: unknown): AiRoutingExecution;
|
|
@@ -249,6 +272,8 @@ export interface RedactedAiModel {
|
|
|
249
272
|
reasoningParameter?: AiReasoningParameter;
|
|
250
273
|
/** Whether the model refuses thinking when the request carries tools, and how it is asked then (see `AiChatModelConfig.noThinkingWithTools`); absent: it does not, as far as is known. */
|
|
251
274
|
noThinkingWithTools?: AiNoThinkingWithTools;
|
|
275
|
+
/** Whether the model is declared (or was learned) to cache the start of its prompts, when it says (see `AiChatModelConfig.promptCaching`); absent: unknown. */
|
|
276
|
+
promptCaching?: Exclude<AiPromptCaching, "unknown">;
|
|
252
277
|
/** The API version of the model, when it names its own (Azure OpenAI): absent, it takes the integration's. */
|
|
253
278
|
apiVersion?: string;
|
|
254
279
|
/** The Responses API, when the model is asked through it (absent: Chat Completions). */
|
|
@@ -276,6 +301,8 @@ export interface RedactedAiRuntimeConfig {
|
|
|
276
301
|
taskRouting: Record<string, RedactedAiTaskRoute>;
|
|
277
302
|
/** Whether "Tools only" is in force: true unless the configuration turned it off. */
|
|
278
303
|
toolsOnly: boolean;
|
|
304
|
+
/** Whether the cache hints are sent: true unless the configuration turned them off (`AiRuntimeConfig.promptCacheHints`). */
|
|
305
|
+
promptCacheHints: boolean;
|
|
279
306
|
fallbackDisclosure?: AiFallbackDisclosure;
|
|
280
307
|
routingExecution?: Partial<AiRoutingExecution>;
|
|
281
308
|
}
|
package/dist/ai/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/ai/config.ts"],"names":[],"mappings":"AAAA,MAAM,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IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,SAAS,EAAE,qBAAqB,EAAE,CAAC;CACpC;AAED,oEAAoE;AACpE,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,sGAAsG;IACtG,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACjD,qFAAqF;IACrF,SAAS,EAAE,OAAO,CAAC;IACnB,4HAA4H;IAC5H,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAC1C,gBAAgB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAChD;AAuCD,4DAA4D;AAC5D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,uBAAuB,CA6BtF"}
|
package/dist/ai/config.js
CHANGED
|
@@ -141,6 +141,16 @@ export function looksLikeResponsesUrl(value) {
|
|
|
141
141
|
return false;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Whether a model caches the start of the prompts it is sent (`AiChatModelConfig.promptCaching`), which decides whether the engine sends the hints that help a provider find its cache, and whether an estimate counts on one:
|
|
146
|
+
* `supported` (the author says it does), `unsupported` (the author says it does not: no hint is sent, no saving is counted on), `learned` (a response of this model reported tokens served from its cache: set by
|
|
147
|
+
* the engine, never by the author) and `unknown` (nothing is said, which is what an absent value means: the requests are what they always were, and the engine learns). It changes no request but for the hints.
|
|
148
|
+
*/
|
|
149
|
+
export const AI_PROMPT_CACHING = ["unknown", "supported", "unsupported", "learned"];
|
|
150
|
+
/** A prompt-caching state as the engine keeps it: `supported`, `unsupported` or `learned`, spelled exactly; `unknown` is the absence of a value, and anything else is no value. */
|
|
151
|
+
export function normalizePromptCaching(value) {
|
|
152
|
+
return value === "supported" || value === "unsupported" || value === "learned" ? value : undefined;
|
|
153
|
+
}
|
|
144
154
|
/**
|
|
145
155
|
* How hard a model is asked to think, per integration and per route target. `low`, `medium`, `high` and `xhigh` are sent to the provider as
|
|
146
156
|
* `reasoning_effort` (or as the argument of the chat template that the model's `reasoningParameter` says); `automatic` sends nothing (the provider's
|
|
@@ -195,7 +205,7 @@ function idleTimeout(value) {
|
|
|
195
205
|
function pricing(value) {
|
|
196
206
|
const source = record(value);
|
|
197
207
|
const output = {};
|
|
198
|
-
for (const key of ["inputPerMTok", "cachedPerMTok", "outputPerMTok"]) {
|
|
208
|
+
for (const key of ["inputPerMTok", "cachedPerMTok", "cacheWritePerMTok", "outputPerMTok"]) {
|
|
199
209
|
const amount = source[key];
|
|
200
210
|
if (typeof amount === "number" && Number.isFinite(amount) && amount >= 0)
|
|
201
211
|
output[key] = amount;
|
|
@@ -253,6 +263,7 @@ export function pickAiRuntimeConfig(settings) {
|
|
|
253
263
|
...(typeof model.supportsVision === "boolean" ? { supportsVision: model.supportsVision } : {}),
|
|
254
264
|
...reasoningParameterOf(model.reasoningParameter),
|
|
255
265
|
...(model.noThinkingWithTools === true || model.noThinkingWithTools === "none" ? { noThinkingWithTools: model.noThinkingWithTools } : {}),
|
|
266
|
+
...(normalizePromptCaching(model.promptCaching) ? { promptCaching: normalizePromptCaching(model.promptCaching) } : {}),
|
|
256
267
|
...(text(model.apiVersion) ? { apiVersion: text(model.apiVersion) } : {}),
|
|
257
268
|
...(normalizeApiProtocol(model.apiProtocol) ? { apiProtocol: normalizeApiProtocol(model.apiProtocol) } : {}),
|
|
258
269
|
...(normalizeEndpointUrl(model.endpointUrl) ? { endpointUrl: normalizeEndpointUrl(model.endpointUrl) } : {}),
|
|
@@ -293,6 +304,7 @@ export function pickAiRuntimeConfig(settings) {
|
|
|
293
304
|
const disclosure = isObject(source.fallbackDisclosure) ? source.fallbackDisclosure : undefined;
|
|
294
305
|
// The settings say `aiToolsOnly`; a configuration that was already picked (what a personal server stores and reads back) says `toolsOnly`.
|
|
295
306
|
const toolsOnly = typeof source.aiToolsOnly === "boolean" ? source.aiToolsOnly : typeof source.toolsOnly === "boolean" ? source.toolsOnly : undefined;
|
|
307
|
+
const promptCacheHints = typeof source.aiPromptCacheHints === "boolean" ? source.aiPromptCacheHints : typeof source.promptCacheHints === "boolean" ? source.promptCacheHints : undefined;
|
|
296
308
|
return {
|
|
297
309
|
aiIntegrations: integrations,
|
|
298
310
|
taskRouting,
|
|
@@ -303,6 +315,7 @@ export function pickAiRuntimeConfig(settings) {
|
|
|
303
315
|
...(disclosure ? { fallbackDisclosure: { sameBoundaryOnly: disclosure.sameBoundaryOnly === true, requireAcknowledgement: disclosure.requireAcknowledgement === true } } : {}),
|
|
304
316
|
...(routingExecution ? { routingExecution } : {}),
|
|
305
317
|
...(toolsOnly !== undefined ? { toolsOnly } : {}),
|
|
318
|
+
...(promptCacheHints !== undefined ? { promptCacheHints } : {}),
|
|
306
319
|
};
|
|
307
320
|
}
|
|
308
321
|
/** The field for a model that says how its thinking level is sent, and nothing for one that does not (or whose word is not one of the three). */
|
|
@@ -327,6 +340,7 @@ function redactedModel(model) {
|
|
|
327
340
|
...(supportsVision !== undefined ? { supportsVision } : {}),
|
|
328
341
|
...reasoningParameterOf(model.reasoningParameter),
|
|
329
342
|
...(model.noThinkingWithTools === true || model.noThinkingWithTools === "none" ? { noThinkingWithTools: model.noThinkingWithTools } : {}),
|
|
343
|
+
...(normalizePromptCaching(model.promptCaching) ? { promptCaching: normalizePromptCaching(model.promptCaching) } : {}),
|
|
330
344
|
...(text(model.apiVersion) ? { apiVersion: text(model.apiVersion) } : {}),
|
|
331
345
|
...(normalizeApiProtocol(model.apiProtocol) ? { apiProtocol: "responses" } : {}),
|
|
332
346
|
...(describeUrl(model.endpointUrl) ? { endpointUrl: describeUrl(model.endpointUrl) } : {}),
|
|
@@ -365,6 +379,7 @@ export function redactAiRuntimeConfig(config) {
|
|
|
365
379
|
routedTasks: Object.keys(config.taskRouting ?? {}).sort(),
|
|
366
380
|
taskRouting,
|
|
367
381
|
toolsOnly: config.toolsOnly !== false,
|
|
382
|
+
promptCacheHints: config.promptCacheHints !== false,
|
|
368
383
|
...(config.fallbackDisclosure ? { fallbackDisclosure: config.fallbackDisclosure } : {}),
|
|
369
384
|
...(config.routingExecution ? { routingExecution: config.routingExecution } : {}),
|
|
370
385
|
};
|
package/dist/ai/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/ai/config.ts"],"names":[],"mappings":"AAQA,+EAA+E;AAC/E,MAAM,CAAC,MAAM,yBAAyB,GAAG,YAAY,CAAC;AAEtD,wJAAwJ;AACxJ,MAAM,UAAU,iBAAiB,CAAC,QAA4B;IAC5D,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAA8E,EAAE,KAA6D;IAC/K,IAAI,WAAW,CAAC,QAAQ,KAAK,cAAc;QAAE,OAAO,SAAS,CAAC;IAC9D,8FAA8F;IAC9F,IAAI,oBAAoB,CAAC,KAAK,EAAE,WAAW,CAAC;QAAE,OAAO,SAAS,CAAC;IAC/D,IAAI,iBAAiB,CAAC,WAAW,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IACzD,MAAM,GAAG,GAAG,OAAO,KAAK,EAAE,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjF,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC,UAAU,KAAK,QAAQ,CAA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AAC,EAAE,CAAC;QACvF,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClF,CAAC;AACJ,CAAC"}
|
|
@@ -215,8 +215,8 @@ export interface FetchAiOptions {
|
|
|
215
215
|
*/
|
|
216
216
|
export declare function createFetchAi(config: AiRuntimeConfig, options?: FetchAiOptions): AiPort;
|
|
217
217
|
/**
|
|
218
|
-
* Same formula as the web app's cost tracker: prices are per million tokens. Tokens served from the cache cost like
|
|
219
|
-
* normal input unless
|
|
218
|
+
* Same formula as the web app's cost tracker: prices are per million tokens. Tokens served from the cache cost like normal input unless the model has its own cached price, and tokens the provider
|
|
219
|
+
* wrote to its cache like normal input unless it has its own cache-write price (`cacheWritePerMTok`: Anthropic and the GPT-5.6 family charge more for the write than for the input).
|
|
220
220
|
*/
|
|
221
221
|
export declare function estimateCost(usage: AiUsage | undefined, pricing: AiPricingConfig | undefined): number | undefined;
|
|
222
222
|
export type FinishOutcome = "complete" | "truncated" | "filtered" | "failed" | "unexpected" | "incomplete";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-client.d.ts","sourceRoot":"","sources":["../../src/ai/fetch-client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGlF,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch-client.d.ts","sourceRoot":"","sources":["../../src/ai/fetch-client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGlF,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,EAAwG,KAAK,WAA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GAAG,MAAM,GAAG,SAAS,CAUjH;AA4PD,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AAE3G;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa,CAQlF"}
|
package/dist/ai/fetch-client.js
CHANGED
|
@@ -4,6 +4,7 @@ import { discardBody, release } from "./body.js";
|
|
|
4
4
|
import { likelyTextTokens } from "./budget.js";
|
|
5
5
|
import { resolveDeadlines, startClock, timeoutMessage } from "./deadlines.js";
|
|
6
6
|
import { redactSecrets } from "./redact.js";
|
|
7
|
+
import { refusesCacheHint } from "./prompt-cache.js";
|
|
7
8
|
import { describeErrorBody, errorBodyOfObject, parseErrorBody, refusesThinkingWithTools, suggestsResponsesApi } from "./provider-error.js";
|
|
8
9
|
import { ResponsesStreamReader, responseAsChat } from "./responses.js";
|
|
9
10
|
import { attemptThinking, buildChatRequest, candidateDestination, candidateEndpoint, canSendNone } from "./request.js";
|
|
@@ -118,6 +119,8 @@ export function createFetchAi(config, options = {}) {
|
|
|
118
119
|
const sent = new Set();
|
|
119
120
|
/** What the provider said the first time it refused: what a model that then answers is learned from. */
|
|
120
121
|
let refusedWith;
|
|
122
|
+
/** The cache hint that the provider refused, and its words: the request is asked again without it, and the model is learned not to take it. */
|
|
123
|
+
let hintRefused;
|
|
121
124
|
for (;;) {
|
|
122
125
|
const { candidate } = attempt;
|
|
123
126
|
const deadlines = resolveDeadlines(integration, options, routingLeft?.());
|
|
@@ -189,6 +192,7 @@ export function createFetchAi(config, options = {}) {
|
|
|
189
192
|
notify(request.onLearned, learning);
|
|
190
193
|
notify(options.onLearned, learning);
|
|
191
194
|
}
|
|
195
|
+
learnPromptCaching(request, options, integration, candidate, attempt.built, response.usage, hintRefused, secrets);
|
|
192
196
|
return withSpent(response, spent);
|
|
193
197
|
}
|
|
194
198
|
catch (error) {
|
|
@@ -211,11 +215,24 @@ export function createFetchAi(config, options = {}) {
|
|
|
211
215
|
// A provider that refuses a thinking level because the request carries function tools is asked again without it, and if that is refused too, with `none` (the GPT-6 models take no request with
|
|
212
216
|
// tools that leaves the level out): each way once. The model is remembered by the way that answers, so that every later request with tools is asked that way (a request without tools keeps its
|
|
213
217
|
// level). Every request stays in the trail as the failed attempt it was, with the provider's words.
|
|
218
|
+
// A provider that does not take the hint that helps it find its cache (`prompt_cache_key`, `cache_control`) is asked again without it, once: a refusal that is only a hint is never a failed call.
|
|
219
|
+
const sentHint = attempt.built?.cacheHint;
|
|
220
|
+
if (!hintRefused && sentHint && error instanceof AiProviderError && error.body && refusesCacheHint(error.body)) {
|
|
221
|
+
try {
|
|
222
|
+
const asked = { ...candidate, promptCacheHintsRefused: true };
|
|
223
|
+
attempt = { ...attempt, candidate: asked, built: buildChatRequest(asked, request, { githubModelsBaseUrl: options.githubModelsBaseUrl, promptCacheHints: config.promptCacheHints }) };
|
|
224
|
+
hintRefused = { hint: sentHint, body: error.body };
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
214
231
|
const next = nextWithoutThinking(candidate, attempt.built, error, sent);
|
|
215
232
|
if (next) {
|
|
216
233
|
const asked = { ...candidate, noThinkingWithTools: next === "none" ? "none" : true };
|
|
217
234
|
try {
|
|
218
|
-
attempt = { ...attempt, candidate: asked, built: buildChatRequest(asked, request, { githubModelsBaseUrl: options.githubModelsBaseUrl }) };
|
|
235
|
+
attempt = { ...attempt, candidate: asked, built: buildChatRequest(asked, request, { githubModelsBaseUrl: options.githubModelsBaseUrl, promptCacheHints: config.promptCacheHints }) };
|
|
219
236
|
}
|
|
220
237
|
catch {
|
|
221
238
|
break;
|
|
@@ -277,6 +294,29 @@ export function createFetchAi(config, options = {}) {
|
|
|
277
294
|
},
|
|
278
295
|
};
|
|
279
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* What an answered call teaches about the model's prompt caching, once: the tokens it was served from the provider's cache (the model caches, unless the author said it does not), and a cache hint
|
|
299
|
+
* the provider refused before it answered without it (the hint is not sent again). Said to the host's memory and listeners; never breaks the call.
|
|
300
|
+
*/
|
|
301
|
+
function learnPromptCaching(request, options, integration, candidate, built, usage, refused, secrets) {
|
|
302
|
+
const learnings = [];
|
|
303
|
+
const base = { kind: "prompt-caching", integrationId: integration.id, integrationName: redactSecrets(integration.name, secrets), model: candidate.model };
|
|
304
|
+
if (refused)
|
|
305
|
+
learnings.push({ ...base, learned: "hints-rejected", hint: refused.hint, body: refused.body });
|
|
306
|
+
if (usage && usage.cachedInputTokens > 0 && built && candidate.promptCaching === undefined && request.memory?.promptCaching?.(integration.id, candidate.model) === undefined) {
|
|
307
|
+
learnings.push({ ...base, learned: "cached", inputTokens: usage.inputTokens, cachedInputTokens: usage.cachedInputTokens });
|
|
308
|
+
}
|
|
309
|
+
for (const learning of learnings) {
|
|
310
|
+
try {
|
|
311
|
+
request.memory?.learn(learning);
|
|
312
|
+
}
|
|
313
|
+
catch {
|
|
314
|
+
// A host's memory must never break a call.
|
|
315
|
+
}
|
|
316
|
+
notify(request.onLearned, learning);
|
|
317
|
+
notify(options.onLearned, learning);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
280
320
|
/** What a target of the route that cannot be called says of itself, in the words of the notes of a failed call. */
|
|
281
321
|
const UNUSABLE_WORDS = {
|
|
282
322
|
"integration-missing": "its integration is no longer there",
|
|
@@ -337,10 +377,12 @@ function sumUsage(left, right) {
|
|
|
337
377
|
return right;
|
|
338
378
|
if (!right)
|
|
339
379
|
return left;
|
|
380
|
+
const written = (left.cacheWriteInputTokens ?? 0) + (right.cacheWriteInputTokens ?? 0);
|
|
340
381
|
return {
|
|
341
382
|
inputTokens: left.inputTokens + right.inputTokens,
|
|
342
383
|
outputTokens: left.outputTokens + right.outputTokens,
|
|
343
384
|
cachedInputTokens: left.cachedInputTokens + right.cachedInputTokens,
|
|
385
|
+
...(left.cacheWriteInputTokens !== undefined || right.cacheWriteInputTokens !== undefined ? { cacheWriteInputTokens: written } : {}),
|
|
344
386
|
};
|
|
345
387
|
}
|
|
346
388
|
function addSpent(spent, error) {
|
|
@@ -405,30 +447,37 @@ function tokenCount(value) {
|
|
|
405
447
|
}
|
|
406
448
|
/**
|
|
407
449
|
* The tokens a provider reports (`usage`): OpenAI's `prompt_tokens` and `completion_tokens`, or the `input_tokens` and `output_tokens` that other providers and the Responses API use; the tokens
|
|
408
|
-
* served from the cache by whichever field says it (`prompt_tokens_details.cached_tokens`, `input_tokens_details.cached_tokens`, `prompt_cache_hit_tokens`, `cache_read_input_tokens`)
|
|
450
|
+
* served from the cache by whichever field says it (`prompt_tokens_details.cached_tokens`, `input_tokens_details.cached_tokens`, `prompt_cache_hit_tokens`, `cache_read_input_tokens`), and, when it says
|
|
451
|
+
* there were some, the tokens written to the cache (`prompt_tokens_details.cache_write_tokens`, `input_tokens_details.cache_write_tokens`, `cache_creation_input_tokens`). Both are a part of the input.
|
|
409
452
|
*/
|
|
410
453
|
function normalizeUsage(value) {
|
|
411
454
|
if (!value || typeof value !== "object")
|
|
412
455
|
return undefined;
|
|
413
456
|
const usage = value;
|
|
414
457
|
const details = (usage.prompt_tokens_details ?? usage.input_tokens_details);
|
|
458
|
+
const written = tokenCount(details?.cache_write_tokens) ?? tokenCount(usage.cache_creation_input_tokens) ?? 0;
|
|
415
459
|
return {
|
|
416
460
|
inputTokens: tokenCount(usage.prompt_tokens) ?? tokenCount(usage.input_tokens) ?? 0,
|
|
417
461
|
outputTokens: tokenCount(usage.completion_tokens) ?? tokenCount(usage.output_tokens) ?? 0,
|
|
418
462
|
cachedInputTokens: tokenCount(details?.cached_tokens) ?? tokenCount(usage.prompt_cache_hit_tokens) ?? tokenCount(usage.cache_read_input_tokens) ?? 0,
|
|
463
|
+
// A provider that writes nothing says nothing: the usage of a call that wrote to no cache is what it always was.
|
|
464
|
+
...(written > 0 ? { cacheWriteInputTokens: written } : {}),
|
|
419
465
|
};
|
|
420
466
|
}
|
|
421
467
|
/**
|
|
422
|
-
* Same formula as the web app's cost tracker: prices are per million tokens. Tokens served from the cache cost like
|
|
423
|
-
* normal input unless
|
|
468
|
+
* Same formula as the web app's cost tracker: prices are per million tokens. Tokens served from the cache cost like normal input unless the model has its own cached price, and tokens the provider
|
|
469
|
+
* wrote to its cache like normal input unless it has its own cache-write price (`cacheWritePerMTok`: Anthropic and the GPT-5.6 family charge more for the write than for the input).
|
|
424
470
|
*/
|
|
425
471
|
export function estimateCost(usage, pricing) {
|
|
426
472
|
if (!usage || !pricing)
|
|
427
473
|
return undefined;
|
|
428
|
-
const
|
|
474
|
+
const written = Math.min(usage.cacheWriteInputTokens ?? 0, Math.max(0, usage.inputTokens - usage.cachedInputTokens));
|
|
475
|
+
const billedInput = Math.max(0, usage.inputTokens - usage.cachedInputTokens - written);
|
|
429
476
|
const cachedRate = pricing.cachedPerMTok ?? pricing.inputPerMTok ?? 0;
|
|
477
|
+
const writeRate = pricing.cacheWritePerMTok ?? pricing.inputPerMTok ?? 0;
|
|
430
478
|
return (billedInput / 1_000_000) * (pricing.inputPerMTok ?? 0)
|
|
431
479
|
+ (usage.cachedInputTokens / 1_000_000) * cachedRate
|
|
480
|
+
+ (written / 1_000_000) * writeRate
|
|
432
481
|
+ (usage.outputTokens / 1_000_000) * (pricing.outputPerMTok ?? 0);
|
|
433
482
|
}
|
|
434
483
|
/** `Retry-After` as milliseconds: whole or fractional seconds, or an HTTP date; never more than five minutes. */
|