dexcost

What is dexcost?

An overview of the Agent Unit Economics platform.

The problem

AI agents make 3-10x more API calls than simple chatbots. Each call has a cost -- LLM tokens, vector database queries, tool calls, external APIs, compute. Most teams only track token costs from their LLM provider dashboard, missing 27% or more of their actual spend.

When you can't see your real costs:

  • You don't know which customers are profitable
  • Retry costs go undetected
  • Cost spikes surprise you at month-end
  • Pricing decisions are based on incomplete data

What dexcost does

dexcost wraps your agent workflows in tracked tasks and records every cost event -- LLM calls with auto-pricing, non-LLM service fees, compute costs, and retries. All costs are attributed to customers, projects, and workflows.

The SDK captures the data. The Control Layer aggregates and analyzes it. The dashboard surfaces actionable intelligence: cost per customer, cost health, profitability, anomalies, and forecasts.

How it works

  1. Install the SDK in your agent application (Python, TypeScript, Go, or Rust)
  2. Set context with dexcost.set_context(customer_id="...") to attribute costs
  3. LLM calls are auto-captured via instrumentation (OpenAI, Anthropic, LiteLLM)
  4. Non-LLM costs are recorded via dexcost.record_cost() or the rate registry
  5. Data syncs to the Control Layer for analytics
  6. The dashboard shows profitability, cost health, anomalies, and trends

Key concepts

ConceptDescription
TaskA business operation (e.g., "resolve support ticket"). Aggregates all costs.
EventA single cost event within a task (LLM call, API fee, retry).
CustomerThe end-user whose work triggered the task. Costs are attributed per customer.
RetryA repeated call caused by a transient error. Tracked as retry cost.

On this page