log_costs
Log what your agent's model and tool calls cost, then get the running total for the run and for today. Pass events (one per call, up to 500) or an OpenTelemetry OTLP/JSON trace export as otel (gen_ai.usage.input_tokens / output_tokens / gen_ai.request.model are read; trace id becomes run_id). Give cost_usd per call, or tokens plus your own per-million prices; nothing is guessed. Optional caps: run_cap_usd and daily_cap_usd. Free watch-only returns would_alert when a cap is crossed; Pro posts one alert per day to alert_webhook. Never blocks or changes your agent.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| otel | No | OTLP/JSON export: { resourceSpans: [...] }. | |
| events | No | ||
| run_id | No | Stable id for this run (default "default"). | |
| run_cap_usd | No | ||
| alert_webhook | No | https URL Pro posts the cap alert to. | |
| daily_cap_usd | No | ||
| price_in_per_m | No | Default input USD per 1M tokens for events without cost_usd. | |
| price_out_per_m | No | Default output USD per 1M tokens. |