# estimate_cost

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/cost_tracking/estimate_cost)

Estimate one model request's total cost in USD.

Preserves the established public interface while the private structured
estimate powers checkpointed debugger detail.

## Signature

```python
estimate_cost(
    usage_metadata: Mapping[str, Any] | None,
    model_name: str,
    provider: str = '',
) -> float | None
```

## Returns

`float | None`

Estimated total cost, or `None` when unavailable.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/e4c1ffe9ee63d7854147de490ca27495ef157a7b/libs/code/deepagents_code/cost_tracking.py#L1955)