venice_ai.core.config.main
Root configuration model for the Venice AI SDK.
Core configs (HttpClientConfig, VeniceAIConfig) are required for basic SDK
operation. Enterprise configs (BackendConfig, StateConfig, SchedulerConfig,
etc.) are optional and only needed for advanced deployments.
Quick start:
from venice_ai.core.config import create_minimal_config
cfg = create_minimal_config(api_key="your-key")
Environment variables use the ``VENICE_`` prefix with ``__`` as the nested delimiter.
VeniceAIConfig Objects
class VeniceAIConfig(BaseSettings)
Root configuration model for the Venice AI SDK.
Quick start:
cfg = VeniceAIConfig(api_key="your-key")
Environment variables use the ``VENICE_`` prefix (e.g. ``VENICE_API_KEY``).
Core fields: ``api_key``, ``api_base_url``, ``debug``, ``http_client``.
Enterprise fields: ``backend``, ``scheduler``, ``state``, ``circuit_breaker``,
``rate_limiter``, ``metrics``.
VeniceAIConfig.model_post_init
def model_post_init(__context: Any) -> None
Warn when pydantic-settings is not installed, and detect Redis/backend mismatches.
Without pydantic-settings, VeniceAIConfig inherits from BaseModel instead of BaseSettings, which means VENICE_* environment variables (including VENICE_API_KEY) are silently ignored.
VeniceAIConfig.validate_environment
@field_validator("environment")
@classmethod
def validate_environment(cls, v: str) -> str
Validate environment setting.
VeniceAIConfig.validate_api_base_url
@field_validator("api_base_url")
@classmethod
def validate_api_base_url(cls, v: str) -> str
Validate API base URL format.
VeniceAIConfig.to_dict
def to_dict() -> dict[str, Any]
Convert configuration to dictionary format.
VeniceAIConfig.get_redis_url
def get_redis_url() -> str
Get the effective Redis URL for the configuration.
VeniceAIConfig.is_test_environment
def is_test_environment() -> bool
Check if running in test environment.
VeniceAIConfig.is_debug_enabled
def is_debug_enabled() -> bool
Check if debug mode is enabled.
VeniceAIConfig.create_test_config
@classmethod
def create_test_config(cls,
scheduler_mode: SchedulerMode = SchedulerMode.BASIC,
enable_redis: bool = True,
test_rate_multiplier: float = 10.0) -> "VeniceAIConfig"
Create a configuration optimized for testing.
Arguments:
scheduler_mode- Scheduler mode to use. Defaults toBASICso that callers without a tier-discovery setup get a working test client out of the box. PassSchedulerMode.INTELLIGENTexplicitly when exercising tier-aware scheduling paths in the fixture.enable_redis- Whether to enable Redis backendtest_rate_multiplier- Rate limit multiplier for faster testing
Returns:
VeniceAIConfig instance optimized for testing
VeniceAIConfig.create_minimal_config
@classmethod
def create_minimal_config(cls,
api_key: str | None = None,
**kwargs: Any) -> "VeniceAIConfig"
Create a minimal configuration for basic SDK usage.
Only an API key is required. All enterprise features (scheduler, state management, account tracking, Redis backend) are disabled by default so users are not surprised by unexpected dependencies or background tasks.
Arguments:
api_key- Venice AI API key (can also be provided via VENICE_API_KEY env-var).**kwargs- Any additionalVeniceAIConfigfield overrides.
Returns:
VeniceAIConfig instance with sensible minimal defaults.
Example:
from venice_ai.core.config import create_minimal_config
cfg = create_minimal_config(api_key="your-key")
create_minimal_config
def create_minimal_config(api_key: str | None = None,
**kwargs: Any) -> VeniceAIConfig
Create a minimal :class:VeniceAIConfig for basic SDK usage.
Delegates to :meth:VeniceAIConfig.create_minimal_config.
Arguments:
api_key- Venice AI API key (can also be set viaVENICE_API_KEYenv-var).**kwargs- AdditionalVeniceAIConfigfield overrides.
Returns:
:class:VeniceAIConfig with sensible minimal defaults.
Example:
from venice_ai.core.config import create_minimal_config
cfg = create_minimal_config(api_key="your-key")