mirascope.core.costs.calculate_cost
Cost calculation utilities for LLM API calls.
Function calculate_cost
Calculate the cost for an LLM API call.
This function routes to the appropriate provider-specific cost calculation function, preserving existing behavior while providing a unified interface.
Parameters
Name | Type | Description |
---|---|---|
provider | Provider | The LLM provider (e.g., "openai", "anthropic") |
model | str | The model name (e.g., "gpt-4", "claude-3-opus") |
metadata= None | CostMetadata | None | Additional metadata required for cost calculation |