ccproxy.config¶
ccproxy.config
¶
Configuration module for Claude Proxy API Server.
HTTPSettings
¶
Bases: BaseModel
HTTP client configuration settings.
Controls how the core HTTP client handles compression and other HTTP-level settings.
LoggingSettings
¶
Bases: BaseModel
Centralized logging configuration - core app only.
validate_log_level
classmethod
¶
Validate and normalize log level.
Source code in ccproxy/config/core.py
validate_log_format
classmethod
¶
Validate and normalize log format.
Source code in ccproxy/config/core.py
Settings
¶
Bases: BaseSettings
Configuration settings for the Claude Proxy API Server.
Settings are loaded from environment variables, .env files, and TOML configuration files. Environment variables take precedence over .env file values. TOML configuration files are loaded in the following order: 1. .ccproxy.toml in current directory 2. ccproxy.toml in git repository root 3. config.toml in XDG_CONFIG_HOME/ccproxy/
model_dump_safe
¶
load_toml_config
classmethod
¶
Load configuration from a TOML file.
Source code in ccproxy/config/settings.py
load_config_file
classmethod
¶
Load configuration from a file based on its extension.
Source code in ccproxy/config/settings.py
from_toml
classmethod
¶
Create Settings instance from TOML configuration.
from_config
classmethod
¶
Create Settings instance from configuration file with env precedence and safe merging.
Source code in ccproxy/config/settings.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | |
validate_config_dict
¶
Validate configuration dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any]
|
Configuration dictionary to validate |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The validated configuration dictionary |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If configuration is invalid |
Source code in ccproxy/config/utils.py
validate_cors_origins
¶
Validate CORS origins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origins
|
list[str]
|
List of origin URLs to validate |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The validated list of origins |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If any origin is invalid |
Source code in ccproxy/config/utils.py
validate_host
¶
Validate host address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
Host address to validate |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated host address |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If host is invalid |
Source code in ccproxy/config/utils.py
validate_log_level
¶
Validate log level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
str
|
Log level to validate |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated log level |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If log level is invalid |
Source code in ccproxy/config/utils.py
validate_path
¶
Validate file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to validate |
required |
Returns:
| Type | Description |
|---|---|
Path
|
The validated Path object |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If path is invalid |
Source code in ccproxy/config/utils.py
validate_port
¶
Validate port number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
int | str
|
Port number to validate |
required |
Returns:
| Type | Description |
|---|---|
int
|
The validated port number |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If port is invalid |
Source code in ccproxy/config/utils.py
validate_timeout
¶
Validate timeout value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
int | float
|
Timeout value to validate |
required |
Returns:
| Type | Description |
|---|---|
int | float
|
The validated timeout value |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If timeout is invalid |
Source code in ccproxy/config/utils.py
validate_url
¶
Validate URL format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL to validate |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated URL |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If URL is invalid |