diff --git a/apps/web/README.md b/apps/web/README.md index 150e54f..db936d8 100644 --- a/apps/web/README.md +++ b/apps/web/README.md @@ -1,13 +1,19 @@ # TokenBar website -The official TokenBar website. Today it is a single placeholder page; the real site is -a future milestone. +The official TokenBar website, served at . One static page that +explains the product, plus `/llms.txt`, `/llms.md`, `/robots.txt`, `/sitemap.xml` and a 404. ## Stack - [Astro](https://astro.build) with TypeScript (strict), output as a fully static site. -- No UI framework, no CSS framework, no client-side JavaScript. -- No analytics, tracking, external fonts, or third-party scripts. +- No UI framework and no CSS framework. All content is rendered to HTML at build time. +- A small amount of vanilla TypeScript for motion and interaction (about 7 KB gzipped). + No animation library, no WebGL. +- Two self-hosted fonts from Fontsource (Latin subset, SIL Open Font License): + Instrument Sans (variable, weight and width axes) and Instrument Serif (italic only). + Replicas of the app's UI use the system font, like the app does. +- No analytics, tracking, cookies, external fonts, or third-party scripts. The page + makes no requests to other origins; links to GitHub are plain links. The site is independent of the macOS app: it does not need Xcode, and the macOS build and release never touch this folder. @@ -31,10 +37,65 @@ npm run preview # serve the built dist/ locally Astro's CLI collects anonymous usage data by default. To opt out on your machine, run `npx astro telemetry disable` or set `ASTRO_TELEMETRY_DISABLED=1` (CI does the latter). +## Layout + +```text +src/ +├── config.ts # canonical links, SEO title and description, requirements +├── data/ +│ ├── sample.ts # sample usage shown in every replica (always labeled) +│ └── roadmap.ts # the roadmap section; mirrors docs/roadmap.md +├── components/ # one component per section, plus the app replicas +│ ├── StatusItem.astro # TokenBar's menu bar label +│ ├── Popover.astro # TokenBar's popover +│ └── … +├── scripts/ +│ ├── motion.ts # scroll-progress scenes, reveals, magnetic buttons, tilt +│ └── popover.ts # drives the popover replicas +├── layouts/BaseLayout.astro # : metadata, Open Graph, fonts, JSON-LD +└── pages/ # index, 404, sitemap.xml +public/ # robots.txt, llms.txt, llms.md, og.png, icons +``` + +## Motion and accessibility + +Every section is complete without JavaScript. An inline script in `` adds two +classes before the first paint: `js`, and `motion` unless the visitor prefers reduced +motion. Pinned (sticky) scroll scenes, reveals and the roadmap path only exist under +`.motion`; without it the page is a regular static document. Pinned scenes run only at +1024 px and wider; smaller screens get a simpler flow. Animations use `transform` and +`opacity`, and scene scripts only run while their section is near the viewport. + +## Keeping the facts in sync + +The website, `public/llms.txt`, `public/llms.md`, the structured data in +`src/pages/index.astro`, the Open Graph text in `src/config.ts`, the root README and +`docs/roadmap.md` must say the same things. Review all of them whenever TokenBar +changes any of: + +- supported providers or what each one shows, +- supported platforms (today: macOS available, Windows planned), +- major features, +- the privacy architecture, +- download or install behavior (today: unsigned and not notarized), +- the roadmap (`src/data/roadmap.ts` mirrors `docs/roadmap.md`). + +`llms.txt` and `llms.md` are maintained by hand on purpose; there is no generator. + +The download button always links to the latest GitHub release, so a new release needs +no website change unless the install steps change. The site URL lives in +`astro.config.mjs` (`site`) and is repeated as plain text in `public/robots.txt`, +`public/llms.txt` and `public/llms.md`. + +`public/og.png` (1200 × 630) is rendered from an HTML mock-up; regenerate it if the +headline or icon changes. `src/assets/logos/*.svg` are converted from the app's PDF logos +in `apps/macos/TokenBarKit/Sources/TokenBarUI/Resources/Logos` and are only used to +identify each provider. + ## Output -`npm run build` writes plain static files (HTML and inlined CSS) to `apps/web/dist/`. -Any static host can serve that folder as-is; no adapter or server runtime is needed. -Hosting is not configured yet. +`npm run build` writes plain static files (HTML, CSS, JS, fonts, images) to +`apps/web/dist/`. Any static host can serve that folder as-is; no adapter or server +runtime is needed. Hosting is not configured yet. No environment variables or secrets are needed. Never commit `.env` files. diff --git a/apps/web/astro.config.mjs b/apps/web/astro.config.mjs index 5cff76f..66ddefa 100644 --- a/apps/web/astro.config.mjs +++ b/apps/web/astro.config.mjs @@ -1,8 +1,16 @@ // @ts-check import { defineConfig } from "astro/config"; -// Static output only: `npm run build` writes plain HTML/CSS to dist/, which any static +// Static output only: `npm run build` writes plain HTML/CSS/JS to dist/, which any static // host (e.g. Cloudflare Pages) can serve. No adapter, no server runtime. export default defineConfig({ + // Production origin. Canonical URLs, Open Graph, the sitemap and structured data are built + // from it. public/robots.txt, public/llms.txt and public/llms.md repeat it as plain text. + site: "https://tokenbar.si", output: "static", + trailingSlash: "ignore", + build: { + format: "file", + }, + devToolbar: { enabled: false }, }); diff --git a/apps/web/package-lock.json b/apps/web/package-lock.json index 302d2a2..b8d1c7d 100644 --- a/apps/web/package-lock.json +++ b/apps/web/package-lock.json @@ -6,6 +6,8 @@ "": { "name": "tokenbar-web", "dependencies": { + "@fontsource-variable/instrument-sans": "5.3.0", + "@fontsource/instrument-serif": "5.3.0", "astro": "7.4.2" }, "devDependencies": { @@ -727,6 +729,24 @@ "tslib": "^2.4.0" } }, + "node_modules/@fontsource-variable/instrument-sans": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource-variable/instrument-sans/-/instrument-sans-5.3.0.tgz", + "integrity": "sha512-u4gKbDBTNFGkg997tfQn3eHOhHuquWUFTRT/rwzuKtrxX5P2ekfs2x+LgBPP4P32+cC+vUwF1Cr+IdRoPQbrGw==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@fontsource/instrument-serif": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource/instrument-serif/-/instrument-serif-5.3.0.tgz", + "integrity": "sha512-mDiaIg0u67sYV59fie92Wz4sM8UiVlbL7fLxnFPCKkX15DMASEnQTREbaP5S5/3DCcsoAOcQ0sV9E4AeY4QqYQ==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, "node_modules/@img/colour": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", diff --git a/apps/web/package.json b/apps/web/package.json index 2c3a90b..1fed680 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -13,6 +13,8 @@ "check": "astro check" }, "dependencies": { + "@fontsource-variable/instrument-sans": "5.3.0", + "@fontsource/instrument-serif": "5.3.0", "astro": "7.4.2" }, "devDependencies": { diff --git a/apps/web/public/apple-touch-icon.png b/apps/web/public/apple-touch-icon.png new file mode 100644 index 0000000..9a648ca Binary files /dev/null and b/apps/web/public/apple-touch-icon.png differ diff --git a/apps/web/public/favicon.png b/apps/web/public/favicon.png new file mode 100644 index 0000000..14ca788 Binary files /dev/null and b/apps/web/public/favicon.png differ diff --git a/apps/web/public/llms.md b/apps/web/public/llms.md new file mode 100644 index 0000000..f0bbe9b --- /dev/null +++ b/apps/web/public/llms.md @@ -0,0 +1,107 @@ +# TokenBar + +## What is TokenBar? + +TokenBar is a free and open-source app for monitoring AI usage limits from the system menu bar. Instead of opening a provider's dashboard or running a command in a terminal, you see how much of each plan limit you have used, and when it resets, at a glance. + +TokenBar is built around AI usage in general, not around one vendor. Today it supports two providers, Claude and Codex, and its architecture lets more providers be added over time. + +Website: https://tokenbar.si/ + +## Key facts + +- Free. No subscription, no paid plan, no pricing. +- Open source under the MIT License. +- Native macOS app, built with Swift, SwiftUI and AppKit. No Electron, no web views, no third-party runtime dependencies. +- An AI usage monitor that lives in the menu bar. It has no Dock icon and no window. +- No TokenBar account and no TokenBar backend or server. +- No analytics, telemetry, crash reporting, tracking, update checks or cloud sync. +- Currently supports Claude and Codex. Both integrations are experimental. +- macOS is available now. A Windows version is planned. + +## Supported platforms + +### macOS + +Available now. Requires macOS 14 Sonoma or later, on Apple silicon or Intel. + +### Windows + +Planned. There is no Windows release, no Windows download, and no release date yet. + +## Supported AI providers + +Both integrations are experimental. Neither Anthropic nor OpenAI publishes an API for plan limits, so TokenBar uses the same undocumented endpoints that Claude Code and Codex use to show usage. They may change or stop working at any time, and the providers' terms may not cover this use. Every provider starts disabled; TokenBar explains what it reads before the user enables it. + +### Claude + +Supported now (Claude Pro and Max plans). Shows the current session (5 hours) and weekly limits, plus Opus and Sonnet weekly limits when the plan has them, each with its reset time. Requires Claude Code signed in on the same Mac; TokenBar reads Claude Code's sign-in from the macOS Keychain when it refreshes. + +### Codex + +Supported now (ChatGPT plans). Shows Codex 5-hour and weekly limits, plus model-specific limits when the plan has them, each with its reset time. These are Codex limits, not ChatGPT chat message limits. Requires Codex (CLI or app) signed in with ChatGPT on the same Mac; TokenBar reads `~/.codex/auth.json`. Codex installations that keep their sign-in in the Keychain are not supported yet. + +### More providers + +Each provider implements one protocol (`UsageProvider`) and returns a normalized usage snapshot, so a new provider does not require changes to the menu bar, popover or refresh logic. A provider is added only when it has a reliable, documented-enough data source. No other provider is confirmed. + +## Features + +- Usage in the menu bar: each provider's logo with its current session percentage. +- Three menu bar display modes: Providers (one number per provider, the default), Minimal (only the provider whose session is most used) and Detailed (session and week, like `15/12`). +- Popover with every enabled provider in one line; expand one to see each limit with a bar and its reset time. +- Current session and weekly limits, and model-specific limits where the provider reports them. +- Reset information computed locally in the user's time zone, for example "Resets at 19:10 (in 2h 50m)" or "Resets in 2d 14h (Sat, Oct 25 at 07:00)". +- Usage levels: values are highlighted from 70% and marked as critical from 90%. +- Automatic refresh every 5 minutes by default (2–15 minutes, configurable), after the Mac wakes, and when the popover opens. +- If a refresh fails, the last values stay visible and are marked as outdated. +- Launch at Login (optional). +- English and Portuguese (Brazil). + +## Privacy + +- No TokenBar account. +- No TokenBar backend. Requests go directly from the user's Mac to the provider endpoints (`api.anthropic.com` for Claude, `chatgpt.com` for Codex), and only for providers the user enabled. +- No telemetry, no analytics, no crash reporting, no tracking and no update checks in the macOS app. +- Usage data is kept in memory and never written to disk. Network responses are not cached and cookies are not stored. +- Credentials are not copied into TokenBar-owned storage. TokenBar reads the existing Claude Code or Codex sign-in at refresh time and never stores, copies, refreshes or logs it. +- Preferences (refresh interval, enabled providers, menu bar mode) are stored in the standard macOS preferences file. +- The website has no analytics and sets no cookies. + +## Open Source + +- GitHub repository: https://github.com/DerRafDev/tokenbar +- License: MIT (https://github.com/DerRafDev/tokenbar/blob/main/LICENSE) +- Contributions are welcome: https://github.com/DerRafDev/tokenbar/blob/main/CONTRIBUTING.md +- Issue tracker: https://github.com/DerRafDev/tokenbar/issues +- Security reports are handled privately: https://github.com/DerRafDev/tokenbar/security/advisories/new + +## Download + +**macOS — Available now.** Download the latest release from https://github.com/DerRafDev/tokenbar/releases/latest (a `.dmg` and a `.zip`, with SHA-256 checksums in `SHA256SUMS.txt`). + +**Windows — Planned.** No download yet. + +The current macOS build is unsigned and not notarized by Apple, so macOS Gatekeeper blocks the first launch. To open it: open TokenBar once, then go to System Settings › Privacy & Security, find the message about TokenBar, click Open Anyway and confirm. This approves TokenBar only; Gatekeeper should not be turned off for the whole Mac. Developer ID signing and notarization are on the roadmap. + +## Roadmap + +There are no dates. Source: https://github.com/DerRafDev/tokenbar/blob/main/docs/roadmap.md + +- **Shipped — v0.1.0:** native macOS menu bar app; experimental Claude and Codex providers; session and weekly limits with reset countdowns; menu bar display modes; automatic refresh; launch at login; English and Portuguese (Brazil). +- **Planned:** a Windows version. No release date. +- **After 0.1.0 (candidates, not commitments; each needs evidence that it works reliably before it is built):** Developer ID signing and notarization; Codex Keychain sign-in; telling a Codex 403 apart from a workspace without Codex; refresh when the network comes back; automatic updates (needs a privacy-preserving design); more providers (only with a reliable, documented-enough source); menu bar customization. + +## Canonical links + +- Website: https://tokenbar.si/ +- GitHub: https://github.com/DerRafDev/tokenbar +- Releases: https://github.com/DerRafDev/tokenbar/releases +- Latest release: https://github.com/DerRafDev/tokenbar/releases/latest +- Issues: https://github.com/DerRafDev/tokenbar/issues +- License: https://github.com/DerRafDev/tokenbar/blob/main/LICENSE +- Roadmap: https://github.com/DerRafDev/tokenbar/blob/main/docs/roadmap.md +- Provider data sources: https://github.com/DerRafDev/tokenbar/blob/main/docs/providers.md +- Architecture: https://github.com/DerRafDev/tokenbar/blob/main/docs/architecture.md + +TokenBar is not affiliated with Anthropic or OpenAI. Claude, ChatGPT and Codex are trademarks of their respective owners. diff --git a/apps/web/public/llms.txt b/apps/web/public/llms.txt new file mode 100644 index 0000000..85e9235 --- /dev/null +++ b/apps/web/public/llms.txt @@ -0,0 +1,26 @@ +# TokenBar + +> TokenBar is a free, open-source (MIT) app that shows your AI usage limits in the system menu bar: how much of each plan limit you have used, and when it resets. macOS is available now; a Windows version is planned. It currently supports Claude and Codex. There is no TokenBar account, server, or telemetry. + +TokenBar is a native macOS menu bar app (Swift, SwiftUI and AppKit, no third-party runtime dependencies). It reads the sign-in that Claude Code or Codex already keeps on the Mac and asks each provider for plan usage directly. Both provider integrations are experimental, because neither provider publishes an API for plan limits. + +## Product + +- [TokenBar website](https://tokenbar.si/): Overview, features, privacy, roadmap and download +- [Full facts for language models](https://tokenbar.si/llms.md): Platforms, providers, features, privacy, download and roadmap in one Markdown file +- [Download for macOS (latest release)](https://github.com/DerRafDev/tokenbar/releases/latest): DMG and ZIP; the current build is unsigned and not notarized + +## Source and docs + +- [GitHub repository](https://github.com/DerRafDev/tokenbar): Source code and README +- [Provider data sources](https://github.com/DerRafDev/tokenbar/blob/main/docs/providers.md): Where each provider's usage data comes from, and what is read +- [Architecture](https://github.com/DerRafDev/tokenbar/blob/main/docs/architecture.md): Modules, domain model, refresh and security boundaries +- [Roadmap](https://github.com/DerRafDev/tokenbar/blob/main/docs/roadmap.md): Shipped, planned, and candidate items +- [Security policy](https://github.com/DerRafDev/tokenbar/blob/main/SECURITY.md): What TokenBar promises and how to report a vulnerability + +## Optional + +- [Adding a provider](https://github.com/DerRafDev/tokenbar/blob/main/docs/adding-a-provider.md): How new AI providers are added +- [Contributing](https://github.com/DerRafDev/tokenbar/blob/main/CONTRIBUTING.md): Workflow and code style +- [Issues](https://github.com/DerRafDev/tokenbar/issues): Bug reports and provider requests +- [License (MIT)](https://github.com/DerRafDev/tokenbar/blob/main/LICENSE) diff --git a/apps/web/public/og.png b/apps/web/public/og.png new file mode 100644 index 0000000..daab077 Binary files /dev/null and b/apps/web/public/og.png differ diff --git a/apps/web/public/robots.txt b/apps/web/public/robots.txt new file mode 100644 index 0000000..8f07920 --- /dev/null +++ b/apps/web/public/robots.txt @@ -0,0 +1,6 @@ +# TokenBar's website is public product information. All crawlers, including search and +# AI crawlers, are welcome. There is nothing private here. +User-agent: * +Allow: / + +Sitemap: https://tokenbar.si/sitemap.xml diff --git a/apps/web/src/assets/app-icon.png b/apps/web/src/assets/app-icon.png new file mode 100644 index 0000000..aabb87f Binary files /dev/null and b/apps/web/src/assets/app-icon.png differ diff --git a/apps/web/src/assets/icon.png b/apps/web/src/assets/icon.png new file mode 100644 index 0000000..8d7d53c Binary files /dev/null and b/apps/web/src/assets/icon.png differ diff --git a/apps/web/src/assets/logos/claude.svg b/apps/web/src/assets/logos/claude.svg new file mode 100644 index 0000000..613c717 --- /dev/null +++ b/apps/web/src/assets/logos/claude.svg @@ -0,0 +1 @@ + diff --git a/apps/web/src/assets/logos/openai.svg b/apps/web/src/assets/logos/openai.svg new file mode 100644 index 0000000..e109e69 --- /dev/null +++ b/apps/web/src/assets/logos/openai.svg @@ -0,0 +1 @@ + diff --git a/apps/web/src/components/Community.astro b/apps/web/src/components/Community.astro new file mode 100644 index 0000000..6180d00 --- /dev/null +++ b/apps/web/src/components/Community.astro @@ -0,0 +1,123 @@ +--- +// 09. Community: three questions, each with one place to go. +import Icon from "./Icon.astro"; +import { links } from "../config"; + +const rows = [ + { q: "Found a bug?", a: "Open an issue", href: links.newIssue }, + { q: "Have an idea?", a: "Share it in an issue", href: links.newIssue }, + { q: "Want to add a provider?", a: "Read the provider guide", href: links.addingProvider }, +]; +--- + +
+
+
+

