keycycle 0.3.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- keycycle/__init__.py +48 -0
- keycycle/adapters/__init__.py +22 -0
- keycycle/adapters/generic_adapter.py +663 -0
- keycycle/adapters/openai_adapter.py +381 -0
- keycycle/config/__init__.py +25 -0
- keycycle/config/constants.py +35 -0
- keycycle/config/dataclasses.py +225 -0
- keycycle/config/enums.py +5 -0
- keycycle/config/loader.py +54 -0
- keycycle/config/log_config.py +53 -0
- keycycle/config/models/cerebras.yaml +36 -0
- keycycle/config/models/cohere.yaml +14 -0
- keycycle/config/models/gemini.yaml +69 -0
- keycycle/config/models/groq.yaml +161 -0
- keycycle/config/models/mistral.yaml +13 -0
- keycycle/config/models/moonshot.yaml +59 -0
- keycycle/config/models/openrouter.yaml +4 -0
- keycycle/config/models/openrouter_models.yaml +97 -0
- keycycle/config/models.py +53 -0
- keycycle/core/__init__.py +40 -0
- keycycle/core/backoff.py +79 -0
- keycycle/core/exceptions.py +94 -0
- keycycle/core/utils.py +480 -0
- keycycle/key_rotation/__init__.py +7 -0
- keycycle/key_rotation/rotating_mixin.py +392 -0
- keycycle/key_rotation/rotation_manager.py +231 -0
- keycycle/legacy_multi_provider_wrapper.py +734 -0
- keycycle/multi_client_wrapper.py +372 -0
- keycycle/py.typed +0 -0
- keycycle/usage/__init__.py +6 -0
- keycycle/usage/db_logic.py +98 -0
- keycycle/usage/usage_logger.py +89 -0
- keycycle/utils.py +27 -0
- keycycle-0.3.2.dist-info/METADATA +44 -0
- keycycle-0.3.2.dist-info/RECORD +37 -0
- keycycle-0.3.2.dist-info/WHEEL +5 -0
- keycycle-0.3.2.dist-info/top_level.txt +1 -0
keycycle/__init__.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from .legacy_multi_provider_wrapper import MultiProviderWrapper
|
|
2
|
+
from .multi_client_wrapper import MultiClientWrapper, ProviderEnvConfig
|
|
3
|
+
from .key_rotation.rotation_manager import RotatingKeyManager
|
|
4
|
+
from .config.dataclasses import RateLimits, KeyLimitOverride
|
|
5
|
+
from .core.utils import KeyEntry
|
|
6
|
+
from .core.exceptions import (
|
|
7
|
+
KeycycleError,
|
|
8
|
+
NoAvailableKeyError,
|
|
9
|
+
KeyNotFoundError,
|
|
10
|
+
InvalidKeyError,
|
|
11
|
+
RateLimitError,
|
|
12
|
+
ConfigurationError,
|
|
13
|
+
)
|
|
14
|
+
from .adapters.generic_adapter import (
|
|
15
|
+
create_rotating_client,
|
|
16
|
+
detect_async_client,
|
|
17
|
+
get_valid_constructor_kwargs,
|
|
18
|
+
GenericClientConfig,
|
|
19
|
+
SyncGenericRotatingClient,
|
|
20
|
+
AsyncGenericRotatingClient,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
# New primary wrapper (multi-provider support)
|
|
25
|
+
"MultiClientWrapper",
|
|
26
|
+
"ProviderEnvConfig",
|
|
27
|
+
# Legacy wrapper (single provider, backward compatible)
|
|
28
|
+
"MultiProviderWrapper",
|
|
29
|
+
# Main classes
|
|
30
|
+
"RateLimits",
|
|
31
|
+
"KeyLimitOverride",
|
|
32
|
+
"KeyEntry",
|
|
33
|
+
"RotatingKeyManager",
|
|
34
|
+
# Generic rotating client
|
|
35
|
+
"create_rotating_client",
|
|
36
|
+
"detect_async_client",
|
|
37
|
+
"get_valid_constructor_kwargs",
|
|
38
|
+
"GenericClientConfig",
|
|
39
|
+
"SyncGenericRotatingClient",
|
|
40
|
+
"AsyncGenericRotatingClient",
|
|
41
|
+
# Exceptions
|
|
42
|
+
"KeycycleError",
|
|
43
|
+
"NoAvailableKeyError",
|
|
44
|
+
"KeyNotFoundError",
|
|
45
|
+
"InvalidKeyError",
|
|
46
|
+
"RateLimitError",
|
|
47
|
+
"ConfigurationError",
|
|
48
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from .generic_adapter import (
|
|
2
|
+
create_rotating_client,
|
|
3
|
+
detect_async_client,
|
|
4
|
+
default_usage_extractor,
|
|
5
|
+
GenericClientConfig,
|
|
6
|
+
SyncGenericRotatingClient,
|
|
7
|
+
AsyncGenericRotatingClient,
|
|
8
|
+
SyncGenericProxyHelper,
|
|
9
|
+
AsyncGenericProxyHelper,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
# Generic adapter
|
|
14
|
+
"create_rotating_client",
|
|
15
|
+
"detect_async_client",
|
|
16
|
+
"default_usage_extractor",
|
|
17
|
+
"GenericClientConfig",
|
|
18
|
+
"SyncGenericRotatingClient",
|
|
19
|
+
"AsyncGenericRotatingClient",
|
|
20
|
+
"SyncGenericProxyHelper",
|
|
21
|
+
"AsyncGenericProxyHelper",
|
|
22
|
+
]
|