aiutils-sdk 0.2.2__tar.gz → 0.3.0__tar.gz

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.
Files changed (23) hide show
  1. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/PKG-INFO +1 -1
  2. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/__init__.py +1 -1
  3. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/client.py +7 -1
  4. aiutils_sdk-0.3.0/aiutils_sdk/files.py +39 -0
  5. aiutils_sdk-0.3.0/aiutils_sdk/tools_and_batch.py +40 -0
  6. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/wallet.py +29 -0
  7. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk.egg-info/PKG-INFO +1 -1
  8. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk.egg-info/SOURCES.txt +2 -0
  9. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/pyproject.toml +1 -1
  10. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/README.md +0 -0
  11. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/chat.py +0 -0
  12. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/embeddings.py +0 -0
  13. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/exceptions.py +0 -0
  14. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/generations.py +0 -0
  15. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/images.py +0 -0
  16. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/models.py +0 -0
  17. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/research.py +0 -0
  18. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk/webhooks.py +0 -0
  19. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk.egg-info/dependency_links.txt +0 -0
  20. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk.egg-info/requires.txt +0 -0
  21. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/aiutils_sdk.egg-info/top_level.txt +0 -0
  22. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/setup.cfg +0 -0
  23. {aiutils_sdk-0.2.2 → aiutils_sdk-0.3.0}/tests/test_sdk.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiutils-sdk
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: Python SDK for the AiUtils Developer API — 100+ AI models via one unified API
5
5
  Author-email: AiUtils Team <dev@aiutils.io>
6
6
  License-Expression: MIT
@@ -6,7 +6,7 @@ from aiutils_sdk.exceptions import (
6
6
  RateLimitError, APIError, ProviderError,
7
7
  )
8
8
 