09 Community

+

+ Built in public. +

+
+ +

+ Contribute on GitHub + Security issue? Report it privately. +

+
+
+ + diff --git a/apps/web/src/components/Download.astro b/apps/web/src/components/Download.astro new file mode 100644 index 0000000..a63b927 --- /dev/null +++ b/apps/web/src/components/Download.astro @@ -0,0 +1,267 @@ +--- +// 10. Download. Brings back the hero's menu bar and the app icon, then the honest install +// steps for an unsigned build (README › Installation). The button links to the latest +// GitHub release, so no version is hardcoded here. +import { Image } from "astro:assets"; +import appIcon from "../assets/app-icon.png"; +import Icon from "./Icon.astro"; +import StatusItem from "./StatusItem.astro"; +import { links, requirements } from "../config"; +--- + +
+ +
+ + +
+
+ TokenBar app icon +
+

+ Keep your limits{" "} + in sight. +

+

Download TokenBar. Free and open source.

+ +

+ macOS available now + Windows planned +

+

{requirements}

+
+ +
+
+

Opening it the first time

+

+ TokenBar is not signed and notarized by Apple yet, so macOS blocks the first launch. That is not a malware + finding: the build simply hasn’t gone through Apple’s Developer ID process. Open it only if you downloaded it + from the official releases. You approve TokenBar once; + later launches open normally. +

