Repository navigation
Conversation
A page that prints a day, calendar week or month, the last 7/30/90 days or all of your usage as a receipt: cost per model, tokens and the agents behind them, in USD, CNY or JPY, saved as a PNG or copied as a picture. Reads only usage:day.
Contributor
|
Thanks for this. Holding it for the maintainer before a line-by-line review: it ships an embedded font bundle ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
@magpie-community/page-token-receipt, a page that prints your AI usage as a receiptfed by a paper printer.
What it does
rows, a week 6, a month or longer 8, the rest folded into "+N more models".
the agents with their logos (redrawn in one ink), a bill number.
rate) or JPY (a fixed, dated reference rate).magpie.image, painted at 3x.It is a port of my own dsh-token-receipt (MIT)
to magpie's page API.
Permissions and network
usage:day(magpie.permissions: ["usage:day"]).main, noexports, no runtime dependencies, no inline scripts.magpie >= 0.1.3427(usage:daywithfromspans, andmagpie.image), like Day card.How it differs from Day card
Day card also prints usage as a receipt from
usage:day, so I'd like to be upfront aboutthe overlap. What this page does that Day card doesn't: the printer and its stepped paper
feed instead of a card on a backdrop; the calendar week and month (Day card's are the
last 7 and 30 days); last 90 days; USD / CNY / JPY switching; models merged by name with a
row budget per period; agents' logos in one ink; 繁體中文. What Day card does that this
doesn't: streak, the day against your average day, backdrops. The package README has the
table. If you'd rather these live in Day card, I'm happy to talk about that instead.
Files
packages/token-receipt/: the package, with its test (token-receipt.test.mjs).README.md: a row in the Pages table.registry.json: the entry (kind: "page",community: true).Checks run
HOME=$(mktemp -d) bun test packages/token-receipt: 38 pass. The page tests check thatthe scripts read only what
permissionsdeclares and reach no network, thatindex.htmlloads every script as a file with no inline script, and that the fonts'licenses and the NOTICE ship with the package.
HOME=$(mktemp -d) bun teston the whole repo: 8898 pass, 9 skip, 0 fail.bun scripts/check.mjs token-receipt: passes.scripts/try.sh token-receipt: magpie 0.1.4095 loads it as a page.magpie web); the desktop app's WebKit window isnot covered by these checks.
After merge
First npm publish (and its Trusted Publisher) is for an org owner; until then magpie
installs from
dist, as usual.