Model Pricing
- openwebui_token_tracking.model_pricing.get_model_pricing(database_url, model_id=None, provider=None)[source]
Retrieve specific model pricing entries from the database
- openwebui_token_tracking.model_pricing.list_model_pricing(database_url, provider=None)[source]
Retrieve model pricing entries from the database, optionally filtered by provider
- Parameters:
database_url (str) –
A database URL in SQLAlchemy format
provider (str, optional) – Optional provider name to filter results
- Returns:
List of dictionaries containing model pricing information
- Return type:
- openwebui_token_tracking.model_pricing.add_model_pricing(database_url, model_pricing)[source]
Add model pricing to the database
- Parameters:
database_url (str) –
A database URL in SQLAlchemy format
models (list[ModelPricing], optional) – A list of model pricing descriptions.
model_pricing (list[ModelPricingSchema])
- openwebui_token_tracking.model_pricing.update_model_pricing(database_url, model_id, provider, updates)[source]
Update pricing information for a specific model
- Parameters:
database_url (str) –
A database URL in SQLAlchemy format
model_id (str) – Model ID to update
provider (str) – Provider name of the model
updates (dict) – Dictionary containing the fields to update and their new values
- Returns:
True if update was successful, False if model not found
- Return type:
- openwebui_token_tracking.model_pricing.upsert_model_pricing(database_url, provider, model_id, name, input_cost_credits, per_input_tokens, output_cost_credits, per_output_tokens)[source]
Create or update pricing information for a specific model
- Parameters:
database_url (str) –
A database URL in SQLAlchemy format
provider (str) – Provider name of the model
model_id (str) – Model ID
name (str) – Model name
input_cost_credits (int) – Input cost in credits
per_input_tokens (int) – Number of input tokens per credit
output_cost_credits (int) – Output cost in credits
per_output_tokens (int) – Number of output tokens per credit
- Returns:
True if operation was successful
- Return type:
- openwebui_token_tracking.model_pricing.delete_model_pricing(database_url, model_id, provider=None)[source]
Delete pricing information for a specific model
- Parameters:
database_url (str) –
A database URL in SQLAlchemy format
model_id (str) – Model ID to delete
provider (str, optional) – Provider name of the model
- Returns:
True if deletion was successful, False if model not found
- Return type: