- Home
- Skills
- Prompt & Skill Engineering
- Token Optimizer Cut Llm Costs
Works with the AI Agents you already use
Token Optimizer Cut Llm Costs
Cuts a prompt's tokens without changing what it does: a segment-by-segment token table, one chosen compression strategy, the rewrite, reduction metrics, a diff, and a cost formula
$5
/moSubscription · cancel anytime
Secure checkout via Stripe
- Always the latest version
- Delivered live to your agent via MCP
- Cancel anytime, access ends at period end
Token Optimizer Cut Llm Costs
Example session with this skill installed
This prompt runs 40k times a day, cut its tokens without changing what it does:
You are an extremely helpful, friendly and highly professional AI assistant whose job is to help our customers. It is very important that you always read the customer's review carefully and thoroughly before you do anything else. Please make sure that you understand the review completely. Your task is to classify the customer review that is provided below into exactly one of the following categories: Positive, Negative, or Neutral. Please note that you must only choose one category and you must not choose more than one category. After you have chosen the category, please also provide a short summary of the review in no more than one sentence. It is really important that the summary is short. Please do not include any personal opinions of your own in the summary. Please always respond in valid JSON format with the keys "category" and "summary". Do not include any other text outside of the JSON. Remember to be accurate. Here is the review: {{review}}
- Read your context and instructions
- Compiled the token optimizer cut
Here's how I read your request.
Quality criterion: the output has to stay the same: one of three labels, a one-sentence summary with no opinions, and bare JSON with the same two keys.
Usage context: a high-volume production call (40k runs a day) whose output is presumably parsed by code.
Compression style: you didn't name one, so I went for the most aggressive cut that keeps every instruction that affects behaviour. If you'd rather have a lighter edit that keeps the persona line, tell me and I'll redo it.
1. Token analysis
Token counts here are rough word-based estimates (words × 0.75), not tokenizer measurements. Run both versions through your model's tokenizer before you rely on any absolute number.
| # | Segment | Type | Approx. tokens | Notes |
|---|---|---|---|---|
| S1 | "You are an extremely helpful, friendly and highly professional AI assistant whose job is to help our customers." | Contextual | ~14 | A chat-assistant persona on a non-chat classification job. Its "friendly" tone has nowhere to show up in a JSON label. |
| S2 | "It is very important that you always read the customer's review carefully and thoroughly before you do anything else." | Redundant | ~14 | Tells the model to do what it already does. No checkable behaviour. |
| S3 | "Please make sure that you understand the review completely." | Redundant | ~7 | Says S2 again. |
| S4 | "Your task is to classify the customer review that is provided below into exactly one of the following categories: Positive, Negative, or Neutral." | Directive | ~17 | The core instruction. Keep it, minus the framing words. |
| S5 | "Please note that you must only choose one category and you must not choose more than one category." | Redundant | ~14 | Repeats "exactly one" from S4 twice more. |
| S6 | "After you have chosen the category, please also provide a short summary of the review in no more than one sentence." | Directive | ~16 | Second core instruction. The sequencing preamble is filler. |
| S7 | "It is really important that the summary is short." | Redundant | ~7 | Repeats "short" from S6. |
| S8 | "Please do not include any personal opinions of your own in the summary." | Directive | ~10 | A real constraint. Keep it, compressed. |
| S9 | "Please always respond in valid JSON format with the keys "category" and "summary"." | Structural | ~10 | Output contract written as prose. A literal JSON shape says it in fewer words. |
| S10 | "Do not include any other text outside of the JSON." | Structural | ~8 | A real constraint. Folds into S9 as "only". |
| S11 | "Remember to be accurate." | Redundant | ~3 | A no-op instruction. |
| S12 | "Here is the review: {{review}}" | Structural | ~4 | Input slot. Keep it, delimited. |
| Total | ~124 | Per-segment rounding. The whole-prompt estimate is 162 × 0.75 = ~121.5. |
Top 3 redundancy hotspots
- S5: says "one category" three ways, all already covered by "exactly one" in S4.
S2 + S3: two sentences (~21 tokens) of "read carefully / understand completely", which no model treats as a behaviour change.
3. S7: a whole sentence restating "short", which S6 already says.
2. Strategy
Hybrid: Semantic Compression + Protocol Abstraction.
Semantic Compression, because the prompt's main problem is restatement. "Exactly one" appears three times (S4, S5 twice), "short" twice (S6, S7), "read/understand" twice (S2, S3), and almost every sentence opens with framing like "Please note that", "It is really important that" or "Your task is to".
Protocol Abstraction, because the output contract (S9 + S10) is written as prose. A literal JSON shape states the keys, their order and the "nothing else" rule in one line, and models follow a literal shape more reliably than a description.
- Hierarchical Decomposition isn't needed. The prompt is one flat task with no layers or sub-steps to restructure.
3. Optimized prompt
Classify the customer review as exactly one of: Positive, Negative, Neutral.
Summarize it in one short sentence, with no opinions of your own.
Reply with only valid JSON: {"category": "...", "summary": "..."}
<review>{{review}}</review>
Everything stays in front of {{review}}, and that prefix is identical on every call. If your provider supports prompt caching, the prefix is now short and stable. At this length it may fall below a provider's minimum cacheable size, so check before counting on it.
4. Reduction metrics
| Measure | Original | Optimized | Reduction |
|---|---|---|---|
| Word count | 162 | 33 | (162 − 33) / 162 = 129 / 162 = 79.6% |
| Token estimate (words × 0.75) | 162 × 0.75 = 121.5 | 33 × 0.75 = 24.75 | (121.5 − 24.75) / 121.5 = 96.75 / 121.5 = 79.6% |
These counts cover the template only. The review text in {{review}} costs the same before and after, so the saving per call as a share of the whole request will be smaller than 79.6%. How much smaller depends on how long your reviews run. Also note that the × 0.75 ratio usually under-counts English tokens. The percentage holds whatever ratio you use, but the absolute numbers should come from your tokenizer.
At 40,000 runs a day the estimate is (121.5 − 24.75) × 40,000 =
~3.87M template tokens saved per day (a word-based estimate).
5. Preservation check
| Original requirement | Preserved? | Where |
|---|---|---|
| Classify into exactly one of Positive / Negative / Neutral | yes | Line 1 |
| Choose only one category, never more | yes | "exactly one" in line 1 |
| Summary of no more than one sentence | yes | "one short sentence" in line 2 |
| Summary is short | yes | "short" in line 2 |
| No personal opinions in the summary | yes | "with no opinions of your own" in line 2 |
| Valid JSON with keys "category" and "summary" | yes | Line 3, same keys, same order |
| No text outside the JSON | yes | "only" in line 3 |
| Review is supplied as the input | yes | Now wrapped in <review> tags |
| Helpful, friendly, professional assistant persona | partial | Removed. See the flag below. |
| Read carefully / understand completely / be accurate | partial | Removed as no-ops. See the flag below. |
Instructions absent or weakened: two. The
assistant persona (S1) and the
diligence reminders (S2, S3, S11) are gone. Nothing that constrains the output was removed.
6. Diff
| Original | Optimized | Change |
|---|---|---|
| "You are an extremely helpful, friendly and highly professional AI assistant whose job is to help our customers." | — | Removed: persona with no observable effect on a JSON label |
| "It is very important that you always read the customer's review carefully and thoroughly before you do anything else." | — | Removed: no-op diligence instruction |
| "Please make sure that you understand the review completely." | — | Removed: duplicate of the line above |
| "Your task is to classify the customer review that is provided below into exactly one of the following categories: Positive, Negative, or Neutral." | "Classify the customer review as exactly one of: Positive, Negative, Neutral." | Compressed: framing words dropped |
| "Please note that you must only choose one category and you must not choose more than one category." | (covered by "exactly one") | Merged into line 1 |
| "After you have chosen the category, please also provide a short summary of the review in no more than one sentence." | "Summarize it in one short sentence," | Compressed: sequencing preamble dropped, "no more than one" becomes "one" |
| "It is really important that the summary is short." | (covered by "short") | Merged into line 2 |
| "Please do not include any personal opinions of your own in the summary." | "with no opinions of your own." | Compressed into line 2 |
| "Please always respond in valid JSON format with the keys "category" and "summary"." | "Reply with only valid JSON: {"category": "...", "summary": "..."}" | Restructured: prose contract becomes a literal JSON shape |
| "Do not include any other text outside of the JSON." | (covered by "only") | Merged into line 3 |
| "Remember to be accurate." | — | Removed: no-op |
| "Here is the review: {{review}}" | "<review>{{review}}</review>" | Restructured: label becomes XML delimiters |
7. Cost formula
daily saving = (original tokens − optimized tokens) × 40,000 × price per input token
= (____ − ____) × 40,000 × $____
Fill in the two token counts from your tokenizer and the per-token input price for the model you run. My word-based estimate for the difference is ~96.75 tokens per call.
8. Rollout
Simplifications that could change behaviour:
Persona removed. The persona could have nudged the summary towards a softer register. If something downstream (or a person) reads the summaries, check that their tone still suits you.
"Be accurate / read carefully" removed. I expect no change, because these lines add no new information. But they are the only removed lines that touch the classification itself, so watch borderline Neutral cases in particular.
<review> tags added. This is a small change to the input framing. It usually helps, because a review that contains instructions is less likely to be followed as one. It is still a change, so test it along with everything else.
"..." placeholders in the JSON shape. Models fill these in reliably, but count a literal "..." in the output as a failure during the test below.
Recommendation: roll out gradually. At 40,000 runs a day, even a small parse-failure or label-drift rate is a lot of bad rows. First run both prompts side by side on a sample of real reviews and compare three things: whether the labels agree, whether the JSON parses, and whether each summary is one sentence. Then switch over.
prompt-token-optimizer · SKILL.md ~611 tokens (814 words × 0.75, estimate) · /mnt/skills/user/prompt-token-optimizer/SKILL.md
Subscription · always the latest version
- Secure checkout via Stripe
- Cancel anytime
- Delivered live via MCP
About this skill
For prompts that run often enough that every token costs real money. It treats compression as an engineering change, not a rewrite by taste: it measures where the tokens go, removes or merges what doesn't change behaviour, and proves the rewrite still asks for the same output.
What it does
It splits the prompt into labelled segments and builds a token table that tags each one as a directive, context, structure or redundancy, flagging the worst three. It picks one compression strategy and says which features of your prompt led to it. It rewrites the prompt, gives word and token reduction figures, checks the rewrite against your quality criteria requirement by requirement, and lays out every removed or merged line in a diff table. It finishes with the cost formula, so you can put in your own price per token.
Try it first
Paste a long prompt you run at volume and say "cut its tokens without changing what it does". Check the preservation table before trusting the rewrite.
What it needs
Nothing to install: no scripts, no network access and no API keys. It works on any model's prompts.
Token counts are estimates from word counts, not a tokenizer, and it labels them that way; run both versions through your model's tokenizer for exact numbers. It checks preservation by reading, not by running the prompt, so test the old and new versions on real inputs before switching. It won't remove an instruction that changes output just to save tokens, so a prompt that is mostly instructions can only shrink so far.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 27 days ago