17 lines
722 B
Python
17 lines
722 B
Python
from pydantic import BaseModel, Field
|
|
|
|
|
|
class TokenUsageConfig(BaseModel):
|
|
"""Configuration for token usage tracking."""
|
|
|
|
enabled: bool = Field(default=False, description="Enable token usage tracking middleware")
|
|
report_enabled: bool = Field(default=False, description="Enable reporting of token usage to external billing API")
|
|
report_url: str | None = Field(
|
|
default=None,
|
|
description="HTTP(S) endpoint to POST token billing requests to. If unset, external billing reporting is disabled.",
|
|
)
|
|
report_headers: dict[str, str] = Field(
|
|
default_factory=dict,
|
|
description="Extra HTTP headers included in each billing request (e.g. Authorization: Bearer <token>).",
|
|
)
|