+
+
    +
  1. + 1 +

    Download the .dmg from the latest release, open it, and drag TokenBar to Applications.

    +
  2. +
  3. + 2 +

    Open TokenBar. When macOS says it can’t verify the app, click Done.

    +
  4. +
  5. + 3 +

    + Go to System Settings › Privacy & Security, find the message about TokenBar, click{" "} + Open Anyway, and confirm. +

    +
  6. +
  7. + 4 +

    Click TokenBar in the menu bar, choose Configure Providers…, and turn on the ones you use.

    +
  8. +
+

+ Don’t turn off Gatekeeper for your whole Mac; this approves TokenBar only. Each release lists SHA-256 checksums in{" "} + SHA256SUMS.txt. Prefer to build it yourself? The README has the steps. +

+
+
+
+ + + + diff --git a/apps/web/src/components/Footer.astro b/apps/web/src/components/Footer.astro new file mode 100644 index 0000000..2069b56 --- /dev/null +++ b/apps/web/src/components/Footer.astro @@ -0,0 +1,114 @@ +--- +import { Image } from "astro:assets"; +import icon from "../assets/icon.png"; +import { links } from "../config"; + +const nav = [ + { href: links.download, label: "Download" }, + { href: links.repo, label: "GitHub" }, + { href: "/#roadmap", label: "Roadmap" }, + { href: links.issues, label: "Issues" }, + { href: links.license, label: "License" }, + { href: `${links.repo}/blob/main/SECURITY.md`, label: "Security" }, +]; +--- + + + + diff --git a/apps/web/src/components/Hero.astro b/apps/web/src/components/Hero.astro new file mode 100644 index 0000000..d6abfd3 --- /dev/null +++ b/apps/web/src/components/Hero.astro @@ -0,0 +1,335 @@ +--- +// Hero. The site's menu bar already holds TokenBar's status item; here its popover hangs +// from it, like in a real menu bar. Scrolling pulls the popover out of the menu bar into depth. +import Popover from "./Popover.astro"; +import Icon from "./Icon.astro"; +import { links } from "../config"; +--- + +
+
+ + +
+
+

