omniai-kit 1.0.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.
@@ -0,0 +1,270 @@
1
+ Metadata-Version: 2.4
2
+ Name: omniai-kit
3
+ Version: 1.0.0
4
+ Summary: Official Python client SDK for OmniAI Gateway and Dynamic Multi-Provider LLM Router
5
+ Author-email: OmniAI Team <dev@omniai.ai>, Jayed Bin Jahangir <jayedbinjahangir@gmail.com>
6
+ Maintainer-email: Jayed Bin Jahangir <jayedbinjahangir@gmail.com>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://omniai.go-agents.app
9
+ Project-URL: Documentation, https://omniai.go-agents.app/docs
10
+ Project-URL: Repository, https://github.com/jayeeed/omniai-sdk
11
+ Project-URL: Issues, https://github.com/jayeeed/omniai-sdk/issues
12
+ Project-URL: Changelog, https://github.com/jayeeed/omniai-sdk/blob/main/CHANGELOG.md
13
+ Keywords: omniai,llm,ai,gateway,router,openai,gemini,anthropic,vllm,livekit,sdk
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: httpx>=0.27.0
30
+ Requires-Dist: pydantic>=2.0.0
31
+ Provides-Extra: all
32
+ Requires-Dist: openai>=1.0.0; extra == "all"
33
+ Requires-Dist: google-genai>=0.1.0; extra == "all"
34
+ Requires-Dist: anthropic>=0.20.0; extra == "all"
35
+ Provides-Extra: openai
36
+ Requires-Dist: openai>=1.0.0; extra == "openai"
37
+ Provides-Extra: gemini
38
+ Requires-Dist: google-genai>=0.1.0; extra == "gemini"
39
+ Provides-Extra: anthropic
40
+ Requires-Dist: anthropic>=0.20.0; extra == "anthropic"
41
+ Provides-Extra: vllm
42
+ Requires-Dist: openai>=1.0.0; extra == "vllm"
43
+ Provides-Extra: dev
44
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
45
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
46
+ Requires-Dist: build>=1.0.0; extra == "dev"
47
+ Requires-Dist: twine>=5.0.0; extra == "dev"
48
+ Dynamic: license-file
49
+
50
+ # OmniAI Python Client SDK (`omniai`)
51
+
52
+ [![PyPI version](https://img.shields.io/pypi/v/omniai.svg)](https://pypi.org/project/omniai/)
53
+ [![Python versions](https://img.shields.io/pypi/pyversions/omniai.svg)](https://pypi.org/project/omniai/)
54
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
55
+ [![Type Checked: PEP 561](https://img.shields.io/badge/typing-PEP%20561-blue.svg)](https://peps.python.org/pep-0561/)
56
+
57
+ Official, production-ready Python client SDK for the **OmniAI AI Gateway** and **Dynamic Multi-Provider LLM Router**.
58
+
59
+ ---
60
+
61
+ ## 🏛️ Supported Providers
62
+
63
+ The OmniAI SDK is strictly engineered and validated for the following **4 model providers**:
64
+
65
+ | Provider | Identifier Schema | Description & Examples |
66
+ | :--- | :--- | :--- |
67
+ | **OpenAI** | `openai:<model>` | Standard and reasoning models (`openai:gpt-4o`, `openai:o3-mini`) |
68
+ | **Google Gemini** | `gemini:<model>` | Google AI Multimodal models (`gemini:gemini-2.5-flash`, `gemini:gemini-3.7-flash`) |
69
+ | **Anthropic** | `anthropic:<model>` | Claude reasoning & coding models (`anthropic:claude-3-5-sonnet`, `anthropic:claude-3-opus`) |
70
+ | **vLLM (Self-Hosted)** | `vllm:<model>` | High-throughput self-hosted inference servers (`vllm:meta-llama/Llama-3.1-8B-Instruct`) |
71
+
72
+ ---
73
+
74
+ ## 📦 Installation
75
+
76
+ Install the lightweight client from PyPI:
77
+
78
+ ```bash
79
+ pip install omniai
80
+ ```
81
+
82
+ ### Optional Provider Dependencies (for direct local routing)
83
+ If you wish to use the standalone `RouterEngine` directly within your Python process without an external gateway:
84
+
85
+ ```bash
86
+ pip install "omniai[all]" # Installs all provider SDKs (openai, google-genai)
87
+ pip install "omniai[openai]" # Installs openai
88
+ pip install "omniai[gemini]" # Installs google-genai
89
+ ```
90
+
91
+ ---
92
+
93
+ ## 🚀 Quickstart
94
+
95
+ ### 1. Synchronous Client (`OmniaiClient`)
96
+
97
+ ```python
98
+ from omniai import OmniaiClient
99
+
100
+ # Automatically defaults base_url="https://omniai.go-agents.app"
101
+ # and auto-loads OMNI_API_KEY from your .env file
102
+ client = OmniaiClient()
103
+
104
+ # Or pass parameters explicitly:
105
+ # client = OmniaiClient(api_key="your-api-key")
106
+
107
+ # Call flagship model openai:gpt-5.6-luna
108
+ response = client.chat(
109
+ model="openai:gpt-5.6-luna",
110
+ prompt="Explain quantum entanglement in 2 sentences.",
111
+ temperature=0.7,
112
+ )
113
+ print(response)
114
+ ```
115
+
116
+ ### 2. Real-Time Token Streaming
117
+
118
+ The SDK features a resilient Server-Sent Events (SSE) streaming engine with automatic frame filtering and clean termination:
119
+
120
+ ```python
121
+ from omniai import OmniaiClient
122
+
123
+ client = OmniaiClient()
124
+
125
+ for token in client.stream(
126
+ model="openai:gpt-5.6-luna",
127
+ prompt="Write a haiku about high-availability microservices.",
128
+ ):
129
+ print(token, end="", flush=True)
130
+ ```
131
+
132
+ ### 3. Strongly-Typed Structured Outputs with Pydantic
133
+
134
+ Pass your Pydantic model directly into `response_model`. The SDK extracts JSON schemas automatically, instructs the upstream provider, and parses the returned JSON into a validated Python instance:
135
+
136
+ ```python
137
+ from pydantic import BaseModel, Field
138
+ from omniai import OmniaiClient
139
+
140
+ class SecurityAudit(BaseModel):
141
+ summary: str = Field(..., description="High-level assessment")
142
+ vulnerabilities: list[str] = Field(..., description="Discovered vulnerability IDs")
143
+ passed: bool = Field(..., description="Overall security compliance status")
144
+
145
+ client = OmniaiClient()
146
+
147
+ audit: SecurityAudit = client.chat(
148
+ model="openai:gpt-5.6-luna",
149
+ prompt="Audit this configuration: CORS allowed * with credentials enabled.",
150
+ response_model=SecurityAudit,
151
+ )
152
+
153
+ print(audit.summary)
154
+ print(f"Passed: {audit.passed}")
155
+ ```
156
+
157
+ ### 4. Self-Hosted vLLM Inference
158
+
159
+ Connect seamlessly to any self-hosted or cloud vLLM server:
160
+
161
+ ```python
162
+ from omniai import OmniaiClient
163
+
164
+ # Point to your internal vLLM cluster (or route through OmniAI Gateway)
165
+ client = OmniaiClient(
166
+ base_url="http://vllm-node.internal:8000/v1",
167
+ api_key="EMPTY",
168
+ )
169
+
170
+ response = client.chat(
171
+ model="vllm:meta-llama/Llama-3.1-8B-Instruct",
172
+ prompt="Hello from OmniAI!",
173
+ )
174
+ print(response)
175
+ ```
176
+
177
+ ### 5. Asynchronous Client (`AsyncOmniaiClient`)
178
+
179
+ Full `async`/`await` parity for high-concurrency applications:
180
+
181
+ ```python
182
+ import asyncio
183
+ from omniai import AsyncOmniaiClient
184
+
185
+ async def main():
186
+ async with AsyncOmniaiClient() as client:
187
+ # Async chat
188
+ result = await client.chat(
189
+ model="openai:gpt-5.6-luna",
190
+ prompt="Hello async world!",
191
+ )
192
+ print(result)
193
+
194
+ # Async streaming
195
+ async for chunk in client.stream(model="openai:gpt-5.6-luna", prompt="Count to 3."):
196
+ print(chunk, end="", flush=True)
197
+
198
+ asyncio.run(main())
199
+ ```
200
+
201
+ ### 6. Fault-Tolerant Background Celery Tasks
202
+
203
+ Queue long-running jobs to the background Celery cluster with automatic polling resilience:
204
+
205
+ ```python
206
+ from omniai import OmniaiClient
207
+
208
+ client = OmniaiClient()
209
+
210
+ # Submit task asynchronously to the queue
211
+ job = client.submit_task(
212
+ model="openai:gpt-5.6-luna",
213
+ prompt="Analyze 50 pages of financial records.",
214
+ )
215
+ print(f"Dispatched task ID: {job.task_id}")
216
+
217
+ # Fault-tolerant polling that survives temporary network dropouts
218
+ result = job.wait(timeout=180.0, interval=2.0)
219
+ print(result)
220
+ ```
221
+
222
+ ### 7. LiveKit Multimodal Real-Time Voice & Video
223
+
224
+ Generate signed WebRTC credentials on the fly:
225
+
226
+ ```python
227
+ from omniai import OmniaiClient
228
+
229
+ client = OmniaiClient()
230
+
231
+ session = client.create_live_session(
232
+ model="gemini:gemini-3.1-flash-live-preview",
233
+ voice="Aoede",
234
+ participant_identity="agent-caller-01",
235
+ )
236
+ print(f"Connect to room '{session.room_name}' at {session.server_url}")
237
+ print(f"JWT Token: {session.participant_token}")
238
+ ```
239
+
240
+ ---
241
+
242
+ ## 🛡️ Production Reliability & Fault Tolerance
243
+
244
+ The SDK includes enterprise resilience patterns built-in:
245
+
246
+ 1. **Exponential Backoff with Full Jitter**:
247
+ - Automatically retries transient failures: HTTP 429 (Rate Limit), 500, 502, 503, 504, connection timeouts, and connection reset errors.
248
+ - Respects upstream `Retry-After` headers.
249
+ - Configurable via `max_retries: int = 3` and `backoff_factor: float = 0.5`.
250
+
251
+ 2. **Connection Pooling**:
252
+ - Pre-configured with `httpx.Limits(max_keepalive_connections=20, max_connections=100)`.
253
+ - Supports explicit lifecycle management via `client.close()` and context managers (`with OmniaiClient() as client:`).
254
+
255
+ 3. **Granular Exception Hierarchy**:
256
+ - `OmniaiAuthError`: HTTP 401 / 403 invalid or expired credentials.
257
+ - `OmniaiPaymentRequiredError`: HTTP 402 insufficient prepaid balance.
258
+ - `OmniaiRateLimitError`: HTTP 429 rate limit exceeded (includes `.retry_after` attribute).
259
+ - `OmniaiExecutionError`: HTTP 5xx or upstream LLM provider error.
260
+ - `OmniaiValidationError`: Model output failed schema validation.
261
+ - `OmniaiTimeoutError`: Polling or network timeout.
262
+ - `OmniaiConnectionError`: Network drops, DNS resolution failures.
263
+ - `OmniaiUnsupportedProviderError`: Raised if attempting to route to an unsupported provider.
264
+
265
+
266
+ ---
267
+
268
+ ## 📄 License
269
+
270
+ MIT © [OmniAI Team](https://omniai.go-agents.app)
@@ -0,0 +1,23 @@
1
+ omniai/__init__.py,sha256=t_uUXIm27J5XZb12JRqckN3QSGIr86LvID1yBppzCqs,2774
2
+ omniai/_base.py,sha256=mwLKH0OWlr7kgew2axLCayF6U1u_VO9PncoIr3ILQBQ,13996
3
+ omniai/_constants.py,sha256=2XLcrHO8DxkihSgjDAs1Cnetrge0ebBDE6mKBmj9XHE,817
4
+ omniai/_version.py,sha256=c2dQwvLmdQVXd3WsuiCvlH6b19EsU_UwlAA64M1hSlE,78
5
+ omniai/client.py,sha256=ZD70h5-AOgHfygLjYBT-pcqp4-tGQBH203OpLrmd1jc,10257
6
+ omniai/exceptions.py,sha256=3U_9JD0a4yWluSsWmSBvTY-Wbz5hYsxXwZOsKK_DUAE,3333
7
+ omniai/py.typed,sha256=9DkxTFnD5zEW5X5VVNnWT_8k2LgKipvgY_rjy6XFiO8,37
8
+ omniai/resources/__init__.py,sha256=_WI8PNLTgk96RO17izT-MKEoucyMNp0tATZKlXDrY4g,736
9
+ omniai/resources/chat.py,sha256=vfuEhnvYaADim3mw0gkrlfsbcYzJsDhrFS6L1NTcsQo,15078
10
+ omniai/resources/livekit.py,sha256=4m03d_MXXfPiSrgu_fAkPP0bQWoYK_fmVlqI8F3Yce4,2168
11
+ omniai/resources/models.py,sha256=vx9YOTCLYEX5fdct7ht8n9P_JIFXb9_7nSJ_YNR5lxI,2313
12
+ omniai/resources/router.py,sha256=Stjj08BkHDsOXXKjvd96qJGMNsOi2S2gm13kmNBupjU,43286
13
+ omniai/resources/tasks.py,sha256=fTEi-5a_sK0OShzVb7AWEIIDsFjTDTeZ1bwKQHK0dzo,6215
14
+ omniai/types/__init__.py,sha256=AL28TGnjsRyyDZWa3qeVnu4-ABSWA3ns3cDx9jyZkzM,677
15
+ omniai/types/chat.py,sha256=2iZ3W9AIIomSYJLXDH5nqTmkk76xdgXjVnTBhrJxnPE,1521
16
+ omniai/types/livekit.py,sha256=YrBKuHJrLKtOMr3tN9qg5ivQUg2U2dK1EBFUb5zJ_NU,1009
17
+ omniai/types/models.py,sha256=IVdLz97xOMx23hRxnSAiv5N_qY9WxtticADkmVWCyIE,900
18
+ omniai/types/tasks.py,sha256=pNS194ma_Lbfjxw84Y9eEDAiYPDsYfAVmwZDD0diBYE,8372
19
+ omniai_kit-1.0.0.dist-info/licenses/LICENSE,sha256=aRe0C1CNovyEHPlFulNFl_u7NDK-bJBgstCL6lxem14,1068
20
+ omniai_kit-1.0.0.dist-info/METADATA,sha256=d18Jpo6CSVpLnIvKh6kGZFayZd-k3_xtAx60GbIAbcM,9190
21
+ omniai_kit-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
22
+ omniai_kit-1.0.0.dist-info/top_level.txt,sha256=a7OxUMNLeMKwY8jKopgybpSs_uVF-grcmIHkvXwiLqg,7
23
+ omniai_kit-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OmniAI Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ omniai