Commit ae1fb479 authored by Your Name's avatar Your Name

feat: add subscription-based provider and custom pricing configuration

- Added is_subscription, price_per_million_prompt, and price_per_million_completion fields to Provider model
- Updated analytics to check provider config for subscription status and custom pricing
- Subscription providers have $0 cost but usage is still tracked
- Added _get_provider_pricing() method to get provider-specific pricing
- Updated provider configuration UI with pricing section:
  - Checkbox for subscription-based provider (free)
  - Input fields for custom prompt/completion token pricing
  - Pricing fields hidden when subscription is checked
- Falls back to default pricing if not configured
- Allows admins and users to configure per-provider pricing
parent 4fc0240b
This diff is collapsed.
......@@ -83,6 +83,11 @@ class Provider(BaseModel):
endpoint: str
api_key_required: bool
models: List[Model] = []
# Pricing configuration
is_subscription: bool = False # If True, pricing is 0 (subscription-based provider)
price_per_million_prompt: Optional[float] = None # Price per million prompt tokens (USD)
price_per_million_completion: Optional[float] = None # Price per million completion tokens (USD)
class ErrorTracking(BaseModel):
failures: int
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment