Span-level costing is the practice of attributing LLM spend to individual trace spans rather than only to the final monthly bill. It lets teams see which step, tool, or prompt created the expense. This is essential for diagnosing waste, prioritising fixes, and validating whether a change actually reduced inference spend.
Expanded Definition
Span-level costing extends basic LLM billing analysis by attaching cost data to each trace span in an observed workflow, so teams can see the expense of a prompt, tool call, retrieval step, or model invocation in context. For NHI Management Group, the value of the term is not accounting alone but operational visibility: it helps separate expensive but necessary steps from avoidable waste, and it supports change analysis when teams alter prompts, routing, caching, or model choice. The concept sits alongside tracing and observability, but it is narrower than general FinOps because the unit of analysis is the execution span rather than the application, tenant, or month-end invoice. Definitions vary across vendors, and no single standard governs span attribution yet, so implementations often depend on trace schema quality and how consistently usage metadata is captured. The most common misapplication is treating aggregate invoice summaries as span-level costing, which occurs when teams cannot map usage events back to the exact span that generated them.
Examples and Use Cases
Implementing span-level costing rigorously often introduces telemetry overhead and governance complexity, requiring organisations to weigh finer-grained cost insight against added instrumentation work.
- A retrieval-augmented generation pipeline assigns cost to the retrieval span, the reranking span, and the final answer span, showing which stage drives the largest share of inference spend.
- An agentic workflow compares costs across tool-using spans to identify where repeated API calls or unnecessary retries inflate usage.
- A prompt optimisation experiment uses span-level costing to prove whether a shorter system prompt truly lowers spend, rather than relying on a single monthly bill.
- A routing layer measures cost differences between a premium model and a smaller fallback model at the span level, helping teams verify when routing rules are actually saving money.
- A shared service team uses span attribution to NIST Cybersecurity Framework 2.0 style governance thinking, tying operational visibility to accountable decision-making across services and owners.
These examples show why span-level costing is most useful when a workflow contains multiple model calls or chained steps, not when a single request produces a single flat response.
Why It Matters for Security Teams
Security and platform teams need span-level costing because AI spend can become a hidden control issue when inefficient workflows mask risky behaviour, duplicated processing, or uncontrolled agent activity. In environments that use LLMs for triage, summarisation, code generation, or autonomous execution, the cost profile of each span often reveals whether a step is merely expensive or actually suspicious, such as repeated retries, excessive tool use, or unexpectedly large context windows. That matters for NHI and agentic AI governance because non-human identities and agents frequently operate at machine speed, making waste scale quickly before humans notice. Span-level costing also supports policy enforcement by showing whether changes to prompts, model access, or retrieval design reduced spend without degrading task quality. In practice, the term is useful for ownership, chargeback, and exception review when teams need evidence rather than assumptions. Organisations typically encounter the consequences of poor span visibility only after a bill spike, at which point span-level costing becomes operationally unavoidable to explain the overrun.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST CSF 2.0, NIST AI RMF and NIST AI 600-1 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | GV.OV-01 | Governance oversight fits cost visibility and accountability for AI operations. |
| NIST AI RMF | GOVERN | AI RMF governs measurement and accountability for AI system impacts and operations. |
| NIST AI 600-1 | The GenAI profile addresses operational controls for managing generative AI systems. | |
| OWASP Agentic AI Top 10 | Agentic AI guidance covers tool-use and workflow behaviors that can drive hidden cost. | |
| CSA MAESTRO | MAESTRO addresses agentic AI orchestration where per-step cost visibility is useful. |
Use span cost data as an oversight signal to review ownership, exceptions, and inefficiencies.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on September 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org