1.0.0 • Published 6 months ago
@eimen/token-saver v1.0.0
Token Saver
Cut polite fluff out of your prompts so you spend less on tokens.
04/17/2025: Sam Altman admits that saying "Please" and "Thank You" to ChatGPT is wasting millions of dollars in computing power.
Disclaimer: Only works with English as of now.
Install
npm i @eimen/token-saver # or yarn add @eimen/token-saver / pnpm add @eimen/token-saver
Quick start
ESM
import TokenSaver from "@eimen/token-saver";
const saver = new TokenSaver();
const out = saver.process("Please summarise this text, thank you!");
console.log(out.cleaned); // "Summarise this text."
console.log(out.estimatedTokensSaved); // 3
CommonJS
const TokenSaver = require("@eimen/token-saver");
Options
Option | Default | What it does |
---|---|---|
removePoliteness | true | kill please, thank you and similar niceties |
removeFillers | true | kill um, uh, actually, well … |
removeRedundantIntros | true | kill “I was wondering if you could” style prefixes |
tokenCharRatio | 4 | char‑per‑token estimate for savings calculation |
Pass a partial options object to the constructor:
new TokenSaver({ removeFillers: false });
API surface
clean(prompt: string): string
process(prompt: string): {
original: string;
cleaned: string;
charsSaved: number;
estimatedTokensSaved: number;
}
Types are shipped in index.d.ts
.
CLI one‑liner
npx @eimen/token-saver "Please help me. Thanks!" # prints "Help me."
(CLI is just node -e
sugar; no global install needed.)
Why bother
- ChatGPT Turbo is ~4 characters per token. Two polite words can cost 1–2 tokens.
- Multiply by millions of prompts. Real money.
- Faster requests, shorter logs.
Contributing
git clone https://github.com/eimenhmdt/token-saver
cd token-saver
npm i
npm test
License
MIT
1.0.0
6 months ago