Free · Open source · Native

+

+ Your AI usage.{" "} + One glance away. +

+

+ Track your AI usage limits directly from your menu bar. Currently supports Claude and Codex. +

+ +

+ macOS available now + Windows planned + Install notes +

+
+ +
+
+ +
+
Illustration · sample data
+
+
+
+
+ + + + diff --git a/apps/web/src/components/Icon.astro b/apps/web/src/components/Icon.astro new file mode 100644 index 0000000..8a1681c --- /dev/null +++ b/apps/web/src/components/Icon.astro @@ -0,0 +1,36 @@ +--- +// Small line icons used in buttons and links. +interface Props { + name: "download" | "github" | "arrow" | "external" | "copy" | "check"; + class?: string; +} + +const { name, class: className } = Astro.props; +--- + + diff --git a/apps/web/src/components/Native.astro b/apps/web/src/components/Native.astro new file mode 100644 index 0000000..cd4b0c2 --- /dev/null +++ b/apps/web/src/components/Native.astro @@ -0,0 +1,271 @@ +--- +// 05. Native. Typography carries this section: the stack TokenBar is built on, what it is +// not built on, and a short spec sheet. Facts from README and docs/architecture.md. +import StatusItem from "./StatusItem.astro"; +import { links, requirements } from "../config"; + +const stack = [ + { name: "Swift", note: "Swift 6, strict concurrency" }, + { name: "SwiftUI + AppKit", note: "The system’s own UI frameworks" }, + { name: "macOS", note: "A menu bar app, no Dock icon, no window" }, +]; + +const nots = ["Electron", "Web views", "A browser wrapper", "Third-party code"]; + +const specs = [ + ["Requires", requirements], + ["Dependencies", "None. Foundation, SwiftUI, AppKit, Security, ServiceManagement, OSLog."], + ["Refresh", "Every 5 minutes by default (2–15), after wake, and when you open the popover. Never polls aggressively."], + ["Menu bar", "Rendered as a template image, so macOS tints it for light and dark menu bars."], + ["Login", "Opens at login if you want it to, through the system’s Login Items."], + ["Languages", "English and Portuguese (Brazil)."], +]; +--- + +
+
+
+
+

05 Native

+

+ Built for the menu bar.{" "} + Not squeezed into it. +

+

Today on macOS: a native menu bar app built with the system’s own frameworks.

+
+ +
    + { + stack.map((s, i) => ( +
  1. + {s.name} + {s.note} +
  2. + )) + } +
  3. + + + + TokenBar +
  4. +
+
+ +
+
+

What’s not inside

+
    + { + nots.map((n, i) => ( +
  • + {n} +
  • + )) + } +
