tokenbee-sdk 1.2.2__tar.gz → 1.2.3__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.
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/PKG-INFO +10 -4
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/README.md +9 -3
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/pyproject.toml +1 -1
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/setup.py +1 -1
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/tokenbee/__init__.py +6 -0
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/tokenbee_sdk.egg-info/PKG-INFO +10 -4
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/setup.cfg +0 -0
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/tokenbee_sdk.egg-info/SOURCES.txt +0 -0
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/tokenbee_sdk.egg-info/dependency_links.txt +0 -0
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/tokenbee_sdk.egg-info/requires.txt +0 -0
- {tokenbee_sdk-1.2.2 → tokenbee_sdk-1.2.3}/tokenbee_sdk.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tokenbee-sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.3
|
|
4
4
|
Summary: Official Python SDK for TokenBee LLM inference gateway and observability.
|
|
5
5
|
Author: TokenBee Inc.
|
|
6
6
|
Author-email: "TokenBee Inc." <founders@tokenbee.io>
|
|
@@ -73,20 +73,26 @@ TokenBee is a **stateless** gateway. We do not store your LLM provider API keys
|
|
|
73
73
|
|
|
74
74
|
### Compression Control
|
|
75
75
|
|
|
76
|
-
You can specify the compression rate and method per request
|
|
76
|
+
You can specify the compression rate and method per request. TokenBee uses an intelligent semantic engine to reduce token usage while preserving meaning.
|
|
77
77
|
|
|
78
78
|
```python
|
|
79
79
|
response = client.send(
|
|
80
80
|
model=TokenBeeModel.ANTHROPIC_CLAUDE_3_5_SONNET,
|
|
81
81
|
input={
|
|
82
82
|
"messages": [...],
|
|
83
|
-
"compression": "on",
|
|
84
|
-
"rate": CompressionRate.HIGH,
|
|
83
|
+
"compression": "auto", # "auto" (default), "on", or "off"
|
|
84
|
+
"rate": CompressionRate.HIGH, # MEDIUM (0.5), HIGH (0.33), etc.
|
|
85
85
|
"privacy": True
|
|
86
86
|
}
|
|
87
87
|
)
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
- **`compression`**: Set to `"auto"` to let TokenBee decide when to compress, or `"off"` to bypass the compression engine entirely for high-precision tasks.
|
|
91
|
+
- **`rate`**: Controls the aggressiveness of compression. `HIGH` aims for ~67% token reduction.
|
|
92
|
+
- **`sessionId`**: (Optional) String ID to group multiple requests into a single replayable session in the dashboard.
|
|
93
|
+
- **`userId`**: (Optional) String ID to track usage and costs per unique end-user.
|
|
94
|
+
- **`privacy`**: (Optional) Set to `True` to disable payload logging and session replays for this request. Metadata (latency, tokens) will still be recorded for observability.
|
|
95
|
+
|
|
90
96
|
### Supported Models
|
|
91
97
|
|
|
92
98
|
The SDK provides a `TokenBeeModel` enum with popular models:
|
|
@@ -55,20 +55,26 @@ TokenBee is a **stateless** gateway. We do not store your LLM provider API keys
|
|
|
55
55
|
|
|
56
56
|
### Compression Control
|
|
57
57
|
|
|
58
|
-
You can specify the compression rate and method per request
|
|
58
|
+
You can specify the compression rate and method per request. TokenBee uses an intelligent semantic engine to reduce token usage while preserving meaning.
|
|
59
59
|
|
|
60
60
|
```python
|
|
61
61
|
response = client.send(
|
|
62
62
|
model=TokenBeeModel.ANTHROPIC_CLAUDE_3_5_SONNET,
|
|
63
63
|
input={
|
|
64
64
|
"messages": [...],
|
|
65
|
-
"compression": "on",
|
|
66
|
-
"rate": CompressionRate.HIGH,
|
|
65
|
+
"compression": "auto", # "auto" (default), "on", or "off"
|
|
66
|
+
"rate": CompressionRate.HIGH, # MEDIUM (0.5), HIGH (0.33), etc.
|
|
67
67
|
"privacy": True
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
- **`compression`**: Set to `"auto"` to let TokenBee decide when to compress, or `"off"` to bypass the compression engine entirely for high-precision tasks.
|
|
73
|
+
- **`rate`**: Controls the aggressiveness of compression. `HIGH` aims for ~67% token reduction.
|
|
74
|
+
- **`sessionId`**: (Optional) String ID to group multiple requests into a single replayable session in the dashboard.
|
|
75
|
+
- **`userId`**: (Optional) String ID to track usage and costs per unique end-user.
|
|
76
|
+
- **`privacy`**: (Optional) Set to `True` to disable payload logging and session replays for this request. Metadata (latency, tokens) will still be recorded for observability.
|
|
77
|
+
|
|
72
78
|
### Supported Models
|
|
73
79
|
|
|
74
80
|
The SDK provides a `TokenBeeModel` enum with popular models:
|
|
@@ -98,12 +98,18 @@ class TokenBee:
|
|
|
98
98
|
headers["X-TokenBee-Rate"] = str(input["rate"])
|
|
99
99
|
if "privacy" in input:
|
|
100
100
|
headers["X-TokenBee-Privacy"] = str(input["privacy"]).lower()
|
|
101
|
+
if "sessionId" in input:
|
|
102
|
+
headers["X-TB-Session-Id"] = str(input["sessionId"])
|
|
103
|
+
if "userId" in input:
|
|
104
|
+
headers["X-TB-User-Id"] = str(input["userId"])
|
|
101
105
|
|
|
102
106
|
payload = input.copy()
|
|
103
107
|
payload["model"] = model_name
|
|
104
108
|
payload.pop("compression", None)
|
|
105
109
|
payload.pop("rate", None)
|
|
106
110
|
payload.pop("privacy", None)
|
|
111
|
+
payload.pop("sessionId", None)
|
|
112
|
+
payload.pop("userId", None)
|
|
107
113
|
|
|
108
114
|
response = self.client.post("/chat/completions", json=payload, headers=headers)
|
|
109
115
|
response.raise_for_status()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tokenbee-sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.3
|
|
4
4
|
Summary: Official Python SDK for TokenBee LLM inference gateway and observability.
|
|
5
5
|
Author: TokenBee Inc.
|
|
6
6
|
Author-email: "TokenBee Inc." <founders@tokenbee.io>
|
|
@@ -73,20 +73,26 @@ TokenBee is a **stateless** gateway. We do not store your LLM provider API keys
|
|
|
73
73
|
|
|
74
74
|
### Compression Control
|
|
75
75
|
|
|
76
|
-
You can specify the compression rate and method per request
|
|
76
|
+
You can specify the compression rate and method per request. TokenBee uses an intelligent semantic engine to reduce token usage while preserving meaning.
|
|
77
77
|
|
|
78
78
|
```python
|
|
79
79
|
response = client.send(
|
|
80
80
|
model=TokenBeeModel.ANTHROPIC_CLAUDE_3_5_SONNET,
|
|
81
81
|
input={
|
|
82
82
|
"messages": [...],
|
|
83
|
-
"compression": "on",
|
|
84
|
-
"rate": CompressionRate.HIGH,
|
|
83
|
+
"compression": "auto", # "auto" (default), "on", or "off"
|
|
84
|
+
"rate": CompressionRate.HIGH, # MEDIUM (0.5), HIGH (0.33), etc.
|
|
85
85
|
"privacy": True
|
|
86
86
|
}
|
|
87
87
|
)
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
- **`compression`**: Set to `"auto"` to let TokenBee decide when to compress, or `"off"` to bypass the compression engine entirely for high-precision tasks.
|
|
91
|
+
- **`rate`**: Controls the aggressiveness of compression. `HIGH` aims for ~67% token reduction.
|
|
92
|
+
- **`sessionId`**: (Optional) String ID to group multiple requests into a single replayable session in the dashboard.
|
|
93
|
+
- **`userId`**: (Optional) String ID to track usage and costs per unique end-user.
|
|
94
|
+
- **`privacy`**: (Optional) Set to `True` to disable payload logging and session replays for this request. Metadata (latency, tokens) will still be recorded for observability.
|
|
95
|
+
|
|
90
96
|
### Supported Models
|
|
91
97
|
|
|
92
98
|
The SDK provides a `TokenBeeModel` enum with popular models:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|