See the difference between Opus 4.6 and Opus 4.7 tokenizers and share the aggregate results with the community.
- Install dependencies:
npm install- Create
.dev.vars:
ANTHROPIC_API_KEY=your_anthropic_api_key- Start the Next.js dev server:
npm run devThis app is configured for Cloudflare Workers using the OpenNext adapter and stores aggregate comparison stats in D1.
- Create a D1 database:
npx wrangler d1 create tokensmatter-
Copy the returned
database_idintowrangler.tomlfor bothdatabase_idandpreview_database_id. -
Apply the migration locally or remotely:
npx wrangler d1 migrations apply tokensmatter --local- Add the production secret:
npx wrangler secret put ANTHROPIC_API_KEY- Preview or deploy:
npm run preview
npm run deployWrangler now runs the OpenNext build automatically via the [build] hook in wrangler.toml, so wrangler dev and wrangler deploy will generate .open-next/worker.js before trying to use it.
- Prompt text is not stored. Only anonymous token-count comparison records are written to D1.
- The local
next devflow uses OpenNext's Cloudflare dev integration so route handlers can accessenv.DBandenv.ANTHROPIC_API_KEY. /api/count-tokensuses Cloudflare's native Workers Rate Limiting binding keyed byCF-Connecting-IPinstead of trusting spoofable forwarding headers.