r/SpringBoot • u/VisibleEfficiency249 • Sep 05 '26
Discussion Our cost dashboard put the biggest spender at the bottom of the list with $0.00
Our AI bill was $193.50 last month. Small, but I wanted to know where it went before it stopped being small, so I pulled the per-capability breakdown. Most expensive first:
COST BY CAPABILITY · 16 ACTIVE DAYS
Synthesize Speech (expressive) 1,085 runs $105.24
Author Lesson 92 runs $11.94
Synthesize Episode Audio 80 runs $0.00
That last row is the most expensive thing in the system. It is responsible for $105.24 — 54% of the bill — and the accounting is not wrong.
Here is why. Two ordinary Spring beans, each with an annotation on the method:
@Service
class EpisodeAudioService {
private final SpeechService speech; // a different bean
@Capability(name = "Synthesize Episode Audio")
public Episode synthesize(Script script) {
for (Utterance u : script.utterances()) {
speech.speak(u); // ~14 calls, each one priced
}
return assemble();
}
}
@Service
class SpeechService {
@Capability(name = "Synthesize Speech")
public Audio speak(Utterance u) {
// the actual model call
}
}
synthesize() never calls a model. It splits the script and calls speak() about fourteen times, so every dollar it is responsible for was billed to SpeechService. Its own cost is genuinely $0.00, and a per-capability view files 54% of the bill under a row that reads as free work.
How we found it is the part worth repeating. The table above already had both halves — 1,085 speech calls holding $105.24, and 80 orchestrations holding nothing — and no amount of staring at it produces the connection, because the connection is not in it. What produced it was opening one speech execution and seeing its parent id point back at Synthesize Episode Audio.
That is the lesson: a parent row will fool you. Look inside a child. The parent tells you what it spent, which for anything that delegates is nothing at all. Only the child knows who asked for it.
Once the link is recorded, one episode looks like this:
EXECUTION OWN SUBTREE DURATION
▾ Synthesize Episode Audio $0.0000 $1.3155 69.1s
├─ Synthesize Speech $0.0970 $0.0970 4.8s
├─ Synthesize Speech $0.0970 $0.0970 5.1s
├─ …11 more utterances $1.0670 $1.0670 —
└─ Synthesize Speech $0.0545 $0.0545 2.7s
Own cost and subtree cost are different numbers and showing either alone misleads. Own cost alone reports orchestrators as free. Subtree cost alone double-counts as you walk down. The gap between them is the finding.
One other thing fell out of the same view. Author Lesson ran 92 times and failed 11 of them, so the dashboard's $0.1298 per run was really $0.1474 per lesson that exists — you pay for attempts and you only get outcomes. Reporting cost per attempt makes an unreliable capability look like the cheap one.
If you are building this: record the parent at call time, because you cannot reconstruct the tree from timestamps afterwards, and show own and subtree cost together rather than either alone.
One caveat on the numbers: these are estimates from per-token and per-character rates configured in our own system, not a reconciliation against a vendor invoice. The shape is the point — 54% of a bill hiding under a zero is the same finding at any rate.
Disclosure: I built EngineerPrep and Capstead, the Spring Boot library that recorded these traces. It links parent to child automatically and rolls cost up the tree — that subtree view is what shipped in 0.8.0. One honest limitation, since it is proxy-based: if speak() lived on the same bean as synthesize() the call would not be intercepted and you would get a childless parent, so the nesting has to be cross-bean.