Skip to main content
Applies to:
  • Plan -
  • Deployment -

Summary

Issue: The Estimated cost column in the Logs table shows for all rows, even though the trace metrics panel displays a cost value correctly. Cause: The Logs table reads metrics.estimated_cost from the root span, which only populates when custom AI providers are registered at the organization level. Providers configured at the project level only are not used during root span cost rollup. Resolution: Re-register your custom AI providers at the organization level under Settings > AI providers.

Resolution steps

If you are using custom AI providers

Step 1: Confirm provider scope

Check where your custom providers are currently configured.
  1. Go to Settings > AI providers.
  2. Note whether providers are listed at the project level only.
If they are project-level only, proceed to Step 2.

Step 2: Add providers at the organization level

  1. Go to Settings > AI providers at the organization level.
  2. Re-add each custom provider with the same input and output cost values.
  3. Verify the model names match exactly what is logged in metadata.model.

Step 3: Verify the fix

Reload the Logs table. The Estimated cost column should now populate for new and existing traces where token metrics are present.

If providers are already at the org level

Step 1: Confirm root span token metrics

Run the following query to check whether the root span has metrics.estimated_cost populated:
SELECT
  id,
  root_span_id,
  metrics.estimated_cost,
  estimated_cost() AS cost_fn,
  metrics.prompt_tokens,
  metrics.completion_tokens,
  metadata.model,
  span_attributes.type
FROM project_logs('<YOUR_PROJECT_ID>', shape => 'summary')
WHERE root_span_id = '<YOUR_TRACE_ID>'
LIMIT 5
If metrics.estimated_cost is null but cost_fn returns a value, the root span rollup is not propagating from child spans.

Step 2: Check child LLM span costs

SELECT
  root_span_id,
  metadata.model,
  SUM(estimated_cost()) AS total_cost,
  SUM(metrics.prompt_tokens) AS prompt_tokens,
  SUM(metrics.completion_tokens) AS completion_tokens,
  COUNT(1) AS spans
FROM project_logs('<YOUR_PROJECT_ID>')
WHERE root_span_id = '<YOUR_TRACE_ID>'
  AND span_attributes.type = 'llm'
GROUP BY 1, 2
If child spans return cost but the root does not, contact Braintrust support with the project ID, root span IDs, and query results.

Step 3: Use a custom column as a workaround

While investigating, add a custom column using the estimated_cost() SQL function, which falls back to per-span token pricing when metrics.estimated_cost is null.