OpenAgents: billing and observability, an external audit

OpenAgents: billing and observability, an external audit

offgrid

An external review of openagents.com and the cloud coding agent behind it, run between 30 Nov and 1 Dec 2026. Everything here was observed from outside: HTTP requests against the public API with an ordinary account, and a read of the shipped client bundle. No source access, no privileged endpoints, no attempt to break anyone's account. Two accounts were used, both mine: one created by email, one by a NIP-98 Nostr event.

The agent itself works. I ran three real turns through the cloud sandbox — a hello, a file write plus a shell read, and a long generation I cancelled. The tool loop is correct and the streaming phases are honest. The problems below are almost all about money: what a run costs, and whether anyone can find out.

Summary

  • B1 - costMsat is never populated. Every event in openagents.chat.event.v2 carries costMsat. Across four usage events and 144 total events it was 0 every time. Severity: high, effort: small.
  • B2 - /api/v1/usage/summary reports zeros while credits move. After two runs that cost 150,988 micros the summary still said todayTokens 0 and todayUsdMicros 0, 75 seconds later. Severity: high, effort: small.
  • B3 - a cancelled run is charged and leaves no usage event. The cancelled turn produced 125 events and zero usage events, and cost 93,223 micros. Severity: high, effort: medium.
  • B4 - no prompt caching; every call re-bills the whole conversation. cacheRead was 0 on all four usage events while input grew 7,329 to 19,006 within one turn. Severity: high (cost), effort: small if the provider supports it.
  • O1 - the event log is per-token. 118 text_delta rows for one essay; 144 events and about 103 KB for three turns. Severity: medium, effort: medium.
  • A1 - /api/workspace/tree 404s on every empty chat load. Still open on both client and server. Severity: low, effort: small.
  • A2 - magic/start hangs instead of returning 429 for a rate-limited address. Five attempts, no response under 24 s or 97 s, while fresh addresses answered in 5 to 8 s in the same minute. Severity: medium, effort: small.
  • A3 - the OTP try counter is per code, not per address. Five wrong codes are rejected, then a new magic/start returns tries: 5 again for the same address. Severity: medium, effort: small.

Billing

B1 — costMsat is a field nothing fills

The event schema is good: every event has costMsat, and the usage event carries the token counts. The field is simply never set:

#6   usage  costMsat=0  {"input":7329,  "output":5,  "reasoning":26,  "cacheRead":0}
#13  usage  costMsat=0  {"input":14699, "output":31, "reasoning":132, "cacheRead":0}
#16  usage  costMsat=0  {"input":16905, "output":51, "reasoning":144, "cacheRead":0}
#18  usage  costMsat=0  {"input":19006, "output":72, "reasoning":153, "cacheRead":0}

If costMsat were filled on the usage event, a run would be auditable from the events endpoint alone, with no new schema and no new route.

B2 — the usage summary does not see the money

before:  balanceUsdMicros 2000000
after:   balanceUsdMicros 1849012      (-150,988 micros, about 15 cents)
summary: {"todayTokens":0,"todayInputTokens":0,"todayOutputTokens":0,
          "todayUsdMicros":0,"monthUsdMicros":0}

I checked again 75 seconds after the run in case the accounting was asynchronous. It was still zero. There is also no ledger: /api/v1/usage/events, /usage/runs, /billing/summary and /credits/ledger all return 404.

This is the finding I would fix first. The product sells pay-as-you-go in Bitcoin, and the only question a paying user asks is what a run cost and why. Right now the answer is a number that moves with nothing attached to it. 18,633 micros for 7,334 tokens is about $2.54 per million; that may well be the right price, but neither the user nor the operator can confirm it from the API.

B3 — cancelled runs are charged with no record

turn 1  (hello)       7 events   usage events: 1   completed
turn 2  (file task)  12 events   usage events: 3   completed
turn 3  (cancelled) 125 events   usage events: 0   cancelled  stopReason "stopped"

Cancelling works and produces the right terminal event. Charging for tokens generated before the stop is also fair. The problem is that the one run a user is most likely to dispute is the only one with no accounting at all. If someone asks why a ten-second cancelled run cost nine cents, nobody can answer from the API.

