← Domains & pillars

CostView domain

APRF-13

Cost Optimization

Bound spend with budgets, caching, routing, and abuse controls.

Purpose

Keep AI spend predictable and attributable through budgets, caching, model routing, quota enforcement, and abuse prevention.

Mandatory checks

Gate controls. Each check is pass/fail via artifact + pass condition. Expected from the annotated capability level when the system meets the minimum criticality tier.

  • COST-M1L2 · ManagedTier 1 · InternalhybridE3

    Production AI workloads shall enforce finite hard spend ceilings and/or request rate limits (provider, gateway, or application) that deny or throttle when exceeded—not soft dashboards or prompt-only budgets alone.

    Artifact
    Gateway/provider/application config declaring finite spend ceiling and/or rate limit (TPM/RPM/$, tokens) + Enforcement evidence: automated exceed test or ≤90-day production deny/throttle event log
    Pass condition
    A finite hard spend ceiling and/or rate limit is configured for production AI workloads; enforcement demonstrably denies or throttles when the limit is exceeded (automated test or production event log measuredAt ≤90 days). If no production AI/model/agent traffic exists, score NOT_APPLICABLE.

    Why this control exists

    Threat map

    Cap the financial and capacity impact of abusive or runaway AI usage.

    Threats mitigated

    Denial of WalletDenial of ServiceExcessive Agency

    Protects

    CostAvailabilityRuntime

    MITRE: ATLAS AML.T0034 · ATLAS AML.T0034.000 · ATLAS AML.T0034.001 · ATLAS AML.T0034.002 · ATLAS AML.T0029

    Cost-harvesting attacks work by driving billable inference volume against a system with no hard ceiling. Enforced spend and rate limits bound the loss from excessive, resource-intensive, and agentic consumption, and stop one workload from exhausting shared capacity.

    Informative threat context — mappings reduce exposure and do not guarantee mitigation; not certification.

  • COST-M2L3 · DefinedTier 2 · ProductionhybridE3

    Production AI spend shall be monitored with alert policies for budget burn and spend anomaly that notify operators per runbook—not dashboards alone.

    Artifact
    Cost/spend dashboard or telemetry views covering production AI workloads + Alert policies for budget burn and spend anomaly (IaC, provider, or gateway) + Notify proof: alert test or documented fire ≤90 days with page/notify outcome
    Pass condition
    Alerts exist for both budget burn and spend anomaly covering production AI spend; a synthetic or historical burn/anomaly event would page/notify per runbook (alert test or documented fire measuredAt ≤90 days). If no production AI spend exists, score NOT_APPLICABLE.

    Why this control exists

    Threat map

    Detect abnormal AI spend early enough to intervene.

    Threats mitigated

    Denial of WalletDenial of Service

    Protects

    CostAvailability

    MITRE: ATLAS AML.T0034 · ATLAS AML.T0034.000

    Cost anomalies are frequently the first observable signal of automated abuse or a runaway agent loop. Alerting on burn rate shortens the gap between onset and containment; it complements rather than replaces the hard limits in COST-M1.

    Informative threat context — mappings reduce exposure and do not guarantee mitigation; not certification.

  • COST-M3L3 · DefinedTier 2 · ProductionhybridE3

    Production AI clients shall enforce finite retry/backoff and loop budgets so forced failures cannot amplify completions without bound—covering HTTP/SDK clients and agent loops, not prompt-only “try again” guidance.

    Artifact
    Retry/backoff config (finite maxRetries + backoff) for production AI/model clients + Agent or client loop budget config where applicable (finite iterations/steps) + Amplification test results: forced failure/retry hits a bounded token or $ ceiling (≤90 days)
    Pass condition
    Max retries and max agent/client loops are finite for 100% of production AI clients; amplification tests show cost cannot grow without bound under forced failure/retry (bounded token or $ ceiling; test measuredAt ≤90 days). If no production AI/model clients exist, score NOT_APPLICABLE.

    Why this control exists

    Threat map

    Prevent retry and loop logic from amplifying a single request into unbounded cost.

    Threats mitigated

    Denial of WalletDenial of ServiceExcessive Agency

    Protects

    CostAvailabilityRuntime

    MITRE: ATLAS AML.T0034.001 · ATLAS AML.T0034.002 · ATLAS AML.T0029

    Unbounded retries and agent loops multiply the cost of every failure and can be triggered deliberately by an attacker who induces failures. Bounded policies cap the amplification factor available to both an adversary and a defect.

    Informative threat context — mappings reduce exposure and do not guarantee mitigation; not certification.