+
+ +
+ { + specs.map(([k, v], i) => ( +
+
{k}
+
{v}
+
+ )) + } +
+
Source
+
+ All logic lives in one Swift package, split into core, providers and UI.{" "} + Architecture +
+
+
+
+
+
+ + diff --git a/apps/web/src/components/Nav.astro b/apps/web/src/components/Nav.astro new file mode 100644 index 0000000..41c57d5 --- /dev/null +++ b/apps/web/src/components/Nav.astro @@ -0,0 +1,349 @@ +--- +// The site navigation, drawn as a macOS menu bar: site links where an app's menus would be, +// and TokenBar's own status item (sample data) on the right, so it stays one glance away +// while you scroll. On small screens the links move into a
menu (works without JS). +import { Image } from "astro:assets"; +import icon from "../assets/icon.png"; +import StatusItem from "./StatusItem.astro"; +import { links } from "../config"; + +const items = [ + { href: "/#product", label: "Features" }, + { href: "/#privacy", label: "Privacy" }, + { href: "/#roadmap", label: "Roadmap" }, + { href: "/#open-source", label: "Open Source" }, +]; +--- + + + + + + diff --git a/apps/web/src/components/OpenSource.astro b/apps/web/src/components/OpenSource.astro new file mode 100644 index 0000000..95d245b --- /dev/null +++ b/apps/web/src/components/OpenSource.astro @@ -0,0 +1,354 @@ +--- +// 07. Open source. A terminal with the real clone steps and repository layout, the real +// provider protocol, and a ticker of what "free" means here. No GitHub statistics are shown. +import Icon from "./Icon.astro"; +import { links } from "../config"; + +const clone = "git clone https://github.com/DerRafDev/tokenbar.git"; +const tree = [ + ["tokenbar/", ""], + ["├── apps/", ""], + ["│ ├── macos/", "the native macOS app"], + ["│ └── web/", "this website"], + ["├── docs/", "architecture, providers, roadmap"], + ["├── scripts/", "test, lint, format, release"], + ["└── tools/", "the README demo renderer"], +]; +// Plain, fixed strings: safe to inline as HTML, and
 keeps their spacing exactly.
+const treeHtml = tree.map(([path, note]) => (note ? `${path}  ${note}` : path)).join("\n");
+const ticker = ["MIT licensed", "Free", "No subscription", "No account", "No tracking", "Pull requests welcome"];
+---
+
+
+
+
+

07 Open source

+

+ Read it.{" "} + Fork it.{" "} + Make it better. +

+

+ Every line of TokenBar is public under the MIT License, including how each provider integration works and why. + It is free, and there is no subscription. +

+ +
+ +
+
+ +
+
+ {clone} + +
+ cd tokenbar && open apps/macos/TokenBar.xcodeproj +

+        
+
+ +
+
public protocol UsageProvider: Sendable {"{"}
+    var descriptor: ProviderDescriptor {"{"} get {"}"}
+
+    func fetchUsage() async throws -> UsageSnapshot
+{"}"}
+
One protocol per provider · TokenBarCore/Provider/UsageProvider.swift
+
+
+
+ + +

TokenBar is MIT licensed and free, with no subscription, no account, and no tracking. Pull requests are welcome.

+
+ + + + diff --git a/apps/web/src/components/Popover.astro b/apps/web/src/components/Popover.astro new file mode 100644 index 0000000..02caa23 --- /dev/null +++ b/apps/web/src/components/Popover.astro @@ -0,0 +1,364 @@ +--- +// Replica of TokenBar's popover (TokenBarUI/UsagePopover.swift): one row per provider with +// its plan and current session; one provider at a time expands to show each limit with a +// bar and its reset time. Sample data only, labeled with a "Sample" badge. +// +// `interactive` renders real buttons that expand and collapse rows (scripts/popover.ts). +// Otherwise the replica is a picture with the same content in its label. +import ProviderLogo from "./ProviderLogo.astro"; +import { sampleProviders, type ProviderId } from "../data/sample"; + +interface Props { + id: string; + expanded?: ProviderId | null; + interactive?: boolean; + class?: string; +} + +const { id, expanded = "claude", interactive = false, class: className } = Astro.props; +const Head = interactive ? "button" : "div"; +const label = sampleProviders + .map((p) => `${p.name} ${p.plan}: ${p.limits.map((l) => `${l.title.toLowerCase()} ${l.used}%, ${l.reset.toLowerCase()}`).join("; ")}`) + .join(". "); +--- + +
+
+ { + sampleProviders.map((p) => { + const open = expanded === p.id; + const detailsId = `${id}-${p.id}`; + return ( +
+ +
+ ); + }) + } +
+
+ + + Updated 4m ago + + Sample + +
+
+ + diff --git a/apps/web/src/components/Privacy.astro b/apps/web/src/components/Privacy.astro new file mode 100644 index 0000000..8569305 --- /dev/null +++ b/apps/web/src/components/Privacy.astro @@ -0,0 +1,301 @@ +--- +// 06. Privacy. The diagram shows the whole architecture: the computer talks to each provider +// directly, and the TokenBar server in the middle does not exist. Facts from the README's +// Privacy section, SECURITY.md and docs/providers.md. +import { links } from "../config"; + +const facts = [ + ["No TokenBar account", "There is nothing to sign up for and nothing to sign in to."], + [ + "No TokenBar server", + "Requests go from your computer only to api.anthropic.com for Claude and chatgpt.com for Codex, and only for the providers you turned on.", + ], + ["No analytics", "No telemetry, crash reporting, tracking, or update checks. No cloud sync."], + [ + "No history", + "Usage is kept in memory and never written to disk. Responses are not cached and cookies are not stored.", + ], + [ + "Sign-ins stay where they are", + "TokenBar reads the sign-in Claude Code or Codex already keeps on your computer, at refresh time. It never stores, copies or renews it, and never logs tokens.", + ], + ["Off until you say so", "Every provider starts disabled and shows exactly what it will read before you confirm."], +]; +--- + +
+
+
+

06 Privacy

+

+ Your usage{" "} + stays yours. +

+

+ TokenBar talks to the providers directly from your computer. There is no TokenBar backend in between, so there is + nothing to collect your data. +