Fix: emit a usage event on cancel with whatever was consumed, and set stopReason on it. If the runtime cannot report partial usage, emit the event with null counts and the elapsed time — at least there is a row.

B4 — no prompt caching

Within a single turn of two tool calls the input grew 7,329, 14,699, 16,905, 19,006 on consecutive model calls, and cacheRead was 0 every time. The whole conversation is re-sent and re-billed at list price on every call. That is why a two-tool turn cost about seven times a one-line hello: 13 cents against 1.9.

A conversation that grows to 19k input per turn is exactly what prompt caching exists for. Enabling it is the single change that improves both margin and the user's bill.

Event log

O1 — one row per token

Three turns produced 144 events: 120 text_delta, 8 started, 4 usage, 3 user_message, 2 tool_progress, 2 tool_result, 2 thinking_delta, 2 completed, 1 cancelled. One essay alone was 118 text_delta rows, and every row carries the full event.v2 envelope — about 103 KB for three short turns.

For a product whose pitch is one conversation synced across five devices, that is O(tokens) rows per turn, and both storage and replay cost scale with how much the agent talked. Coalescing deltas into one assistant_message per completed segment, or keeping deltas out of the durable log, changes nothing the user sees.

Auth and API

A1 — /api/workspace/tree 404s on empty chat load

The client requests the tree with a fresh session id before any conversation exists, and the server answers 404 session_not_found. Both halves are unchanged: the client still asks, and the server still refuses even for a freshly generated id. The red console error on every new chat is the visible symptom.

A2 — magic/start hangs for a rate-limited address

Same client, same minute, same proxy:

GET  /api/health                    200 in 4.8-8.3 s   (8 tries)
POST magic/start, fresh address     200 in 5.1-7.9 s   (5 tries)
POST magic/start, limited address   no response at 24.4, 24.5, 97.1, 97.3, 97.3 s

The IP path returns a correct RFC 9457 429. The address path returns nothing at all. Consequences: the user sees a spinner instead of an error; every attempt pins a worker for the full duration, which is a cheap way to consume concurrency without an account; and the limit cannot be measured from outside. Check the address budget before calling the identity provider and return the same 429.

A3 — the OTP try counter is per code

Five wrong codes are rejected, and magic/start then advertises tries: 5 again for the same address. The real limit on guessing a six-digit code is therefore five per send, and the only brake is how fast sends are allowed. Key the failed-attempt counter on the address, with a cooldown that outlives a resend.

Verified clean

  • Logout is real: POST /api/auth/logout returns ok and the old cookie stops authenticating immediately.
  • No CORS surface: a preflight from a foreign origin gets 404 with no Access-Control headers, and a cross-origin GET returns 200 with no ACAO, so the body is unreadable to a browser.
  • Conversations are correctly scoped: a second account gets 404 for a conversation id belonging to the first.
  • The session cookie is HttpOnly, Secure and SameSite=Lax, and document.cookie is empty on the app origin.
  • Electron hardening in the desktop build is correct: contextIsolation on, nodeIntegration off, sandbox on, setWindowOpenHandler denies, openExternal limited to https, http and mailto.
  • The preload IPC bridge is a closed switch of 31 named methods with a default that returns an unknown-method error; no shell, no file write, no removal.
  • OAuth uses PKCE with a random localhost port, and the deep links only resolve a pending promise.

What I would do, in order

  • Fill costMsat on the usage event, and make /api/v1/usage/summary sum it. Two small changes that turn an invisible bill into an auditable one.
  • Emit a usage event when a run is cancelled, with whatever was consumed and stopReason set.
  • Turn on prompt caching if the model supports it. Biggest single effect on both margin and user cost.
  • Fix the address rate-limit path so it returns 429 instead of hanging.
  • Key the OTP counter on the address rather than the code.
  • Coalesce text deltas into one message event per segment.
  • Gate the workspace/tree query on the client and return an empty 200 tree for owned sessions that have not booted.

Method note: every number above is reproducible from the public API with an ordinary account. The two runs that consumed credits were paid for with the $2 trial credit the project gives new accounts. Nothing was installed, nothing was modified, and no account other than mine was touched.

Update, 1 Dec, after the fixes shipped

