The chat credit gate emitted metering.out-of-credits only when the
balance couldn't pay for the prompt. A balance that covered the prompt
but not the reply capped max_tokens and flagged the response
usage_limited, so the caller saw a funds prompt while no listener was
asked to add credit.
The gate now asks when the balance is short of the prompt plus output
up to the request's limit, and reads the balance again if a listener
added credit.
* fix(gui): make Open With a one-time choice with an explicit default
Choosing an app under Open With opens the file in it and nothing else; it
no longer asks to make that app the default for the file type. A new
"Always Open .<ext> Files With" submenu lists the suggested apps with the
current default checked and saves the one picked.
Open With lists the default app first, then the rest in the server's
order. Third-party apps for an extension come back in registration order
instead of whatever order the database returned.
The desktop item menu and the dashboard menu now build Open With from one
helper instead of two copies. The dashboard's touch menu renders checked
items. Files without an extension no longer take a default, since one was
never loaded back after a reload.
* fix(gui): close every parent menu when an item in a nested submenu is chosen
Choosing an item in a submenu of a submenu closed that submenu and its
parent, and left the root context menu open. The menu now closes with
every menu above it.
* fix(gui): close a nested submenu together with the submenu it belongs to
Moving the pointer from a third-level menu back to the root menu removed
the second-level menu and left the third on screen until the next click.
A context menu now removes its own submenus when it is removed.
* fix(gui): keep keyboard selection in the submenu being opened
Pressing the right arrow or Enter on a submenu row highlighted the first
row of the first submenu on screen. In a submenu of a submenu that is a
row of the menu the key was pressed in, so two rows ended up highlighted.
The selection now goes to the submenu that row opens.
* fix(gui): make the touch menu's checkmark visible in dark mode
The checkmark of a checked item took the button's default text color, so
it was black on the dark sheet. It now uses the same color as the label.
* fix(gui): show an extension with special characters correctly in Open With
The desktop menu encodes the label of a row that has a submenu, and the
touch menu renders it as HTML, so the already encoded "Always Open" label
read ".a&b" on the desktop for a file named "x.a&b". Each menu now gets
the label in the form it expects.
* fix(gui): treat a file name that ends in a dot as having no extension
A file named "notes." was offered "Always Open . Files With". It takes no
default app, like any other file without an extension.
* fix(gui): don't offer a default app for a folder
A folder whose name ends in an extension, such as "three.js", was offered
"Always Open .js Files With", and its Open With list was ordered by the
default app for that extension. A folder opens as a folder, so its list
keeps the server's order and has no default to set.
* fix(gui): keep a context menu label clear of its submenu arrow
When a row with a submenu was the widest row of its menu, as "Always Open
.ext Files With" is, its label ran right up to the arrow. The label now
keeps a 12px gap; menus wider than their submenu rows look the same.
* fix(gui): keep a nested submenu off the root menu near the right edge
When a menu opened close to the right edge, such as from a row's more
button, its submenu opened to the left and that submenu's own submenu
opened back to the right, on top of the root menu. A nested submenu now
continues to the left when its parent opened there and it fits, and the
pointer's path to it is judged from the side it opened on.
* test(puter-js): cover context menus with a submenu inside a submenu
Two specs for puter.ui.contextMenu(): choosing an item three levels deep
closes the whole menu, and the inner submenu closes with the submenu it
belongs to.
* docs: add the nested context menu fix to the changelog
* update changelog automation to prioritize impactful changes
* Update changelog with recent changes and fixes
Added `puterId` to models, updated model names for Mistral Large 4, adjusted AI request limit behavior, improved `puter.ai.txt2img()` retry logic, and fixed messaging issues for desktop apps.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The desktop's change-username window was only reachable from
/action/change-username, which nothing links to. The dashboard's Account
tab has its own change-username dialog. Old links now redirect there.
npm start -- --smtp (and npm run start:smtp) still called run(npm, ...)
after the npm constant was replaced by npmSpawnArgs, so it stopped with
"npm is not defined" before building.
* fix(redis): a command that gets no answer rejects after the configured timeout
redis.commandTimeoutMs (default 2000) arms a per-command timer on the
cluster client, so a command sent to a node that never replies, or queued
while the cluster is not ready, rejects and the caller takes its error
path. Blocking commands and duplicate() clients are left without it.
* fix(broadcast): a failed pubsub publish or subscribe is logged, not left unhandled
With command timeouts, a stalled publish now rejects; the fan-out is
fire-and-forget, so the rejection is caught and logged. The sign-in relay
test pins that /login/set still reaches a subscribed /login/wait when
Redis never answers.
* fix(permissions): a scan cache read that Redis fails to serve counts as a miss
The scan then computes from the store, as the generation and per-check
cache reads already do, instead of failing the permission check.
* refactor(redis): isCommandTimeout names the rejection of a timed-out command
Callers that issue a write can recognise the timeout and queue its undo
on the same key. Also notes that a timed-out command is not withdrawn,
restores the console spies in the timeout tests, and drops formatting
churn in types.ts.
* fix(metering): an increment whose buffering timed out is counted once
On a timeout the write-through runs and the buffered copy is negated on
the same keys, so if the timed-out increment lands later the next flush
nets it out. incr and incrAux both do this.
* fix(rate-limit): a concurrency slot whose acquire timed out is removed
The ZREM goes to the same key behind the timed-out MULTI, so a slot that
lands late does not stay held until the orphan window.
* fix(uploads): leases whose take timed out are released
The release goes to the same keys behind the timed-out take, so leases
that land late do not count against the owner until their deadline.
* fix(redis-lock): a claim that timed out is released if it lands
The token-checked delete goes to the same key behind the timed-out SET
NX, so a late claim does not hold the lock for its full TTL.
* fix(broadcast): a rejected pubsub subscribe is retried with backoff
Retries start at 1s and cap at 30s, and stop once the service shuts down.
* refactor(redis): isCommandTimeout lives in its own module
Stores, the rate limiter and the lock helper recognise a timed-out
command without importing the client.
* fix(credit-holds): a hold whose take or reserve timed out is released
The release goes to the same key behind the timed-out script, so a hold
that lands late does not shrink the spendable budget for its TTL.
* fix(metering): a write-through answers without waiting on its undo
The undo's place in the queue is fixed when it is sent, so the request
no longer waits on it. When the undo itself times out, the warning says
the increment may be counted once more or not at all.
* fix(broadcast): a pubsub subscribe retry checks the client is still current
A retry that fires after shutdown no longer subscribes the closed client.
* feat(redis): after a timeout, commands fail fast until a probe gets a reply
For redis.failFastMs (default 5000) after a command times out, other
commands reject unsent with 'Redis unavailable', so a stall costs a
request one timeout instead of one per call. After each interval one
probe is sent; a reply, or the cluster becoming ready, ends it. Commands
sent through sendAsUndo, blocking commands, CLUSTER commands and
duplicate() clients are not held back. A pipeline is admitted or
rejected as a whole.
* fix(redis): undos of a timed-out command are sent while failing fast
The metering negation, slot ZREM, upload and credit-hold releases and
the lock's token-checked delete go through sendAsUndo, so they still
queue behind the original that may land. A command rejected unsent is
not a timeout, so it triggers no undo.
* test(auth): the sign-in relay completes within one command timeout under a stall
/login/set and /login/wait against a cluster whose node never answers
now finish in about one timeout, since calls after the first fail fast.
* style(redis): one-line comments, and types.ts keeps its existing formatting
* fix(redis): releases are sent while failing fast and not waited on
The lock release, concurrency-slot release, credit-hold release and
upload-lease release and settle go through sendAsUndo, so resources
taken before the breaker opened are freed rather than held for their
TTL. They are sent without awaiting; later commands on the same key
queue behind them. The KV and memory slot backends are still awaited.
* fix(redis): a retried pipeline is timed again, and only replies end failing fast
Pipeline commands whose error reply cleared their timer are re-armed when
the pipeline resends them after MOVED, ASK or a closed connection, and
the ASKING command it adds is always admitted. Only a reply, including an
error reply, counts as an answer: a closed connection or an ended cluster
no longer ends failing fast.
* fix(rate-limit): window take-backs are sent while failing fast, and a release never rejects
The ZREM or DECRBY that takes back a denied window charge goes through
sendAsUndo without being awaited, and the request is still denied. A slot
release that throws synchronously is logged, not rejected, and the
release() doc says when it settles.
* fix(broadcast): a publish failing fast warns once per stretch, not once per event
Warnings for publishes rejected with 'Redis unavailable' are skipped
until a publish succeeds again; other failures still warn every time.
* test(redis): timing bounds name their command timeout and leave CI headroom
The relay test sets a 1000 ms timeout and checks it finishes within one
timeout rather than two; the release timing bound is 250 ms.
* style(broadcast): shorter comment on the publish warning
* fix(metering): the cached base is dropped while failing fast, without waiting
forgetBase sends its DEL through sendAsUndo, so after a write-through it
still queues behind the timed-out increment and its undo instead of being
rejected unsent. incr no longer awaits it on the request path; the
MeteringService callers still do.
* fix(redis): a command rejected while failing fast is handled, so one nobody awaits can't end the process
* style(types): unrelated interfaces keep the formatting lint expects
* fix(cache): invalidations are sent while failing fast, so a write during a stall doesn't leave the old entry cached
---------
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
* fix(user): account deletion marks the account's group memberships before the row goes
The account's group reads go to the primary while its memberships cascade
away with the row, and its permission cache generation is bumped after the
delete. Both are best effort and never stop the deletion.
* test(user): format the account deletion tests
* fix(user): account deletion refreshes the readings of those it granted to
Before the row goes, members of the groups the account granted to are
read from the primary and marked; after it, they and the holders of its
user-to-user grants have their permission cache generations bumped.
Both reads are bounded and best effort.
* test(user): clear a mark a reused account id may carry before the issuer delete
* fix(user): account deletion bumps cache generations after the flat purges
* fix(permissions): a deleted issuer's user-to-user grants are listed from the primary
* refactor(permissions): keep the held-purge constants under their comment
* fix(permissions): a flat entry whose issuer account is gone grants nothing
* fix(permissions): flat entries whose issuer account is gone count nowhere and are deleted when found
Manage inheritance and share listings skip them as the flat check does,
through one store helper that also deletes them off the request path.
* docs(permissions): one-line note on the orphaned flat entry helper
* fix(permissions): an issuer missing from a replica batch is re-read from the primary before its entry is dropped
Only ids absent on the primary count as gone. Entries naming no usable
issuer are kept, and an orphaned entry is deleted only while it still
names the gone issuer. The helper hands back the issuers it read, and
the flat readers use the ref-keyed read.
* fix(permissions): missing issuers are re-read in one primary query; flat-entry tests wait on the background work
* fix(permissions): share listings pass the users they already read to the orphaned-entry check, so it reads no issuer twice
* fix(permissions): account deletion drops the cached grant rows of the holders it issued to, so a manage grant from it stops passing down
---------
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
* refactor(push): the database and key names are written once for the page and both workers
pushNames.js holds the puter-push database name, its stores, key prefixes
and the subscription-changed message. pushStore.js re-exports them.
push-sw.js and the GUI's sw.js are served as they are (push-sw.js also
from npm's src/), so neither can import the module. Each carries a block
generated from pushNames.js by tools/pushWorkerNames.mjs. The puter.js
webpack build and the GUI build fail while either block is stale, and a
test compares the names in both worker sources with the page module's.
* refactor(push): the desktop reads the confirmed endpoint and the mark through puter.js
puter.js now records the endpoint the server confirmed, and clears the
subscription-changed mark, inside the Puter GUI as on a website. Three
internal methods give the desktop what it kept itself: _webPushRecord()
reads both, _noteWebPushSynced() records an endpoint a status check
confirmed, and _dropRemovedWebPush() ends a removed subscription and
forgets its receipt and the mark.
webPushClient.js no longer opens the puter-push database or keeps its
own localStorage record. An endpoint an earlier build kept there is read
while puter.js has none, and removed once puter.js records one, so an
already synced browser keeps its status without registering again. With
a puter.js that lacks the methods, the client reads nothing from it and
keeps the old record.
* refactor(push): one-line comments on the push names and the record methods
* fix(push): the worker names check reads CRLF checkouts, lives in tools/ and runs in PR CI
The block helper moves to tools/pushNamesBlock.mjs, so it isn't part of
the published puter.js sources. It compares and rewrites on LF text and
writes back the file's own line endings. Both workers are pinned to LF
in .gitattributes. The puter.js tests run when the GUI's sw.js or its
build changes, and the GUI build checks sw.js before anything else.
* fix(push): the desktop keeps a removed browser off with a puter.js that has no push record
The desktop loads puter.js from its own URL, so it can run one without
_webPushRecord(). The client then uses pushStore.js's helpers itself: it
reads and clears the subscription-changed mark, ends a removed
subscription and forgets its receipt and the mark, clears the mark after
enable(), and keeps the confirmed endpoint in localStorage as before.
_noteWebPushSynced() resolves whether it recorded the endpoint, and the
localStorage endpoint is removed only after puter.js has it. A cached
status reads only the mark before answering. The accessors carry JSDoc
types.
* fix(push): the removed-elsewhere check also asks about the endpoint in localStorage
When loads alternate between puter.js versions, localStorage can hold a
newer confirmed endpoint than puter.js does. The background check now
asks about both, with the mark's old endpoint, before registering.
* fix(push): with an older puter.js the desktop also asks about the endpoint puter.js recorded
Once puter.js has recorded the confirmed endpoint, the desktop drops its
localStorage copy. A later load that runs an older puter.js then read
neither, so a browser that lost its subscription after being removed in
Puter could register again. The fallback now reads puter.js's record from
the store directly.
* refactor(puter-js): the push record reads use try/catch instead of .catch()
---------
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
* feat(puter-js): enable() takes a background option that never prompts or opens sign-in
* fix(gui): background push sync calls enable({ background: true }) and shares puter.js's message name
* fix(puter-js): background enable() on a website needs the user's opt-in here and returns false outside web and gui
* fix(gui): push client reports unavailable push apart from permission and reads store names from puter.js
* fix(puter-js): notifications methods type-check when called on puter.notifications
* fix: background enable() stops when push is turned off meanwhile, sync reports unavailable push
* fix(puter-js): background enable() resolves false when pushes are turned off while it runs
* test: background enable() rejections use rejects matchers, not .catch()
* docs(puter-js): enable()'s background option gets its own section and lists its session errors
* fix(push): the desktop calls enable({ background: true }) only on a puter.js that takes it
An older puter.js ignores the option and runs the call as a click, which
replaces a browser removed in Puter and can open a sign-in. puter.js now
says it takes the option, and without that the desktop keeps the internal
background call it used before.
---------
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
The rate limits and quotas page gave the free quota as 100 MiB, the
checked-in storage_capacity default, where puter.com gives 200 MiB.
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
* fix(net): make off() undo alias-registered handlers and emit drain
* fix(net): skip drain on a closing socket, document off() and drain timing
---------
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
Polly and Textract each carried their own copy of the AWS price list
fetch, region check, term checks and USD conversion. The AWS-specific
parts now live in providers/aws/priceList.ts and the exact USD to
microcent conversion in shared/catalogPrice.ts. Each service keeps only
which products it reads and which tier it bills from.
Polly's price list fetch now refuses redirects, as Textract's already did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both are AWS services, so they share one vendor folder like every other
vendor: providers/aws/textToSpeech and providers/aws/ocr. Files move as
they are; only the four imports that point into them change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Textract reads S3 objects only from a bucket in its own region, and AWS
doesn't run Textract in every region. A file whose bucket is in a region
without Textract is now sent as bytes to the configured Textract region and
billed at that region's rate.
The provider decides this before any Textract call, from the bucket region's
public price list: AWS publishes one for each region it runs Textract in and
answers 404 for the others. The price cache keeps that 404 as an answer for
its normal lifetime instead of retrying it as a failure, and the credit hold
for such a call is sized from the configured region's rate alone.
When the price list can't be loaded, an S3 read whose Textract hostname
doesn't resolve (ENOTFOUND) falls back to the bytes the same way. Any other
error from the bucket's region surfaces as before.
* feat(hosting): sites list their custom domains, attach names a moved domain's old site, and hosting.detach() removes domains
- puter-subdomains read/select return `custom_domains` ({ uuid, hostname,
status }) per site, filled by a `site.customDomains` event listener. Only
rows attached under the site's current owner count; the field is left out
when the listener fails, so a failed lookup never reads as "no domains".
- The attach dialog's answer carries `previousSite` when the user moved the
domain from another site, kept through a status check or switch to www.
- puter.hosting.detach(subdomain) opens the custom domain dialog in a
remove-only mode (desktop message, frame, or popup) and resolves the
domains the user removed, or []. Desktops advertise it as
`custom-domains-detach`; older ones reject with not_supported.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(workers): expect the sandbox-owner message create() throws now
create() rejects another user's sandbox app with "The sandbox app '…'
belongs to another user…" since the workers name-cap fix; the deploy test
still expected the old wording and failed on main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(gui): blocked people opens as a dashboard dialog instead of a window
* refactor(gui): enabling and disabling 2FA open as dashboard dialogs instead of windows
* fix(gui): blocked people ignores a block list that arrives out of order
A list answered after a newer one no longer replaces it, and a list
requested before the refuse-everyone switch was changed no longer sets
the switch back.
* fix(gui): an unblocked person leaves the blocked people list once the server confirms
The row no longer waits for the list to reload, so a reload that fails
doesn't leave it behind with a disabled Unblock button.
* fix(gui): the blocked people list stops reporting itself as loading when it fails to load
* fix(gui): typing into a filled 2FA setup code box replaces its digit
A box takes one digit, so a filled one ignored what was typed until it
was cleared by hand. Focusing a box now selects its digit.
* fix(gui): a 2FA setup code entered right after a refused one is kept
After a refused code, focus returns to the first box at once instead of
dropping to the page, and a code typed or pasted while the refused one
is still showing replaces it instead of being cleared with it.
* fix(gui): the 2FA setup Copy buttons say copied only when something was copied
Without clipboard access (a plain-HTTP origin, or a refused permission)
the secret and recovery-code buttons reported a copy that never
happened. They now fall back to selecting the text for the legacy copy,
through the helper the custom domain dialog already had, and stay as
they are when that fails too.
* fix(gui): blocked people gives keyboard focus back to the control that was used
The switch and the Block and Unblock buttons are disabled while their
request is out, which drops focus. It went to the card, so the next Tab
started over from the close button; it now returns to the control.
* fix(gui): the 2FA switch waits for a request still out when its dialog is closed
Closing the enable or disable dialog while its request was out reported
a failure at once, so the Security tab kept showing the old state after
the server made the change. The dialogs now report the server's answer.
* refactor(gui): the emoji language is removed from the language list
An account that saved it renders in English.
* refactor(gui): translation keys no code reads are removed from every language
Covers keys English no longer defines as well. Keys built at runtime
(share link notes, permission lines, plan names) stay.
* revert(gui): the unused translation keys are restored in every language
The MCP connector puts the host of the client's redirect URI on its own
callback URL (`forwards_to`) and completes a flow only when that exact value
comes back with it.
The authorization dialog reads that name off a redirect under the deployment's
own domain and leads with it, with the relay named beneath. A name given by any
other host, or by a page on the hosting domain, is ignored. The token minted for
the grant is labelled with both hosts, destination first.
- Worker names are capped at 50 characters, the most a `workers.puter.<name>`
subdomain row holds. A longer name is a 400 before any token is minted,
instead of a 500 from the insert. The publish dialog caps at 50 too.
- Deleting a worker deletes its `sandbox-<name>` app when nothing else runs
as it, so the name can be reused by another user. A sandbox app owned by
someone else rejects with `sandbox_not_owned` instead of a TypeError.
- POST /rao records nothing for a worker or events handler actor, and the
worker runtimes' clients no longer ask.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(puter-js): team members carry passwordPending for the owner
* test(puter-js): team members' passwordPending in the teams API suite
* test(puter-js): passwordPending wording, non-boolean inputs, and the member view's account shape
* docs(puter-js): one-line passwordPending description
* docs(puter-js): listMembers description covers the owner's passwordPending
---------
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
* fix(puter-js): status() in the desktop reads off when the account has no device in this browser
* refactor(puter-js): status() reads the device list through listDevices' request and a shared current-device rule
AuthService.revokeAllSessionsForUserIds reads the listed users' sessions from the primary and cascades them together, 200 users at a time, and still announces each user's revocation on its own. revokeAllSessionsForUserId is its one-id case. SessionStore.getByUserIds is the batch reader, and getByUserId calls it.
* feat(bench): backend benchmarks that fail a PR for waterfalled or uncached I/O
A scenario runs a request against the in-memory backend and records every
SQL, key-value, Redis and object-storage round trip on a modeled clock, then
reports round trips per destination, serial stages and modeled latency.
tools/bench.mjs runs the scenarios on a base commit and on the head and fails
on a regression the pull request description does not accept; benchmarks.yaml
runs that on every pull request.
Also adds npm run check (lint, type check, related tests and the benchmark
comparison for the files a branch changed) and describes the distributed
deployment in AGENTS.md.
* test(bench): scenarios for fs, kv, auth, apps, permissions, sharing and hosted sites
* test(puter-js): count the SDK unit tests in the coverage report
Only the bundle the API runners load was instrumented, so the unit tests next
to the SDK source never counted. In coverage mode the vitest config now
instruments SDK source for them and writes one shard per test file.
* test(puter-js): unit tests for ui messaging, dialogs, components, uploads, peer and smaller modules
* test(backend): cover fs, permission, app, worker, sharing, broadcast and user edge cases
* fix(backend): fs write flags are stored as booleans, app stats weeks are ISO weeks
- A write's boolean flags reach the store only once read as booleans; any
positive number reads as true.
- App open stats grouped by week use ISO 8601 weeks for both the buckets
and their labels on every database engine, so the two agree across a
year boundary.
* fix(puter-js): dialog token source, legacy upload cancel, submenu state, typed-array views
- The sign-in dialog takes the token only from the popup it opened, and
stops listening when it leaves the page.
- Cancelling a legacy upload rejects with `upload_aborted` and no longer
runs the `error` callback.
- A context menu's submenu stays in step with its parent when the parent
item is pressed or the submenu closes itself.
- The FileReader polyfill reads a typed-array view through its own offset
and length.
* ci(bench): benchmark a pull request as merged into its base
The comparison ran the branch's own head against the tip of the base
branch, so a branch behind its base was charged for (or credited with)
what the base gained since. The head side is now the merge commit and
the base side its first parent. Shards also get a 15 minute timeout.
* test(broadcast): shutdown drain tests send boot's own events first
Boot queues cache updates that flush 10 ms later. A test body that
started after that flush counted it as its own request, which failed
'bounds a hung flush in onServerShutdown' on a slow runner.
* Rerun declined Claude requests on Anthropic's fallback model
A Claude model with safety classifiers can decline a request and end it with
stop_reason "refusal". Requests to the models that have server-side fallback
(Fable 5.2, 5.1 and 5, Opus 5.5 and 5, Sonnet 5.5) now carry
`fallbacks: "default"` and the server-side-fallback beta, so Anthropic reruns
a declined request on the model it recommends for that refusal and the caller
gets that model's answer in the same response.
- `refusalFallback: false` turns it off for a request. The Anthropic route
takes the native `fallbacks` field instead: "default" or a list of models is
the caller's own chain, null turns it off.
- The `fallback` content block is a `refusal_fallback` chunk in a stream and
`refusalFallbacks` on a non-streaming result, where it is taken out of
`message.content`. The Anthropic route writes it back as a native block and
accepts it in replayed messages.
- `usageDetails.fallbackModel` names the model that answered.
- A final refusal is forwarded as before, without the fallback-credit fields
of `stop_details`.
- A request Anthropic rejects over a fallback the caller did not ask for is
sent again without it.
* Meter each Claude fallback attempt on the model that ran it
A request Anthropic reruns on a fallback model is several attempts, each
billed at its own model's rates. `usage.iterations` carries one entry per
attempt and the top-level counts describe only the attempt that answered.
- Every attempt is its own charge, priced at the rates of the model that ran
it and recorded under that model's key: the answer from the top-level
counts, each declined attempt from its iteration entry. Nothing is counted
twice, and a fast request's attempts are priced at each model's fast rates.
- The reported `usage` keeps the answering attempt under the plain keys and
adds a declined attempt's tokens under `declined_` keys. Like the advisor's,
only their recorded cost prices them, and they are no part of the request's
own prompt or output totals.
- A provider's `requestPricing` can name the models the upstream may rerun
the request on. The credit gate then prices the prompt and the capped
output once per model, each at its own rates and cost factor, for the
affordability check, the output cap and the hold. Claude names the priciest
target of default routing, or every model of a chain the caller named.
* Charge a declined Claude request only when Anthropic bills it
Anthropic bills a request its classifiers decline before any output only in
the bio, frontier_llm and reasoning_extraction categories; any other
category, or none, is not billed. A request declined after it produced
output is billed for its prompt and that output.
Metering follows the same rule for each attempt: the final refusal by its
`stop_details.category`, and an attempt that declined before a fallback by
the `trigger.category` of its `fallback` block. An attempt Anthropic does not
bill is recorded with its token counts at no cost. An attempt whose refusal
details are missing is charged as before.
* Estimate images inside tool results as attachments
The credit gate's prompt estimate read a `tool_result` as the text of its
serialized content, so a base64 image inside one counted as text, at many
times the tokens the image costs. An image or document block inside a tool
result is now estimated the way a top-level one is, from its payload size.
Text and other blocks in the result are counted as before.
* Name each Claude model's fallback chain, and keep a declined conversation on the model that answered
A request to a Claude model with fallback targets names them in order
(Opus 5, then Opus 4.8) instead of asking for default routing, which
leaves some refusal categories declined.
puter.js remembers the model that answered a declined turn and names it
on later turns of the same conversation, so they skip the declined
attempt. The backend runs such a request on that model and presents it
in the requested model's response format.
* Rerun a declined Claude request from the driver, one attempt at a time
A request a Claude model declines is now rerun by the chat driver on the
model's fallback models, instead of by Anthropic inside the same API call.
The request sent upstream is the same as before this branch: no `fallbacks`
field and no extra beta header.
Each rerun is a whole attempt of its own. It goes through the credit gate
against the balance left after the declined attempt, takes its own hold once
the declined attempt's hold is released, and is metered by the provider under
its own model. A request reserves one attempt at a time, as any other chat
request does. When the balance can't cover the rerun, or the rerun fails, the
response is the refusal.
A non-streamed request is rerun on any refusal. A streamed request is rerun
only when it was declined before any output, and the answer follows a
`refusal_fallback` chunk on the same stream. The response reports the model
that answered in `usageDetails.fallbackModel`, each switch in
`refusalFallbacks`, the declined attempts' tokens under `declined_` usage
keys, and the total charged in `usage.cost`. It keeps the requested model's
format.
A conversation pinned to a fallback model that declines continues down the
rest of the requested model's fallback models. The Anthropic route reads
`fallbacks: null` or `false` as an opt-out and ignores any other value.
Claude restores `puter_path` parts after a refusal, so a rerun uploads the
files again.
Suspending an account already made its hosted sites answer 404, but its
deployed worker scripts kept running.
- On `user.suspended` the worker driver removes each of the owner's deployed
scripts and keeps the rows. On `user.unsuspended` it deploys them again
from their source files, without the per-worker notification. The local
runtime needs no redeploy: it builds a worker from source on its next
request.
- Hot reload skips a suspended owner, so a write by someone the source file
is shared with does not bring the script back.
- The local worker runtime answers 404 for a suspended owner's worker
instead of deploying it on demand.
* feat(metering): report an actor's balance each time it is worked out
`metering.balance` carries what an actor on a metered plan has left to
spend and the plan it was worked out under. It is emitted when usage
settles and when a credit gate re-reads the balance, so an extension can
act on a low balance without reading it itself.
The balance a settling batch reports now counts the purchased credit
that batch drew, so the credit gate and the exhausted notice follow the
batch that spends the last of it instead of the one after. A batch that
settles right after a credits change still reports the credit as read,
since that read may predate the change.
`MeteringService.isUnmetered` is public, for callers that need to tell a
plan with nothing to run out of from one that has run out.
* feat(metering): let a listener top an actor up at the moment of refusal
`metering.out-of-credits` is emitted, and waited on, when an actor is
about to be refused for lack of credit. A listener that adds credit sets
`refilled`, and the refused work is tried once more instead of failing.
It is asked from the three places a refusal is decided: the credit gate
on routes, the shared credit reservation the AI drivers use, and the
chat driver's own gate. Each tries again once, after the listener
answers, and refuses as before when nothing was added.
* fix(metering): count a flush's write once in a read with no cached base
An increment for a counter with no cached base read the store after its
buffer snapshot with nothing ordering the two, so a flush landing in
between was counted from both, and that store read was then kept as the
base. It now reads the store the way other reads do, starting from the
increment's own snapshot.
A write that has reached the store but is not yet applied to the buffer
looks the same from the buffer as one still on its way. `kv.get` can now
answer with the last fence token a writer applied to a key, and a read
counts such a write's amounts from one side only. A read that sees a
write sent between its snapshots is retried.
A base is laid from a store read only if no write was out when it was
read and none has been sent since.
The Home tab's Open Desktop card returns with its markup, styles and
strings, and links to https://desktop.puter.com instead of /desktop.
A plain click opens the desktop the way the Apps tab opens an app in its
own tab: the launch params (app instance id, app id, Puter origin, API
origin, locale) go in the URL, and the app token is handed to the tab
through the opener rather than placed in the URL. The token is requested
by origin, so fetchUserAppTokenForLaunch accepts an origin and returns
the app uid the server resolved. Without a token the tab still opens at
the plain URL. A modified click, or a refused tab, stays a plain link.
* fix(ai): the image type hint only has to be a string when a request carries an input image
* fix(ai): OpenAI speech to text answers 400 to a prompt that is a list or an object
* test(ai): a fuzz case keeps its input and route when the catalog changes, and a suite that reaches no provider fails
* fix(ai): a model id with a colon after its vendor keeps its name when it is qualified
* fix(ai): the native Gemini request type accepts the xhigh effort Hydrogen takes
* style: restore the repo formatting in files the AI stack reflowed
* docs(ai): the image reference and quotas page cover Replicate's safety reruns
* ci: the AI provider workflow runs only the provider tests and passes every provider's key
* Point Mistral's floating Large aliases at Large 4 and apply its GA price
Mistral made Large 4 generally available on 2026-11-05, moved
`mistral-large-latest` to it, and deprecated Large 3 and Medium 3.5,
which both retire on 2027-04-30.
- `mistral-large-latest`, `mistral-large` and
`mistralai/mistral-large-latest` resolve to `mistral-large-4`. They
resolved to `mistral-large-2512`, which stays callable by its own id
until Mistral retires it.
- Large 4 uses Mistral's current rates: $0.70 input, $0.07 cached input
and $2.10 output per million tokens, in place of the preview rates.
It is marked open-weight.
- The Large 3 and Medium 3.5 entries carry their retirement date.
* Cap Mistral Large 4 output at the 262,144 tokens Mistral accepts
The catalog listed `mistral-large-4` with a 1,000,000-token output
limit, equal to its context window. Mistral rejects a request for more
than 262,144 completion tokens, so a request that left `max_tokens`
unset, or set it higher, failed with a 400 whenever the account's
credit covered more than 262,144 output tokens.
- `max_tokens` for `mistral-large-4` is 262,144. The context window
stays at 1,000,000 tokens.
- A test sends `mistral-large-4` and `mistral-large-latest` through the
chat driver with ample credit and checks the cap that reaches
Mistral.
---------
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
* Add Gemini 4 Carbon and Kling 4 video models
* Include Kling 4 models in the video driver catalog test
* Document the Kling 4 prompt limit for non-English text
Kling 4.0 and 4.0 Flash take 26,000 characters of English but 11,000
of other languages, with mixed text sharing the limit in proportion.
The video page and the quotas page said 26,000 for every prompt.
- txt2vid.md and rate-limits-and-quotas.md give both limits, the rule
for mixed text, and the error each one returns.
- Puter still rejects only a prompt over 26,000 characters. Kling
enforces the lower limit, and its refusal reaches the caller as
`upstream_bad_request` with nothing charged. A test covers that path.
* Add Gemini 4 Hydrogen and cap unary Gemini 4 Carbon output
Google released `gemini-4-hydrogen` on 2026-11-12. It uses the same
native request shape as Carbon and Argon.
- Hydrogen is served natively at $1.50 input, $7.50 output and $0.075
cached input per million tokens, with fast service at 1.8 times
those rates. It accepts `low`, `medium`, `high` and `xhigh` reasoning
effort, ignores temperature, and takes text and images.
- A Carbon response that isn't streamed is capped at 32,768 output
tokens, as Argon's already is, and the credit hold is sized to that
cap. Google reports this limit for both models. The cap is now a
field of the native model options instead of a check on Argon's id.
- chat.md and rate-limits-and-quotas.md list Hydrogen's reasoning
levels and limits and Carbon's unary cap.
* Move the reasoning_effort model list out of the chat options table
The `reasoning_effort` row in chat.md listed the models that read the
option. Model-specific details belong under Model-specific features,
which already gives each family's accepted values.
- The row no longer names models.
- The Gemini and Moonshot Kimi sections say that their other models
ignore the option.
---------
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
A chat completion keeps running for up to 10 minutes after the caller
hangs up, so the upstream can report usage. It now counts against the
caller's concurrency cap for as long as the upstream runs, instead of
until the response closes.
- The chat driver registers its upstream run with the request's
concurrency slot, so `/drivers/call` keeps the slot until the
upstream is done. The cleanup after it does not hold the slot.
- The route concurrency gate now uses the same CallSlot as
`/drivers/call`: the slot is held until the response is done and the
work the handler registered has settled. The OpenAI- and
Anthropic-compatible chat routes register the completion, so a
non-streaming call counts until the upstream answers too.
- CallSlot moves to core/http, since the route gate below the
controllers uses it. The context key is renamed keepConcurrencySlot.
- rate-limits-and-quotas.md says a completion counts until the model
finishes it, even after a disconnect.
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>