9
- __version__ = "0.2.2"
9
+ __version__ = "0.3.0"
10
10
  __all__ = [
11
11
  "AiUtils",
12
12
  "ChatResponse", "ChatStreamChunk",
@@ -12,8 +12,10 @@ from aiutils_sdk.embeddings import Embeddings
12
12
  from aiutils_sdk.generations import Generations
13
13
  from aiutils_sdk.models import Models
14
14
  from aiutils_sdk.research import Research
15
- from aiutils_sdk.wallet import Wallet
15
+ from aiutils_sdk.wallet import Wallet, Billing
16
16
  from aiutils_sdk.webhooks import Webhooks
17
+ from aiutils_sdk.files import Files
18
+ from aiutils_sdk.tools_and_batch import Tools, Batch
17
19
  from aiutils_sdk.exceptions import AuthenticationError, APIError
18
20
 
19
21
  logger = logging.getLogger(__name__)
@@ -55,6 +57,10 @@ class AiUtils:
55
57
  self.research = Research(self)
56
58
  self.wallet = Wallet(self)
57
59
  self.webhooks = Webhooks(self)
60
+ self.billing = Billing(self)
61
+ self.files = Files(self)
62
+ self.tools = Tools(self)
63
+ self.batch = Batch(self)
58
64
 
59
65
  def _request(self, method: str, path: str, **kwargs) -> dict:
60
66
  """Make a synchronous HTTP request."""
@@ -0,0 +1,39 @@
1
+ """File upload resource."""
2
+ from __future__ import annotations
3
+ import logging
4
+ from typing import Optional
5
+
6
+ logger = logging.getLogger(__name__)
7
+
8
+
9
+ class Files:
10
+ """File upload namespace."""
11
+
12
+ def __init__(self, client):
13
+ self._client = client
14
+
15
+ def upload(self, file_path: str, purpose: str = "assistants") -> dict:
16
+ """Upload a file to the API."""
17
+ logger.debug(f"Entered into Files.upload: {file_path}")
18
+ with open(file_path, "rb") as f:
19
+ return self._client._request(
20
+ "POST", "/v1/files",
21
+ files={"file": f},
22
+ data={"purpose": purpose},
23
+ )
24
+
25
+ def list(self) -> list[dict]:
26
+ """List uploaded files."""
27
+ logger.debug("Entered into Files.list")
28
+ data = self._client._request("GET", "/v1/files")
29
+ return data.get("data", data.get("files", []))
30
+
31
+ def get(self, file_id: str) -> dict:
32
+ """Get file metadata."""
33
+ logger.debug(f"Entered into Files.get: {file_id}")
34
+ return self._client._request("GET", f"/v1/files/{file_id}")
35
+
36
+ def delete(self, file_id: str) -> dict:
37
+ """Delete a file."""
38
+ logger.debug(f"Entered into Files.delete: {file_id}")
39
+ return self._client._request("DELETE", f"/v1/files/{file_id}")
@@ -0,0 +1,40 @@
1
+ """Portal tools + batch endpoints."""
2
+ from __future__ import annotations
3
+ import logging
4
+ from typing import Optional
5
+
6
+ logger = logging.getLogger(__name__)
7
+
8
+
9
+ class Tools:
10
+ """Portal tools namespace."""
11
+
12
+ def __init__(self, client):
13
+ self._client = client
14
+
15
+ def genres(self) -> dict:
16
+ """List available tool genres/categories."""
17
+ logger.debug("Entered into Tools.genres")
18
+ return self._client._request("GET", "/v1/tools/genres")
19
+
20
+ def execute(self, tool_slug: str, **params) -> dict:
21
+ """Execute a portal tool by slug."""
22
+ logger.debug(f"Entered into Tools.execute: {tool_slug}")
23
+ return self._client._request("POST", f"/v1/tools/{tool_slug}/execute", json=params)
24
+
25
+
26
+ class Batch:
27
+ """Batch request namespace."""
28
+
29
+ def __init__(self, client):
30
+ self._client = client
31
+
32
+ def create(self, requests: list[dict]) -> dict:
33
+ """Submit a batch of requests."""
34
+ logger.debug("Entered into Batch.create")
35
+ return self._client._request("POST", "/v1/batch", json={"requests": requests})
36
+
37
+ def status(self, batch_id: str) -> dict:
38
+ """Check batch status."""
39
+ logger.debug(f"Entered into Batch.status: {batch_id}")
40
+ return self._client._request("GET", f"/v1/batch/{batch_id}")
@@ -103,3 +103,32 @@ class Wallet:
103
103
  body = {"model": model, "parameters": parameters or {}}
104
104
  data = self._client._request("POST", "/v1/pricing/estimate", json=body)
105
105
  return PricingEstimate(**data)
106
+
107
+
108
+ def set_alert_threshold(self, low_balance_dt: int) -> dict:
109
+ """Set low balance alert threshold."""
110
+ logger.debug("Entered into Wallet.set_alert_threshold")
111
+ return self._client._request("POST", "/v1/wallet/alert-threshold", json={"low_balance_dt": low_balance_dt})
112
+
113
+
114
+ class Billing:
115
+ """Billing namespace for DT purchases."""
116
+
117
+ def __init__(self, client):
118
+ self._client = client
119
+
120
+ def list_packs(self) -> list[dict]:
121
+ """List available DT packs."""
122
+ logger.debug("Entered into Billing.list_packs")
123
+ data = self._client._request("GET", "/v1/billing/packs")
124
+ return data.get("packs", data.get("data", []))
125
+
126
+ def checkout(self, pack_id: str) -> dict:
127
+ """Create a checkout session for a DT pack."""
128
+ logger.debug("Entered into Billing.checkout")
129
+ return self._client._request("POST", "/v1/billing/checkout", json={"pack_id": pack_id})
130
+
131
+ def get_invoice(self, transaction_id: str) -> dict:
132
+ """Get invoice for a billing transaction."""
133
+ logger.debug("Entered into Billing.get_invoice")
134
+ return self._client._request("GET", f"/v1/billing/invoice/{transaction_id}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiutils-sdk
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: Python SDK for the AiUtils Developer API — 100+ AI models via one unified API
5
5
  Author-email: AiUtils Team <dev@aiutils.io>
6
6
  License-Expression: MIT
@@ -5,10 +5,12 @@ aiutils_sdk/chat.py
5
5
  aiutils_sdk/client.py
6
6
  aiutils_sdk/embeddings.py
7
7
  aiutils_sdk/exceptions.py
8
+ aiutils_sdk/files.py
8
9
  aiutils_sdk/generations.py
9
10
  aiutils_sdk/images.py
10
11
  aiutils_sdk/models.py
11
12
  aiutils_sdk/research.py
13
+ aiutils_sdk/tools_and_batch.py
12
14
  aiutils_sdk/wallet.py
13
15
  aiutils_sdk/webhooks.py
14
16
  aiutils_sdk.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "aiutils-sdk"
3
- version = "0.2.2"
3
+ version = "0.3.0"
4
4
  description = "Python SDK for the AiUtils Developer API — 100+ AI models via one unified API"
5
5
  requires-python = ">=3.9"
6
6
  dependencies = [ "httpx>=0.25.0", "pydantic>=2.0",]
File without changes
File without changes