Four of the findings above were fixed within hours of publication, and one of my own claims was wrong. Recording both, because a stale audit is worse than no audit.

  • A1 is fixed. Empty chat load no longer requests a tree for a session that does not exist, and the console error is gone. Re-tested after deploy: the call returns 200 with no errors.
  • A2 and A3 are fixed. Live RateLimit-* headers now decrement per request (83, 82, 81, 80 across four calls, Limit 120) instead of the hardcoded 119, and the OTP counter is keyed on the normalized address on both magic/start and magic/verify.
  • 401 responses are now correct. application/problem+json with type, title, status, code, detail, instance, resolution and documentation_url, plus WWW-Authenticate. The one nit left is a non-standard `error` member that duplicates `title`.
  • My oa_session claim was wrong. I injected the cookie myself; Playwright's add_cookies() defaults httpOnly to false, so I was reading my own injection.

Still open from the original list: B1 through B4 and O1. The billing story has not changed.

The OpenAPI contract does not describe the API

/openapi.json is live and valid OpenAPI 3.1.0 and documents 11 paths and 13 operations. Live and undocumented: /api/workspace/tree, /api/v1/usage/summary, /api/briefings and the whole /api/auth surface.

ConversationSummary documented: id, title, model, archived, lastEventId, updatedAt
ConversationSummary actual:      id, account, revision, title, sourceDevice, workspace,
                                 pinned, archived, lastEventId, createdAtMs, updatedAtMs

documented, never sent:  model, updatedAt
sent, never documented:  account, revision, sourceDevice, workspace, pinned, createdAtMs, updatedAtMs

ConversationListResponse documented: {conversations}
ConversationListResponse actual:     {schema, conversations}

AuthMeResponse documented: authenticated, signedIn, authRequired, email, label
AuthMeResponse actual:     authenticated, signedIn, isAdmin, mode, workosEnabled,
                           principal, github, credits

One mismatch was introduced by a fix rather than repaired by it: HealthResponse still documents storageMode, backendMode and activeSessions, which are exactly the fields removed from /api/health as the information disclosure. The endpoint is clean; the contract still advertises the leak.

Desktop: the packaged app

Read out of the mac zip without downloading it whole — the zip central directory plus the 3.9 MB asar header, fetched with HTTP Range. Everything below is from v1.0.0-rc3, which is the only release anyone can currently download.

  • No CSP at all. out/renderer/index.html has no CSP meta tag, and the openagents:// handler serves files with net.fetch(file://…) adding no headers; there is no onHeadersReceived or webRequest in the main bundle.
  • 7,870,774 bytes of source maps. main-CttEg1nI.js.map is 7,780,910 and entry.bare-DvLvUbRj.js.map is 89,864. The entire renderer source is recoverable from the shipped app.
  • ELECTRON_RENDERER_URL is honored in packaged builds. The window loader and the navigation trust predicate both read it with no app.isPackaged guard, so setting it on a packaged install loads remote content into a window that has the preload bridge attached, and marks that origin trusted.
  • The Windows installer is unsigned. SHA256 matches the published manifest exactly; Authenticode reports NotSigned. With electron-updater's default verifyUpdateCodeSignature, an unsigned app has no publisher name to compare, so auto-update from rc3 on Windows is likely to fail at the install step.

Verified solid in the same build: contextIsolation, nodeIntegration false and sandbox true on both windows; setWindowOpenHandler denies and routes through openExternal limited to https, http and mailto; will-navigate blocked for untrusted origins; the custom scheme registered secure and standard; and the protocol handler returns 403 on path traversal.

Who wrote this

An independent reviewer. I do not work for OpenAgents and was not paid by them. Every finding in this document was reported publicly, in their own launch thread, before this page existed.

I do this for other products. If you want the same treatment applied to yours before you ship — a written review with reproductions, impact and fixes, delivered on a schedule rather than when I happen to find something — the way to reach me is Nostr and the way to pay me is sats.

npub157udnlx46gtn4c0ljduk4yzumks3pjew8nrnth4xrsccydqttksqlywhu2

Lightning: the same npub at npub.cash. Bitcoin: bc1q33pg6904750gat90tkqaky7ujgycmrmf9u39nk

No email, no company, no KYC. That is the whole business.

Report Page