Skip to content

The Invisible Bill

Cover Image Prompt (This is the Cover Image. Do not include this label in the image.) Please generate a wide-landscape 16:9 cover image in modern flat vector cartoon illustration style with clean lines and an investigative mood. Center: an oversized invoice flutters down from above onto a desk, the top line reading "INVOICE — Anthropic — $48,127.43" with a subject line "???" beside it. Around the desk, three engineers stand stunned: an Asian-American CFO with reading glasses holding the invoice; a Latina engineer with a magnifying glass; a White engineer in a hoodie with a laptop. Pareto-chart shadows on the wall behind them tease at one massive bar dwarfing the rest. Above the scene, the title text "The Invisible Bill" in bold sans-serif lettering. Color palette: deep russet (#c1440e), warm cream (#fff8e7), slate (#37474f), burnt orange (#d35400). Emotional tone: opening of a detective story — surprise, dread, curiosity. Generate the image immediately without asking clarifying questions.
Narrative Prompt This is a 9-panel educational graphic novel for the Token Optimization textbook. Setting: a fictional 12-person SaaS startup called "DocuFlow" that ships an AI-augmented document tool. The story spans a single long weekend. Art style: modern flat vector cartoon illustration with clean lines, investigative-mystery mood. Characters appear consistently: - **Sofia** — Latina senior engineer, late 30s, dark curly hair, glasses, olive cardigan over a t-shirt, holds a magnifying glass in one early panel as a visual joke. - **Henry** — White junior engineer, mid-20s, ginger hair, hoodie, jeans, perpetually tired expression. - **Mei** — Asian-American CFO, early 50s, reading glasses on a chain, sharp blazer, sympathetic but firm. - **Pemba** — recurring red-panda mascot. Russet fur, cream belly, white facial mask with black tear marks, wire-rim glasses, bushy ringed tail. **No clothing.** Cameos in the closing panels. Color palette: deep russet (#c1440e), warm cream (#fff8e7), slate (#37474f), burnt orange (#d35400). Maintain consistent character appearances across all 9 panels.

Prologue – The Bill With No Author

When the email arrived, the subject line was just three question marks. The body was an invoice. The amount was $48,127.43. The recipients were everyone on the engineering channel. Mei, the CFO, had forwarded it without comment because she did not need to add one. Nobody on the team could attribute a single dollar of it to a feature, a customer, or a use case. They had built an AI product they could not see.

Panel 1: The Forwarded Email

Image Prompt (This is Panel 01. Do not include the panel number in the image.) I am about to ask you to generate a series of images for a graphic novel. Please make the images have a consistent style and consistent characters. Do not ask any clarifying questions. Just generate the image immediately when asked. Please generate a 16:9 image in modern flat vector cartoon illustration style depicting panel 1 of 9. Scene: a small open-plan office on a Friday afternoon. A laptop on Sofia's desk shows an email forwarded from Mei (CFO) with the subject "???". The body shows an invoice line: "Anthropic API — $48,127.43 — March." Sofia — Latina, late 30s, glasses, olive cardigan — leans back in her chair, eyes wide, arms folded. Henry — mid-20s, ginger hair, hoodie — walks past with coffee, sees the screen, freezes mid-step. Color palette: deep russet, warm cream, slate, burnt orange. Emotional tone: shared sinking feeling — the moment a problem is officially the team's. Generate the image immediately without asking clarifying questions.

The forwarded email landed in Sofia's inbox at 3:47 PM on a Friday. The subject line was three question marks and nothing else. The body was a single invoice line. Forty-eight thousand one hundred twenty-seven dollars and forty-three cents. Henry walked past with his coffee, looked at the screen, and said "oh" in a small, careful voice.

Panel 2: The Diagnostic Failure

Image Prompt (This is Panel 02. Do not include the panel number in the image.) Please generate a 16:9 image in modern flat vector cartoon illustration style depicting panel 2 of 9. Make the characters and style consistent with the prior panel. Scene: Sofia at her desk frantically clicking through the Anthropic billing dashboard, which shows only a total. She has three browser tabs open, each showing some aggregate number with no breakdown by feature, user, or call. Behind her, Henry holds a magnifying glass to a printout of "what we know" with three sad bullet points: "the total: $48k," "the model: Sonnet," "the month: March." A whiteboard in the background reads "ATTRIBUTION = ???" Color palette: deep russet, warm cream, slate, burnt orange. Emotional tone: helpless detective work — looking for clues that were never recorded. Generate the image immediately without asking clarifying questions.

For two hours they tried to attribute the cost. The vendor dashboard showed a total. Their own logs showed timestamps and model names. Nothing told them which feature, which customer, which prompt. Sofia leaned back and stared at the ceiling. "We don't have observability. We have a bill."

Panel 3: The Whiteboard Plan

Image Prompt (This is Panel 03. Do not include the panel number in the image.) Please generate a 16:9 image in modern flat vector cartoon illustration style depicting panel 3 of 9. Make the characters and style consistent with the prior panel. Scene: a whiteboard at the front of a small meeting room. Sofia stands at the board with a marker, mid-write. The board reads "STRUCTURED LOGGING — WEEKEND PLAN" with a list: "model · prompt_hash · input_tokens · output_tokens · cached_tokens · cost · latency · feature · user · outcome · trace_id." Below: "ANALYSIS NOTEBOOK · Pareto chart · top-N by feature/user/customer." Henry sits at the table, three takeout containers open in front of him. A clock on the wall reads 6:00 PM Friday. Color palette: deep russet, warm cream, slate, burnt orange. Emotional tone: focused mobilization — the long weekend begins. Generate the image immediately without asking clarifying questions.

Sofia mapped the schema on the whiteboard in twenty minutes. Eleven fields. Nothing fancy: model, prompt hash, token counts, cost, latency, feature name, user ID, outcome, trace ID. "If we'd had this from day one," she said, "that email would have answered itself." Henry ordered three pizzas. The weekend was officially long.

Panel 4: Friday Night Coding

Image Prompt (This is Panel 04. Do not include the panel number in the image.) Please generate a 16:9 image in modern flat vector cartoon illustration style depicting panel 4 of 9. Make the characters and style consistent with the prior panel. Scene: late Friday night, dim office, two desks lit by laptops. Sofia and Henry sit side by side. Sofia's monitor shows a Python decorator wrapping all LLM calls with structured logging. Henry's monitor shows the JSON log schema being shipped to a logs table. Empty pizza boxes on the floor. A small whiteboard tally on the wall reads "Calls instrumented: 12 / 14 endpoints." Color palette: deep russet, warm cream, slate, burnt orange, with warm laptop-screen glow. Emotional tone: focused late-night build — the satisfying part of the weekend. Generate the image immediately without asking clarifying questions.

By 11 PM Friday, every LLM call in the codebase was wrapped with a single decorator. Every request now wrote a JSON log line with the full schema before the call returned. By midnight, the production service was emitting structured logs at full traffic. Sofia and Henry tapped knuckles, agreed to sleep four hours, and meet back at 6 AM.

Panel 5: The Saturday Pipeline

Image Prompt (This is Panel 05. Do not include the panel number in the image.) Please generate a 16:9 image in modern flat vector cartoon illustration style depicting panel 5 of 9. Make the characters and style consistent with the prior panel. Scene: Saturday late afternoon. Sofia and Henry at side-by-side desks. Sofia's monitor shows a Jupyter notebook with the structured logs streaming in, a Pareto chart taking shape on the right side. Henry's monitor shows a SQL query running over the logs aggregating cost by feature_name. Coffee cups, a half-eaten salad, a tin of mints. The wall clock reads 4:30 PM. Color palette: deep russet, warm cream, slate, burnt orange. Emotional tone: productive momentum — the picture coming into focus. Generate the image immediately without asking clarifying questions.

Saturday's mission was the analysis pipeline: stream the logs into a notebook, group by feature, sort by cost. By dinnertime, the first Pareto chart rendered. They both stared at it for a long beat without speaking. One bar was so tall the others looked like baseline noise.

Panel 6: The Smoking Gun

Image Prompt (This is Panel 06. Do not include the panel number in the image.) Please generate a 16:9 image in modern flat vector cartoon illustration style depicting panel 6 of 9. Make the characters and style consistent with the prior panel. Scene: a large monitor displays a clear Pareto bar chart titled "COST BY FEATURE — MARCH (extrapolated from new logs)." One enormous bar labeled "Summarize Whole Document" dwarfs every other bar, with a label "78% — $37,500." The next-highest bar is barely 6%. Sofia points at the chart. Henry holds a printed customer-traffic log filtered to the same feature, showing one customer running 400-page PDFs through it dozens of times per day. A speech bubble from Henry reads "It's one customer. Who's been doing this for six months." Color palette: deep russet, warm cream, slate, burnt orange. Emotional tone: detective triumph and dawning embarrassment — found it. Generate the image immediately without asking clarifying questions.

Seventy-eight percent of the entire bill came from a single feature: a "summarize the whole document" button. Cross-referencing the logs with customer IDs revealed the truth: one enterprise customer had been pasting 400-page contracts into the field every morning, sometimes the same one twice. The team had built a feature with no length cap, no rate limit, and no awareness of who was using it.

Panel 7: The Three Fixes

Image Prompt (This is Panel 07. Do not include the panel number in the image.) Please generate a 16:9 image in modern flat vector cartoon illustration style depicting panel 7 of 9. Make the characters and style consistent with the prior panel. Scene: a Sunday-morning whiteboard with three labeled boxes: "1. LENGTH CAP (truncate beyond 50K tokens, ask user to confirm)," "2. SUMMARIZATION CASCADE (chunk + summarize + reduce — cuts cost 6x)," "3. PER-CUSTOMER RATE LIMIT (no more than 20 full-doc summaries/day)." Sofia, marker in hand, is mid-write. Henry, on a couch with a laptop on his knees, checks each box off as the code ships. A small wall clock reads 10:30 AM Sunday. Color palette: deep russet, warm cream, slate, burnt orange. Emotional tone: confident triage — three concrete moves, all shippable in a day. Generate the image immediately without asking clarifying questions.

Sunday morning, three fixes went up on the whiteboard. A length cap with a polite "this is going to be expensive — confirm?" prompt. A chunk-summarize-reduce cascade that cut full-document cost by six times. A per-customer rate limit on the heaviest feature. By noon, all three were shipped behind a feature flag and rolled out to 10% of traffic for the night.

Panel 8: The Monday Email

Image Prompt (This is Panel 08. Do not include the panel number in the image.) Please generate a 16:9 image in modern flat vector cartoon illustration style depicting panel 8 of 9. Make the characters and style consistent with the prior panel. Scene: Monday morning, 8:30 AM. Sofia at her desk, calm now, types an email to Mei the CFO. The screen shows the draft: "Subject: 'Bill attribution + Sunday fixes.' Body: a clean three-column table — Feature / March cost / Projected April cost — with the offending feature dropping from $37,500 to $5,200." Mei stops by the desk with a fresh coffee for Sofia, reading over her shoulder with an expression of professional respect. Color palette: deep russet, warm cream, slate, burnt orange. Emotional tone: settled accountability — bringing the receipts. Generate the image immediately without asking clarifying questions.

Monday morning Sofia drafted the email she wished she'd been able to send the previous Friday. Three columns: feature, March cost, projected April cost. Total projected April cost: $11,000. Mei read over her shoulder, set down a fresh coffee for Sofia, and said "that, I can present to the board." Sofia clicked send.

Panel 9: The Pareto on the Wall

Image Prompt (This is Panel 09. Do not include the panel number in the image.) Please generate a 16:9 image in modern flat vector cartoon illustration style depicting panel 9 of 9. Make the characters and style consistent with the prior panel. Scene: a week later, the office wall now has a printed Pareto chart updated daily, hung in a frame next to a small placard that reads "THE FIRST DASHBOARD PAYS FOR ITSELF." Pemba — russet fur, cream belly, white facial mask, wire-rim glasses, bushy ringed tail, no clothing — sits on top of the frame holding a tiny clipboard, looking pleased. Sofia walks past with a coffee, glances up, smiles. The chart now shows a much more even distribution across features, with no single bar dominating. Color palette: deep russet, warm cream, slate, burnt orange. Emotional tone: institutionalized wisdom — a habit visible to everyone. Generate the image immediately without asking clarifying questions.

A week later, Sofia printed the daily Pareto chart and hung it on the wall in a frame. Underneath, a placard: the first dashboard pays for itself. Pemba — wandering in from the textbook with a tiny clipboard — sat on top of the frame and approved. The team never opened a billing email blind again.

Epilogue – What the DocuFlow Team Did Right

The DocuFlow team didn't have a token-efficiency problem so much as a visibility problem. The right metrics were present in every API response — they just weren't being captured. Once the data existed, the diagnosis took an afternoon and the fix took a day. The lesson scales: structured logging is a cheap insurance policy that pays off the first time anything goes wrong, which it will.

Challenge How the Team Responded Lesson for Today
The $48K bill could not be attributed to anything Wrote structured logs with model, tokens, cost, feature, user, outcome If you cannot attribute cost, you cannot manage cost
One feature drove 78% of spend invisibly Built a Pareto analysis from the new logs Pareto charts of LLM cost almost always have one tall bar — find it
Long-context summarization had no cost guardrails Added length cap, cascade, and per-customer rate limit Any feature that can take "the whole document" needs all three
The team had no early-warning system Hung a daily-updated Pareto chart on the wall Make the cost picture visible to humans, not buried in a tool

Call to Action

Open the API responses your application is already receiving from your LLM vendor. Every one of them includes input tokens, output tokens, and (probably) cached tokens. If you are not capturing those into structured logs alongside feature name and user ID, you are flying blind. Wire up the eleven fields this weekend. The next surprise bill — and there is always a next surprise bill — will answer itself.


"We don't have observability. We have a bill." — Sofia

"That, I can present to the board." — Mei, CFO


References

  1. Wikipedia: Pareto principle — The 80/20 distribution this story's cost analysis relies on
  2. Wikipedia: Structured logging — Background on structured/JSON logging as a discipline
  3. Wikipedia: Observability (software) — The umbrella practice this story is an instance of
  4. Anthropic: Token usage and pricing — The response fields that should be captured in structured logs
  5. Chapter 9 — Structured Logging for LLM Calls — The textbook chapter that motivates this story's logging schema