Source library / Guides

Non-LLM Cost Tracking For AI Agents

How to track search, speech, vector database, workflow, and other non-LLM API costs next to model spend.

Short answer

Track non-LLM agent cost by reporting raw usage metrics for each external service, such as characters, requests, seconds, or lookups. AgentMeter prices those metrics in the dashboard and attributes them to the same customer and step as model calls.

Query paths
  • - How do I track Pinecone cost per customer?
  • - How do I track ElevenLabs or Deepgram usage inside an AI agent?
  • - How do I include search API spend in agent margins?

The Blind Spot

Production agents often call search APIs, speech APIs, vector databases, workflow runners, and inference services. Provider model dashboards do not show those costs together with LLM spend.

A legal, support, or sales agent can look profitable at the model layer while losing margin after retrieval, speech, and enrichment calls are counted.

  • - Search: Serper, Tavily, Exa, or custom web retrieval.
  • - Speech: ElevenLabs, Deepgram, or text-to-speech and speech-to-text APIs.
  • - Storage and retrieval: Pinecone, Qdrant, Weaviate, or hosted database calls.

Report Usage, Not Price

Application code should report what happened, not what it costs. Pricing changes belong in the dashboard because vendors change rates and builders charge different customers differently.

Report a non-LLM usage metric
import { reportUsage } from "@agentmeter/sdk";

reportUsage({
  customer_id: "acme-corp",
  tool: "tts",
  metric: "characters",
  value: 4200,
  step: "speak_answer",
});

Pre-Go-Live Checklist

Before launch, scan imports, dependencies, and runtime calls for services that create cost. Every cost source should have a metric name, unit, pricing rule, and owner approval.

This is a distribution wedge for AgentMeter because it gives teams an immediate artifact they can act on: the cost source checklist.

FAQ
Do I need a wrapper for every external API?

No. Use reportUsage or report_usage for the metric that matters, such as characters, requests, seconds, or executions.

Can pricing change without a code deploy?

Yes. Usage events stay raw; pricing is applied by AgentMeter from builder-owned pricing tables.

What happens when a new cost source appears?

Run the validation flow again and add the new source to the checklist before production rollout.

Related reading