Skip to main content
Applies to:


Summary

Custom LLM models require registration in Braintrust’s model registry with pricing information to display cost estimates in the monitoring dashboard. The dashboard calculates costs from token metrics and registered model pricing rather than using custom estimated_cost values directly.

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 include metadata.model matching the exact registered model name.
braintrust.log(
    metadata={"model": "your-custom-model-name"},
    # other span data
)

Step 4: Query costs across projects

Use BTQL to aggregate costs across multiple projects:
SELECT
    metadata.model,
    day(created) as date,
    avg(metrics.estimated_cost) as avg_cost,
    sum(metrics.estimated_cost) as total_cost
FROM project_logs('project-id-1', 'project-id-2', shape => 'summary')
WHERE created > now() - interval 7 days
GROUP BY metadata.model, date

Save this query as a custom view for reuse across your organization.