5 Commits
Author SHA1 Message Date
CatoandClaude 7d8e94b7c2 fix(ai): a cost under a hundredth of a cent reads "under $0.0001", not "$0.0000" (#1733)
Live on 2026-11-15 the AI card said "about $0.0000 by estimate" for 66 priced
OpenAI embedding calls: a real cost shown as nothing. Below $0.0001 the card
now says "under $0.0001".


Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-15 15:46:19 +01:00
CatoandClaude 672c84141e feat(ai): the fleet AI card says what the paid calls cost (#1732)
ai-kit 1.30 prices each paid answered call from its tokens and the vendor's
published price. The card now shows, per vendor and per app, "Cost: ≈ $X
(estimate)" and how many paid calls could not be priced (never counted as
$0); the headline adds "about $X by estimate". A note says the vendor's bill
is the final word and where its link is.


Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-15 14:32:14 +01:00
CatoandClaude 0f62a33cff feat(ai): the fleet AI card covers today, 7 or 30 days, and every vendor says where to pay or stop (#1725)
The owner, 2026-11-15: one place to see every AI provider, how much was used,
and an easy way to upgrade or add credits. The card showed today only, named
OpenAI as the bare id 'openai' with no link, and offered one console link per
vendor. Now a Today / 7 days / 30 days switch reads that many days of the log,
the wording follows the period, OpenAI and Anthropic are named vendors, and
each vendor has direct links: usage, limits, upgrade or add credits, billing,
and for Google 'Turn billing off'.


Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-15 11:06:37 +01:00
CatoandClaude e974d4ecd9 feat(ai): the fleet AI card says what each app's calls were for (#1718)
ai-kit 1.29 lets a call name its feature; each app row now reads "Used for:
law translate: 40 answered · 200 failed · law ask: …". The owner asked to
know what the AI was used up for; on 14 Nov Solon spent Groq's free day before
09:10 UTC and the card could only say "Solon". An app that names nothing
shows no line. ai-kit floor raised to 1.29.


Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-14 12:13:39 +01:00
CatoandClaude Fable 5.2 3889d7e7c2 feat(settings): every app on this server and every AI vendor, today (#1705)
* ops(fleet-env): retire a key everywhere in one command; GEMINI_API_KEY is no longer a fleet key; ai-kit 1.26

GEMINI_API_KEY sat in /opt/fleet/env as a free tier. The Google project had
billing and every app read the key: about $567 on 10-11 Nov 2026. On
2026-11-13 it was still set there, with eight apps on an ai-kit that puts
Google in the free chain.

- fleet-env.sh where KEY: every env file on the box that sets KEY, by
  fingerprint. retire KEY: its line in /opt/fleet/env and in every app env
  becomes a dated comment (the value is kept), and the app units restart one
  at a time so none keeps the value it started with.
- fleet-keys.conf drops GEMINI_API_KEY, so seed never brings it back.
- fleet-env.yml offers where and retire with a key input.
- @bitbaum/ai-kit ^1.26.0: Google out of the free chain, paid AI off unless
  an app opts in, daily caps.

test-fleet-env.sh covers where, retire (value kept, other lines untouched,
no value printed, seed does not restore) and the refusal of a non-credential.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* test(ops): four .env cases that need an unreadable file are not run as root

chmod 000 is how the section makes a .env unreadable, and root reads any
file. In an agent's sandbox (uid 0) the four cases could only fail, on main
too, and stopped every push that touched scripts/hetzner. They print as not
run; CI and a developer's machine run them as an ordinary user.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* ops(launch): every app on the box writes to one AI usage log; ai-kit 1.27.0

launch.sh.tmpl exports AI_USAGE_DIR=/opt/fleet/ai-usage where that
directory exists and AI_APP_ID from the app's directory name, unless the
app's own .env sets them. @bitbaum/ai-kit 1.27.0 then writes one line per
model call there (app, vendor, model, outcome; never content). fleet-env.yml
creates the directory. Kivvi canaries 1.27.0, so the rollout gate no longer
passes 1.26.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* feat(settings): every app on this server and every AI vendor, today

The owner, 2026-11-13: 'I never know what is used up, what isn't, what it
was used up for, and when. Is it just one app, or is it all the apps?'
About $567 had gone to Google and nobody could say which app spent it.

Settings > AI gains the operator's card 'Every app on this server'. It
reads the one usage log every app writes (@bitbaum/ai-kit usage-log,
AI_USAGE_DIR) and shows, per vendor: free or billing, whether its key is on
this server, what today looked like, the last trouble in words, what that
means for the next request, and which apps used it; then the same by app.
A log that could not be read is never drawn as nothing used; a vendor
nobody called is 'not called today', not full and not empty; a person's own
key is counted apart.

- lib/ai/fleet-usage.ts (pure view), /api/ai/fleet (operator only, key
  NAMES only), components/settings/AiFleetSettings.tsx
- scripts/test/fleet-usage.ts: 12 checks

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* docs(env): AI_USAGE_DIR in .env.example

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* fix(fleet-env): retire edits the file a symlinked .env points at, never the link

/opt/<app>/app/.env is a symlink to shared/.env. An in-place sed on the
link replaces it with a regular copy, which later changes to shared/.env
never reach. where and retire resolve each file first, so the 13 paths the
box listed for GEMINI_API_KEY are the 8 files they really are.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* test(npm-publish): tamper with the first character of the sealed body, not the last

The last base64url character of a body carries bits that belong to no
byte, so replacing only the tail could decode to the same bytes, and
openSecret rightly accepted it: 'tampering is refused' failed on an unlucky
random IV (CI on #1705, 2026-11-13). The first character always changes a
byte. 40 of 40 runs pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-13 12:27:51 +01:00