Skip to main content
Pylva supports TypeScript and Python agent runtimes. TypeScript auto-instruments OpenAI, Anthropic, and Vercel AI. Python auto-instruments OpenAI and Anthropic. LangGraph and LangChain use the callback path. Custom tools, non-LLM usage, and unsupported provider paths use reportUsage or report_usage.

Integration matrix

StackPackage or entrypointCapture path
TypeScript OpenAI@pylva/sdkAuto-instrumentation
TypeScript Anthropic@pylva/sdkAuto-instrumentation
TypeScript Vercel AI@pylva/sdkAuto-instrumentation
Python OpenAIpylva-sdk, import pylvaAuto-instrumentation
Python Anthropicpylva-sdk, import pylvaAuto-instrumentation
LangGraph or LangChainPylvaCallbackHandlerCallback instrumentation
Non-LLM toolsreportUsage or report_usageManual usage reporting
Unsupported provider pathreportUsage, report_usage, or custom integrationManual usage reporting

What Pylva captures

Pylva captures cost-shaped metadata:
  • Provider and model.
  • Token counts when the provider or framework exposes them.
  • Latency and status.
  • customer_id and step_name.
  • Metric and metric value for non-LLM usage.
Pylva does not need prompts, completions, raw messages, tool inputs, tool outputs, emails, API keys, or raw tool arguments.

Which path should I use?

Use auto-instrumentation when your runtime calls a supported provider client directly. Use the callback path when LangGraph or LangChain owns the model call. Use reportUsage or report_usage when the cost comes from a custom tool, non-LLM service, or unsupported provider path.

Avoid double counting

Use one capture path for the same model call.
  • Do not use provider auto-instrumentation and a framework callback for the same call.
  • Do not manually report a provider call that the SDK already captures.
  • Manually report only usage that is not already captured.
If you are not sure whether a source is covered, see Cost Source Discovery.