The /metrics route runs in its own instance. That instance handles no chat traffic, so its in-memory families stayed empty.
With a limiter store, /metrics now reads the router, decision, latency, prompt-cache, provenance and rejection families from shared counters. Their HELP text uses the store-backed aggregation note. Without a store, or without the stats flag a family needs, the in-memory rendering is unchanged.
The latency counters gain day-window sums in milliseconds and streaming-only bucket counters. The histograms can then emit a real _sum and keep the stream label. Provenance writes use countAsync. The rejection month counter rides the existing rejection batch. A store read failure skips the affected families.
Document the prompt-caching feature in the README. Add promptCache key to the openai provider in the catalog testData, and update the manifest test mirror.
The translated messages path copied any prompt_cache_key into the
upstream body, even with promptCache.key off. It now forwards the key
only when the provider opted in. The gateway key travels in a private
field, and a client key wins when present.
When promptCache.key is set on an openai provider, the gateway sends a
hashed prompt_cache_key per conversation. The key is the SHA-256 of the
caller id and the session id. The session id is the client id, or the
system prompt plus the first user message.
The key is set only when the client sent no prompt_cache_key. It is set
on each attempt copy after the response-cache key is computed. It is not
stored, and it never carries a raw id.
Add providers.<name>.promptCache with inject and key flags. When inject is true on an anthropic provider, the gateway adds up to four cache_control breakpoints. They go on the last tool, the last system block, and the last two user messages. The translated chat path and the /v1/messages passthrough both use it. A body that already has any cache_control is left unchanged. The input body is never mutated. The default config changes no request body.
The translator joined system and developer messages into one string.
This dropped any cache_control marker that the client set on a part.
Now, when a marker exists, system becomes a list of text blocks that
keep the marker. Without markers, the joined string is unchanged.
The mock now parses the detail query like the backend. Only 1 and true turn detail on. Other unknown values return 400. detail=0 and detail=false no longer return the prompt-cache fields.
The usage model table and the model panel now show the prompt-cache hit rate. The Cost avoided card shows the prompt-cache saving as a separate line. The mock admin API fixtures carry the new fields.
The gateway now counts cache-read, cache-write and uncached prompt tokens
per provider and model as a Prometheus counter. It also writes the read,
write and saved micro-USD totals to the Redis counters.
The admin usage models detail view returns the three totals per model.
Response-cache hits do not count, and free models save nothing.
A curated builtinPricing entry returned before the generated table, so its cache prices were never reached.
lookupPricingSource now fills nil cache fields of a curated hit from the generated table.
Base prices are unchanged, and an operator override is not merged.
The clamp test now asserts exact values.
Tests that compared prices with == now use reflect.DeepEqual, because the price struct holds pointers.
The base prices and the entry set are unchanged.
113 entries gain cache-read or cache-write prices.
The cache fields come from LiteLLM on 2026-11-26.
A full pricing-sync run is not used, because it would drop 36 entries.
Cost now prices cache-read and cache-write prompt tokens at their own rates.
A model without a cache price keeps the input rate, so cost does not change.
The cache shares are clamped to the prompt, so odd usage cannot give a negative cost.
LiteLLM field names cache_read_input_token_cost and cache_creation_input_token_cost were confirmed in the fetched source.
The pricing-sync tool reads both fields. The table regeneration is a separate commit.
The decision state now holds the first 1024 bytes of the system prompt and the first 8192 bytes of the newest ask, cut at a character boundary. The classifier scoring inputs stay the same.
Live mode no longer calls the decision model when a floor or keyword rule already fixes the tier. A client cancel during the call no longer counts toward the breaker.
Port seriesValidMetric and the usage/series query checks into the mock so it
returns the backend 400 for an invalid scope, metric and window combination.
Stack the toast viewport on perfect-design's --z-toast token so it sits
above Sheet overlays, and add a harness check that the toast is the
topmost element at its centre while a sheet is open.
Delete useAliasNames, lib/alias and its spec, which nothing imports
since the shadcn migration removed AliasBadge.
Add a spec that maps every component imported from perfect-design, and
every directory it imports in turn, to an @source entry in main.css.
Extend the bundle gate spec to check that utilities unique to recently
added components appear in the built CSS.
Move AuthGate, ConfigWarningsBanner, ToastViewport, SnippetBlock,
PageLoadError, LabeledSelect and the helper forms to perfect-design
Button, Input, Card, Callout, NativeSelect and ToastItem. Number fields
use a small native input because the library input rewrites typed text.
Delete components/ui, the unused ModelChip, CompactNumber, AliasBadge and
lib/utils, and the shadcn config. Remove shadcn-vue, tw-animate-css,
class-variance-authority and clsx. Give FaIcon an optional title and drop
role from decorative icons. Refresh stale comments and the README.
Delete 89 files that no live entry imports, drop chart.js, vue-chartjs,
@tanstack/vue-table and the FontAwesome runtime, and replace the Vue
FontAwesome wrapper with a small SVG component.
Limit Tailwind source scanning to the perfect-design components the app
bundles. Add the bundle gate script and spec: gzip JS+CSS of dist/assets
must stay at or below 324300 bytes.