+
+ +
+ + + Your computer connects directly to api.anthropic.com for Claude and to chatgpt.com for Codex. There is no TokenBar + server in between. + + + + + + + + + TokenBar server + does not exist + + + + + + Your computer + TokenBar + Reads sign-ins at refresh time + Keeps usage in memory only + + + + api.anthropic.com + Claude + + + + chatgpt.com + Codex + + + + +
+ +
    + { + facts.map(([title, text], i) => ( +
  1. + {String(i + 1).padStart(2, "0")} +

    {title}

    +

    {text}

    +
  2. + )) + } +
+ +

+ What TokenBar promises, and how to report a problem privately, is in SECURITY.md. This website has no analytics and sets no cookies either. +

+
+
+ + diff --git a/apps/web/src/components/Problem.astro b/apps/web/src/components/Problem.astro new file mode 100644 index 0000000..22c302d --- /dev/null +++ b/apps/web/src/components/Problem.astro @@ -0,0 +1,370 @@ +--- +// 01. The problem: usage lives in dashboards and terminal commands. While you scroll, the +// windows clear away, the desktop dims, and only the menu bar (with TokenBar in it) remains. +import StatusItem from "./StatusItem.astro"; + +const windows = [ + { title: "Plan usage — Settings", kind: "bars" }, + { title: "Terminal — /usage", kind: "term" }, + { title: "Account — Limits", kind: "bars" }, + { title: "Terminal — /status", kind: "term" }, + { title: "Billing & usage", kind: "lines" }, +]; +--- + +
+
+
+
+

01 The problem

+

+ Stop checking{" "} + dashboards. +

+
    +
  • No dashboard hunting.
  • +
  • No browser tab.
  • +
  • No guessing.
  • +
+

+ Your limits stay in the menu bar while you work. TokenBar shows how much of each plan + limit you have used, and when it resets, without opening a terminal or a website. +

+
+ + +
+
+
+ + + + diff --git a/apps/web/src/components/Product.astro b/apps/web/src/components/Product.astro new file mode 100644 index 0000000..ef1483a --- /dev/null +++ b/apps/web/src/components/Product.astro @@ -0,0 +1,499 @@ +--- +// 02. The product tour: a working replica of the popover. Scrolling walks through glance, +// open, switch and refresh; the rows are real buttons, so visitors can also click through. +// Below it, the three menu bar display modes and the warning levels. +import Popover from "./Popover.astro"; +import StatusItem from "./StatusItem.astro"; + +const steps = [ + { + title: "Glance", + text: "Each provider’s logo sits in the menu bar with its current session: the number that matters while you work.", + }, + { + title: "Open", + text: "Click it for every enabled provider in one line. Expand one to see each limit with a bar and its reset time.", + }, + { + title: "Switch", + text: "One provider opens at a time, so the popover stays small. Session, weekly, and model-specific limits when your plan has them.", + }, + { + title: "Refresh", + text: "Every 5 minutes by default (2–15, your choice), after your computer wakes, and when you open the popover. If a refresh fails, the last values stay, marked as outdated.", + }, +]; + +const modes = [ + { id: "providers", name: "Providers", text: "One number per provider. The default." }, + { id: "minimal", name: "Minimal", text: "Only the provider whose session is most used." }, + { id: "detailed", name: "Detailed", text: "Session and week together, like 42/18." }, +]; +--- + +
+
+
+
+
+

02 The popover

+

+ One click.{" "} + Every limit. +

+
    + { + steps.map((s, i) => ( +
  1. + {String(i + 1).padStart(2, "0")} +

    {s.title}

    +

    {s.text}

    +
  2. + )) + } +
+
+
+
+ +
+

Interactive replica · sample data · click a provider

+
+
+
+
+ +
+
+

Three ways to sit in the menu bar.

+
+ { + modes.map((m, i) => ( + + )) + } +
+
+
+ + + + + +
+
+ { + modes.map((m, i) => ( +
+
{m.name}
+
{m.text}
+
+ )) + } +
+

+ The menu bar stays quiet until a limit gets close: values turn orange from 70% and{" "} + red from 90%. On the menu bar, which macOS tints for light and dark, close limits get + heavier and critical ones a dot. Too little room? The label falls back to a more compact mode. +

+
+
+ + + + diff --git a/apps/web/src/components/ProviderLogo.astro b/apps/web/src/components/ProviderLogo.astro new file mode 100644 index 0000000..f498b28 --- /dev/null +++ b/apps/web/src/components/ProviderLogo.astro @@ -0,0 +1,32 @@ +--- +// The provider logos the app ships (TokenBarUI/Resources/Logos), converted from PDF to SVG. +// They identify each provider only. `template` draws them in the current text color, like +// the macOS menu bar does; otherwise Claude keeps its brand color. +import claude from "../assets/logos/claude.svg?raw"; +import openai from "../assets/logos/openai.svg?raw"; + +interface Props { + name: "claude" | "openai"; + template?: boolean; + class?: string; +} + +const { name, template = false, class: className } = Astro.props; +let svg = name === "claude" ? claude : openai; +if (template) svg = svg.replace(/fill="#[0-9A-Fa-f]+"/, 'fill="currentColor"'); +svg = svg.replace(" + + diff --git a/apps/web/src/components/Providers.astro b/apps/web/src/components/Providers.astro new file mode 100644 index 0000000..1215428 --- /dev/null +++ b/apps/web/src/components/Providers.astro @@ -0,0 +1,300 @@ +--- +// 03. Providers supported today. The two logos travel in from opposite edges and settle +// into one menu bar item. The list below is the factual part: what each provider shows, +// what it needs, and how more providers can be added. +import ProviderLogo from "./ProviderLogo.astro"; +import StatusItem from "./StatusItem.astro"; +import { links } from "../config"; +--- + +
+
+

03 Providers

+ + + +

+ Claude. Codex.{" "} + One place. +

+ +
+

Currently supported

+

+ TokenBar is built around AI usage, not one vendor. Claude and Codex are the providers it supports today, side by + side in one menu bar item and one popover. +

