Token economics · live demo
PROMPT RECEIPT CO.
six ways to spend fewer tokens
Tabular data without repeated key names or nested braces.
[{"name":"Alice Chen","role":"Engineer","team":"Platform","location":"Berlin"},{"name":"Ben Ortiz","role":"Designer","team":"UX Research","location":"Munich"},{"name":"Priya Nair","role":"PM","team":"Platform","location":"Remote"}]
name,role,team,location Alice Chen,Engineer,Platform,Berlin Ben Ortiz,Designer,UX Research,Munich Priya Nair,PM,Platform,Remote
Same structure, no styling tags or attributes to pay for.
<div class="report"><h2 style="color:#222;font-weight:700;">Q3 Summary</h2><table border="1" cellpadding="4"><tr><th>Metric</th><th>Value</th></tr><tr><td>Revenue</td><td>€120,000</td></tr><tr><td>Churn</td><td>2.1%</td></tr></table></div>
## Q3 Summary | Metric | Value | |---------|----------| | Revenue | €120,000 | | Churn | 2.1% |
Say the task. The model doesn't need the pleasantries.
Hi there! I hope you're doing well. Could you possibly help me out with something when you get a chance? I'm having a bit of trouble with a function in my code and I'd really appreciate it if you could take a look and let me know what you think might be causing the issue. Thanks so much in advance, I really appreciate your help!
Fix: getUserTotal() returns NaN when cart is empty. Function and error below.
Paste only what's broken, plus the error — not the whole codebase.
import { db } from './db';
import { logger } from './logger';
export function getUser(id) { return db.users.find(u => u.id === id); }
export function createUser(data) { return db.users.insert(data); }
export function deleteUser(id) { return db.users.remove(id); }
export function updateUser(id, data) { return db.users.update(id, data); }
export function getUserTotal(cart) {
return cart.items.reduce((sum, item) => sum + item.price, 0) / cart.items.length;
}
export function applyDiscount(total, code) { return total * 0.9; }
export function formatCurrency(n) { return `€${n.toFixed(2)}`; }
function getUserTotal(cart) {
return cart.items.reduce((sum, item) => sum + item.price, 0) / cart.items.length;
}
// Error: Division by zero when cart.items is empty -> returns NaN
Every turn resends the whole conversation so far. A fresh chat per task caps what gets resent, instead of it growing all session long.
Illustrative pattern, not measured data. Turns 1–10 on the x-axis.
Ask for the changed lines — don't pay to receive the whole file back.
import { db } from './db';
import { logger } from './logger';
export function getUser(id) { return db.users.find(u => u.id === id); }
export function createUser(data) { return db.users.insert(data); }
export function deleteUser(id) { return db.users.remove(id); }
export function updateUser(id, data) { return db.users.update(id, data); }
export function getUserTotal(cart) {
if (cart.items.length === 0) return 0;
return cart.items.reduce((sum, item) => sum + item.price, 0) / cart.items.length;
}
export function applyDiscount(total, code) { return total * 0.9; }
export function formatCurrency(n) { return `€${n.toFixed(2)}`; }
@@ getUserTotal @@ - return cart.items.reduce((sum, item) => sum + item.price, 0) / cart.items.length; + if (cart.items.length === 0) return 0; + return cart.items.reduce((sum, item) => sum + item.price, 0) / cart.items.length;
Token counts are illustrative estimates (~4 characters ≈ 1 token, a common rule of thumb for English text). Actual tokenization varies by model.
thank you for reading — no refunds on tokens already spent