Skip to content

ccproxy.config.pricing

ccproxy.config.pricing

Pricing configuration settings.

PricingSettings

Bases: BaseSettings

Configuration settings for the pricing system.

Controls pricing cache behavior, data sources, and update mechanisms. Settings can be configured via environment variables with PRICING__ prefix.

validate_cache_dir classmethod

validate_cache_dir(v)

Validate and convert cache directory path.

Source code in ccproxy/config/pricing.py
@field_validator("cache_dir", mode="before")
@classmethod
def validate_cache_dir(cls, v: str | Path | None) -> Path:
    """Validate and convert cache directory path."""
    if v is None:
        return get_xdg_cache_home() / "ccproxy"
    if isinstance(v, str):
        if v.startswith("~/"):
            return Path(v).expanduser()
        return Path(v)
    return v

validate_source_url classmethod

validate_source_url(v)

Validate source URL format.

Source code in ccproxy/config/pricing.py
@field_validator("source_url")
@classmethod
def validate_source_url(cls, v: str) -> str:
    """Validate source URL format."""
    if not v.startswith(("http://", "https://")):
        raise ValueError("Source URL must start with http:// or https://")
    return v