LLM pricing via litellm’s pricing API. Pricing metrics require the litellm package (Documentation Index
Fetch the complete documentation index at: https://docs.mellea.ai/llms.txt
Use this file to discover all available pages before exploring further.
mellea[litellm]). Pricing is
auto-enabled when litellm is installed and can be explicitly controlled via the
MELLEA_PRICING_ENABLED environment variable.
MELLEA_PRICING_ENABLED tri-state:
"true"+ litellm installed → enabled"true"+ litellm absent → warning, disabled"false"(any) → disabled (silent)- unset + litellm installed → enabled (auto)
- unset + litellm absent → disabled (silent)
MELLEA_METRICS_ENABLED is also set.
Custom pricing:
Set MELLEA_PRICING_FILE to a JSON file using litellm’s native per-token
schema. Minimal entries with only cost fields are supported::
{
“my-model”: {
“input_cost_per_token”: 0.000003,
“output_cost_per_token”: 0.000015
}
}
Optional cache fields: cache_read_input_token_cost,
cache_creation_input_token_cost.
Environment variables:
- MELLEA_PRICING_ENABLED: Tri-state pricing flag (true/false/unset).
- MELLEA_PRICING_FILE: Path to a JSON file with custom model pricing.
Functions
FUNC compute_cost
model: Model identifier (e.g."gpt-5.4","claude-sonnet-4-6").provider: Provider name from the backend (e.g."openai","watsonx"). Passed to litellm ascustom_llm_providerto aid model resolution — e.g."watsonx"causes litellm to trywatsonx/ibm/granite-4-h-small.prompt_tokens: Total prompt tokens including any cached tokens, orNone.completion_tokens: Number of completion tokens, orNone.cached_tokens: Tokens served from prompt cache, orNone.cache_creation_tokens: Tokens written to prompt cache, orNone.
- Estimated cost in USD, or
Noneif pricing is disabled or no pricing - data exists for the model.
FUNC is_pricing_enabled
- True if litellm is available and pricing is not explicitly disabled.