Documentation Index
Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Applies to:
- Plan -
- Deployment -
Summary
If you don’t logmetrics.estimated_cost directly on a span, Braintrust falls back to the model registry to estimate cost from token metrics and registered pricing. Custom LLM models need to be registered in Braintrust’s model registry with pricing information for this fallback to produce a cost. Spans that log metrics.estimated_cost explicitly use that value as-is in the trace viewer and in the estimated_cost() SQL function.
Configuration Steps
Step 1: Register your custom model
Navigate to Configuration > AI providers > Custom providers and add your model with pricing information.Step 2: Set pricing information
Configure the following costs for your custom model:- Input cost per million tokens
- Output cost per million tokens
- Cache read/write costs (if using prompt caching)
Step 3: Update span metadata
Ensure your logged spans includemetadata.model matching the exact registered model name.
Step 4: Query costs across projects
Use SQL to aggregate costs across multiple projects:estimated_cost_component(name) to extract a single cost component, or estimated_cost_breakdown() to return all components as a JSON object. See SQL functions for the available component names.