+
+ +
    +
  • +
    +
    +
    +
    +
    Shows
    +
    Current session (5 h) and weekly limits, plus Opus and Sonnet weekly limits when your plan has them.
    +
    +
    +
    Needs
    +
    Claude Code signed in on the same computer.
    +
    +
    +
  • +
  • +
    +
    +
    +
    +
    Shows
    +
    + Codex 5-hour and weekly limits, plus model-specific limits when your plan has them. These are Codex limits, not + ChatGPT chat message limits. +
    +
    +
    +
    Needs
    +
    Codex (CLI or app) signed in with ChatGPT on the same computer.
    +
    +
    +
  • +
  • +
    + +

    The next provider

    +
    +
    +

    + Every provider implements one protocol and returns the same kind of usage snapshot, so adding one never touches + the menu bar, the popover, or the refresh logic. A new provider ships only once its data source is documented + and reliable. +

    + +
    +
  • +
+ +
+

+ Both integrations are experimental. Neither Anthropic nor OpenAI publishes an API for plan limits, + so TokenBar uses the same undocumented endpoints that Claude Code and Codex use to show your usage. They may change + or stop working at any time. Every provider starts disabled, and TokenBar explains what it reads before you turn it + on. Read the data sources +

+
+
+
+ + + + diff --git a/apps/web/src/components/Resets.astro b/apps/web/src/components/Resets.astro new file mode 100644 index 0000000..ea6c26a --- /dev/null +++ b/apps/web/src/components/Resets.astro @@ -0,0 +1,415 @@ +--- +// 04. Reset times. A gauge like the app icon, and a clock that scroll moves forward: +// usage climbs, turns orange at 70%, the session resets, and the countdowns follow. Strings +// use the app's formats ("Resets at 5:10 PM (in 2h 18m)"). Sample data. +--- + +
+
+
+
+

04 Resets

+

+ Not just how much.{" "} + When. +

+

+ A percentage alone doesn’t tell you whether to slow down. TokenBar shows when each limit resets: the clock time + when it’s today, the day when it’s later. Countdowns are computed on your computer, in your time zone. Updating them + never makes a network request. +

+
+ +
+ + +
+
+
+ Current session + 42% +
+ + Resets at 5:10 PM (in 2h 18m) +
+
+
+ Weekly + 18% +
+ + Resets in 3d 4h (Sun, Oct 26 at 7:00 PM) +
+ +

Illustration · sample data · Thu, Oct 23

+
+
+
+
+
+ + + + diff --git a/apps/web/src/components/Roadmap.astro b/apps/web/src/components/Roadmap.astro new file mode 100644 index 0000000..d4c476b --- /dev/null +++ b/apps/web/src/components/Roadmap.astro @@ -0,0 +1,506 @@ +--- +// 08. Roadmap. A luminous path runs through the milestones. Scroll draws it and carries the +// TokenBar icon along; milestones light up as it passes, and the spotlit milestone (Windows) emerges from the dark. +// Without JavaScript the path is a plain line and every milestone is lit. +import { Image } from "astro:assets"; +import icon from "../assets/icon.png"; +import { roadmap } from "../data/roadmap"; +import { links } from "../config"; +--- + +
+
+
+

08 Roadmap

+

+ Where it’s{" "} + going. +

+

+ From the public roadmap. There are no dates: the order shows + how settled each item is, not when it ships. +

+
+ +
+ + + +
    + { + roadmap.map((m, i) => ( +
  1. + +
    +

    + {m.label} + {m.version && {m.version}} + {m.platform && {m.platform}} +

    +

    {m.title}

    + {m.text &&

    {m.text}

    } + {m.items && ( +
      + {m.items.map((it) => ( +
    • + {it.title} + {it.text && {it.text}} +
    • + ))} +
    + )} +
    +
  2. + )) + } +
+

The path continues. Suggest what’s next