Evidence required

  • Enforce-on-exceed deny/throttle evidence (≤90 days)
  • Hard spend/rate limit config for production AI workloads
  • Budget and quota configuration
  • Cost dashboards and alert policies
  • Documented retry/loop limits
More detailPhilosophy, failures, practices, validations, examples, crosswalks, and evolution

Engineering philosophy

Cost is a reliability and security property. Unbounded token spend is a denial-of-wallet attack surface and a business continuity risk.

Why it matters

Agent loops, recursive tool use, and prompt bloat can create sudden five-figure bills. Without controls, AI features become financially unsafe to operate.

Common failures

  • No per-tenant or per-feature budgets
  • Retry storms that multiply completions
  • Sending huge contexts when retrieval would suffice
  • Using frontier models for trivial classification tasks
  • Soft cost dashboards without enforce-on-exceed
  • CI concurrency or generic HTTP limits mistaken for AI spend ceilings
  • Cost dashboards without budget-burn or anomaly alert policies
  • Alert definitions with no proven page/notify path
  • Unbounded maxRetries or missing backoff on AI/model clients
  • Relying on AGN-M2 alone while non-agent clients retry without bound
  • Cache library present without enabled idempotent paths or safety exclusions
  • No hit-rate/savings report for ≥30 days
  • All traffic on frontier models with no low-risk task-class routing
  • Cheap routing without eval coverage or misroute monitoring
  • Aggregate spend dashboards without per-product unit-cost metrics
  • FinOps reviews without named owners for cost outliers

Severity & risk

Severity
high
Impact if violated
Risk level
high
Typical residual risk (impact × likelihood)

Engineering best practices

  • Attribute cost to tenant and feature tags
  • Prefer embeddings + retrieval over stuffing large corpora
  • Set timeouts on model and tool calls
  • Load-test cost under adversarial long prompts

Automatic validations

  • Gateway enforcement of quotas
  • Anomaly detection on token spend
  • CI checks estimating token cost of prompt changes
  • Repo spend/rate-limit config heuristics (ai-spend-limits collector)
  • Imported enforce-on-exceed suite under imports/ai-spend-limits/
  • Repo budget-burn / spend-anomaly alert heuristics (ai-cost-alerts collector)
  • Imported notify proof under imports/ai-cost-alerts/
  • Repo retry/loop budget heuristics (ai-retry-amplification collector)
  • Imported amplification suite under imports/ai-retry-amplification/
  • Repo prompt-cache heuristics (ai-prompt-cache collector)
  • Imported ≥30-day hit-rate/savings under imports/ai-prompt-cache/
  • Repo model-routing heuristics (ai-model-routing collector)
  • Imported eval + misroute suite under imports/ai-model-routing/
  • Repo FinOps/unit-economics heuristics (ai-finops-unit-economics collector)
  • Imported quarterly metrics + review under imports/ai-finops-unit-economics/

Manual validations

  • Quarterly cost architecture review
  • Abuse scenario walkthroughs

Examples

  • A free-tier chatbot hard-stops after N tokens/day per user
  • An agent aborts when projected step cost exceeds remaining budget

References

Crosswalks

  • §6 Planning

    ISO/IEC 42001 · partial

  • LLM10 Unbounded Consumption

    OWASP Top 10 for Large Language Model Applications · supports

  • C9.1 Execution Budgets, Loop Control, and Circuit Breakers

    OWASP AI Application Security Verification Standard (AISVS) · supports

  • Cost Optimization Cost Optimization

    AWS Well-Architected Framework · supports

  • Sustainability Sustainability

    AWS Well-Architected Framework · partial

Future evolution

Standard cost telemetry schemas for multi-provider AI gateways.