Skip to content

ccproxy.plugins.max_tokens.config

ccproxy.plugins.max_tokens.config

Configuration for max_tokens plugin.

MaxTokensConfig

Bases: BaseModel

Configuration for the max_tokens plugin.

validate_config classmethod

validate_config(data)

Validate configuration values.

Source code in ccproxy/plugins/max_tokens/config.py
@model_validator(mode="before")
@classmethod
def validate_config(cls, data: dict[str, Any]) -> dict[str, Any]:
    """Validate configuration values."""
    # Ensure target_providers is a list
    if isinstance(data.get("target_providers"), str):
        data["target_providers"] = [data["target_providers"]]
    return data

should_process_provider

should_process_provider(provider)

Check if plugin should process requests for given provider.

Source code in ccproxy/plugins/max_tokens/config.py
def should_process_provider(self, provider: str) -> bool:
    """Check if plugin should process requests for given provider."""
    if self.apply_to_all_providers:
        return True
    return provider in self.target_providers

get_modification_reason

get_modification_reason(reason_type)

Get modification reason text for given reason type.

Source code in ccproxy/plugins/max_tokens/config.py
def get_modification_reason(self, reason_type: str) -> str:
    """Get modification reason text for given reason type."""
    return self.modification_reasons.get(
        reason_type, f"Unknown reason: {reason_type}"
    )