+
+
+
+ + + + diff --git a/apps/web/src/components/StatusItem.astro b/apps/web/src/components/StatusItem.astro new file mode 100644 index 0000000..45c8512 --- /dev/null +++ b/apps/web/src/components/StatusItem.astro @@ -0,0 +1,78 @@ +--- +// Replica of TokenBar's menu bar label. Modes match the app: "providers" (each logo with its +// current session), "minimal" (only the busiest provider) and "detailed" (session/week, +// "42/18"). Values are sample data; scripts update [data-v] and [data-mode]. +import ProviderLogo from "./ProviderLogo.astro"; +import { sampleProviders } from "../data/sample"; + +interface Props { + class?: string; + highlighted?: boolean; +} + +const { class: className, highlighted = false } = Astro.props; +--- + + + { + sampleProviders.map((p) => ( + + + )) + } + + + diff --git a/apps/web/src/config.ts b/apps/web/src/config.ts new file mode 100644 index 0000000..ca1d63f --- /dev/null +++ b/apps/web/src/config.ts @@ -0,0 +1,29 @@ +// Canonical links and product facts used across the site. Keep them in sync with the +// README, docs/roadmap.md, public/llms.txt and public/llms.md (see the README in apps/web). + +const repo = "https://github.com/DerRafDev/tokenbar"; + +export const links = { + repo, + // Always the newest release, so no page hardcodes a version to download. + download: `${repo}/releases/latest`, + releases: `${repo}/releases`, + issues: `${repo}/issues`, + newIssue: `${repo}/issues/new/choose`, + providerRequest: `${repo}/issues/new?template=provider_request.yml`, + security: `${repo}/security/advisories/new`, + license: `${repo}/blob/main/LICENSE`, + contributing: `${repo}/blob/main/CONTRIBUTING.md`, + roadmap: `${repo}/blob/main/docs/roadmap.md`, + providers: `${repo}/blob/main/docs/providers.md`, + addingProvider: `${repo}/blob/main/docs/adding-a-provider.md`, + architecture: `${repo}/blob/main/docs/architecture.md`, +} as const; + +export const seo = { + title: "AI Usage Limits in Your Menu Bar | TokenBar", + description: + "Track your AI usage limits from your menu bar. TokenBar is a free, native and open-source app that shows session and weekly limits and when they reset. Supports Claude and Codex. Available for macOS, with Windows planned.", +} as const; + +export const requirements = "macOS 14 Sonoma or later · Apple silicon or Intel"; diff --git a/apps/web/src/data/roadmap.ts b/apps/web/src/data/roadmap.ts new file mode 100644 index 0000000..3e87155 --- /dev/null +++ b/apps/web/src/data/roadmap.ts @@ -0,0 +1,61 @@ +// The public roadmap, from docs/roadmap.md. Keep both in sync. No dates: the order shows how +// settled each item is. "Candidates" are not commitments. + +export type RoadmapState = "shipped" | "planned" | "exploring"; + +export interface Milestone { + state: RoadmapState; + label: string; + title: string; + version?: string; + /** Platform availability shown as a tag. */ + platform?: string; + text?: string; + items?: { title: string; text?: string }[]; + /** Shown as a large word that emerges as the path reaches it. */ + spotlight?: boolean; +} + +export const roadmap: Milestone[] = [ + { + state: "shipped", + label: "Shipped", + version: "v0.1.0", + title: "The beginning", + platform: "macOS · Available now", + text: "The first public release.", + items: [ + { title: "Native menu bar app for macOS" }, + { title: "Claude and Codex, experimental" }, + { title: "Session and weekly limits with reset countdowns" }, + { title: "Three menu bar display modes" }, + { title: "Automatic refresh and open at login" }, + { title: "English and Portuguese (Brazil)" }, + ], + }, + { + state: "planned", + label: "Planned", + title: "Windows", + spotlight: true, + text: "A Windows version of TokenBar is being planned. There is no release date and no download yet.", + }, + { + state: "exploring", + label: "After 0.1.0", + title: "Candidates, not commitments", + text: "Each one needs evidence that it works reliably before it is built.", + items: [ + { + title: "Developer ID signing and notarization", + text: "Removes the first-launch Gatekeeper step and keeps Claude’s Keychain permission across updates. The release pipeline already supports it.", + }, + { title: "Codex Keychain sign-in", text: "For Codex installations that keep their sign-in in the Keychain." }, + { title: "Clearer Codex errors", text: "Telling an expired sign-in apart from a workspace without Codex." }, + { title: "Refresh when the network comes back", text: "Today data stays marked outdated until the next scheduled refresh." }, + { title: "Automatic updates", text: "Would be the first request not made for a provider. Needs a privacy-preserving design." }, + { title: "More providers", text: "Only with a reliable, documented-enough data source." }, + { title: "Menu bar customization", text: "Driven by feedback from daily use." }, + ], + }, +]; diff --git a/apps/web/src/data/sample.ts b/apps/web/src/data/sample.ts new file mode 100644 index 0000000..ef217b1 --- /dev/null +++ b/apps/web/src/data/sample.ts @@ -0,0 +1,46 @@ +// Sample data for every TokenBar replica on the site. It matches the README demo +// (tools/demo) and is always labeled as sample data. Strings follow the app's formatter +// (UsageFormatter): "Resets at 5:10 PM (in 2h 18m)", "Session 42% · Week 18%". + +export type ProviderId = "claude" | "codex"; + +export interface SampleLimit { + id: "session" | "weekly"; + title: string; + short: string; + used: number; + reset: string; +} + +export interface SampleProvider { + id: ProviderId; + name: string; + plan: string; + logo: "claude" | "openai"; + limits: SampleLimit[]; +} + +export const sampleProviders: SampleProvider[] = [ + { + id: "claude", + name: "Claude", + plan: "Max", + logo: "claude", + limits: [ + { id: "session", title: "Current session", short: "Session", used: 42, reset: "Resets at 5:10 PM (in 2h 18m)" }, + { id: "weekly", title: "Weekly", short: "Week", used: 18, reset: "Resets in 3d 4h (Sun, Oct 26 at 7:00 PM)" }, + ], + }, + { + id: "codex", + name: "Codex", + plan: "Plus", + logo: "openai", + limits: [ + { id: "session", title: "Current session", short: "Session", used: 12, reset: "Resets at 6:45 PM (in 3h 53m)" }, + { id: "weekly", title: "Weekly", short: "Week", used: 27, reset: "Resets in 5d 2h (Tue, Oct 28 at 4:52 PM)" }, + ], + }, +]; + +export const sampleLabel = "Sample data: Claude 42%, Codex 12%"; diff --git a/apps/web/src/layouts/BaseLayout.astro b/apps/web/src/layouts/BaseLayout.astro index 663e33b..5910f23 100644 --- a/apps/web/src/layouts/BaseLayout.astro +++ b/apps/web/src/layouts/BaseLayout.astro @@ -1,51 +1,68 @@ --- +import sansUrl from "@fontsource-variable/instrument-sans/files/instrument-sans-latin-wdth-normal.woff2?url"; +import serifUrl from "@fontsource/instrument-serif/files/instrument-serif-latin-400-italic.woff2?url"; +import "../styles/global.css"; + interface Props { title: string; description: string; + /** Structured data objects, serialized as JSON-LD. */ + schema?: object[]; + noindex?: boolean; } -const { title, description } = Astro.props; +const { title, description, schema = [], noindex = false } = Astro.props; +const canonical = new URL(Astro.url.pathname.replace(/index(\.html)?$/, ""), Astro.site); +const ogImage = new URL("/og.png", Astro.site); + +// Self-hosted, Latin subset only. The serif is only used in italic, for a few words. +const fontCss = ` +@font-face{font-family:"Instrument Sans";font-style:normal;font-display:swap;font-weight:400 700;font-stretch:75% 100%;src:url(${sansUrl}) format("woff2-variations"),url(${sansUrl}) format("woff2")} +@font-face{font-family:"Instrument Serif";font-style:italic;font-display:swap;font-weight:400;src:url(${serifUrl}) format("woff2")}`; + +// Runs before first paint: `js` turns on enhanced layouts, `motion` turns on animation. +// Without JavaScript, or with Reduce Motion, the page is a static, complete document. +const boot = `(function(){var d=document.documentElement,m=matchMedia("(prefers-reduced-motion: reduce)");d.classList.add("js");function s(){d.classList.toggle("motion",!m.matches)}s();m.addEventListener&&m.addEventListener("change",function(){location.reload()})})();`; --- - - + {title} + + {noindex && } + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/pages/404.astro b/apps/web/src/pages/404.astro new file mode 100644 index 0000000..8ac8a65 --- /dev/null +++ b/apps/web/src/pages/404.astro @@ -0,0 +1,29 @@ +--- +import BaseLayout from "../layouts/BaseLayout.astro"; +import Nav from "../components/Nav.astro"; +import Footer from "../components/Footer.astro"; +--- + + +