OpenAI Agents SDK cost tracking

Price every model response in an OpenAI Agents SDK run, including tool loops and handoffs, and see each agent run's total cost.

By Keyveve, Inc. · Updated 2026-10-23

A trace processor records every model response inside an agent run: tool-calling loops, handoffs between agents and guardrail calls. Each agent run becomes a run in Veqen, so you see what one run cost from start to finish.

Install

pip install veqen openai-agents

Add the processor

import veqen
from agents import Runner, add_trace_processor
from veqen.integrations.openai_agents import VeqenTracingProcessor

veqen.init()  # reads VEQEN_API_KEY, an ingest key
add_trace_processor(VeqenTracingProcessor(feature="support-agent"))

with veqen.tags(customer=org.id):
    result = await Runner.run(agent, question)

Runs

Each call is tagged with the agent run's trace id, so Agent runs shows each run's total cost and every call in it. Tag run yourself (for example a conversation id) to group several agent runs into one.

What it reads

The usage on each response span (Responses API) and generation span (Chat Completions), with cached input kept apart. Spans without usage are skipped.

Next

  • Tags: runs, customers and features.
  • OpenTelemetry: if you already export the SDK's traces elsewhere.

Veqen records what every AI request cost and who it was for, checks it against your provider bills and prepares the entries for your accounting system. Start free or read the quickstart.