veylox 0.1.0__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.
veylox/__init__.py ADDED
@@ -0,0 +1,102 @@
1
+ """veylox: one key, every model.
2
+
3
+ Pass in any supported LLM API key. veylox works out which provider it belongs to
4
+ and gives you a client for every model behind it::
5
+
6
+ import veylox
7
+
8
+ client = veylox.connect("sk-ant-...")
9
+ client.provider # "anthropic"
10
+ print(client.chat("Hello!", model="claude-sonnet-4-5"))
11
+
12
+ Supported providers: OpenAI, Anthropic, Google Gemini, Groq, Mistral, OpenRouter.
13
+ """
14
+ from __future__ import annotations
15
+
16
+ from typing import Optional, Union
17
+
18
+ import httpx
19
+
20
+ from ._version import __version__
21
+ from .client import DEFAULT_TIMEOUT, Client
22
+ from .detect import detect_provider
23
+ from .errors import (
24
+ AuthenticationError,
25
+ InvalidRequestError,
26
+ ModelNotFoundError,
27
+ PermissionDeniedError,
28
+ ProviderError,
29
+ RateLimitError,
30
+ UnknownKeyError,
31
+ VeyloxError,
32
+ )
33
+ from .registry import supported_providers
34
+ from .types import ChatResponse, Messages, ProviderInfo, StreamChunk, Usage
35
+
36
+ __all__ = [
37
+ "__version__",
38
+ "connect",
39
+ "Client",
40
+ "detect_provider",
41
+ "supported_providers",
42
+ # data types
43
+ "ChatResponse",
44
+ "StreamChunk",
45
+ "Usage",
46
+ "ProviderInfo",
47
+ "Messages",
48
+ # errors
49
+ "VeyloxError",
50
+ "UnknownKeyError",
51
+ "InvalidRequestError",
52
+ "AuthenticationError",
53
+ "PermissionDeniedError",
54
+ "ModelNotFoundError",
55
+ "RateLimitError",
56
+ "ProviderError",
57
+ ]
58
+
59
+
60
+ def connect(
61
+ api_key: str,
62
+ *,
63
+ provider: Optional[str] = None,
64
+ verify: bool = False,
65
+ base_url: Optional[str] = None,
66
+ timeout: Union[float, httpx.Timeout, None] = DEFAULT_TIMEOUT,
67
+ ) -> Client:
68
+ """Connect with any supported API key and get a client for its provider's models.
69
+
70
+ Examples:
71
+ >>> client = veylox.connect("gsk_...")
72
+ >>> client.provider
73
+ 'groq'
74
+
75
+ Args:
76
+ api_key: An API key from OpenAI, Anthropic, Google Gemini, Groq, Mistral
77
+ or OpenRouter.
78
+ provider: Skip auto-detection and use this provider. Use it for keys whose
79
+ format veylox doesn't recognise.
80
+ verify: If ``True``, make one free call (listing models) to confirm the key
81
+ works before returning. Off by default, so connecting never touches the network.
82
+ base_url: Send requests to a different address, such as a proxy or gateway
83
+ that speaks the provider's API.
84
+ timeout: Seconds to wait for a provider before giving up (default 60).
85
+ ``None`` means no limit; an ``httpx.Timeout`` sets separate connect/read limits.
86
+
87
+ Returns:
88
+ A :class:`Client`. Check ``client.provider`` to see which provider the key belongs to.
89
+
90
+ Raises:
91
+ UnknownKeyError: The key's provider couldn't be detected (pass ``provider=``).
92
+ AuthenticationError: ``verify=True`` and the provider rejected the key.
93
+ """
94
+ client = Client(api_key, provider=provider, base_url=base_url, timeout=timeout)
95
+ if verify:
96
+ try:
97
+ client.verify()
98
+ except BaseException:
99
+ # The caller never receives this client, so close its connection here.
100
+ client.close()
101
+ raise
102
+ return client
veylox/_version.py ADDED
@@ -0,0 +1,3 @@
1
+ """The single place the package version is defined (read by the build too)."""
2
+
3
+ __version__ = "0.1.0"