tokenbee-sdk 2.0.0__tar.gz → 2.1.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.
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/PKG-INFO +9 -8
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/README.md +8 -7
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/pyproject.toml +1 -1
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/setup.py +1 -1
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/tokenbee/__init__.py +16 -6
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/tokenbee_sdk.egg-info/PKG-INFO +9 -8
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/setup.cfg +0 -0
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/tokenbee_sdk.egg-info/SOURCES.txt +0 -0
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/tokenbee_sdk.egg-info/dependency_links.txt +0 -0
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/tokenbee_sdk.egg-info/requires.txt +0 -0
- {tokenbee_sdk-2.0.0 → tokenbee_sdk-2.1.0}/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: 2.
|
|
3
|
+
Version: 2.1.0
|
|
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>
|
|
@@ -18,13 +18,13 @@ Dynamic: requires-python
|
|
|
18
18
|
|
|
19
19
|
# TokenBee Python SDK
|
|
20
20
|
|
|
21
|
-
Official Python SDK for [TokenBee](https://tokenbee.io)
|
|
21
|
+
Official Python SDK for [TokenBee](https://tokenbee.io) — AI interaction capture, audit, replay, and optimization.
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
25
|
- **Unified API**: Access multiple LLM providers (OpenAI, Anthropic, Google, Mistral, etc.) through a single interface.
|
|
26
26
|
- **Intelligent Compression**: Reduce token usage and latency with context-aware compression.
|
|
27
|
-
- **
|
|
27
|
+
- **Configurable Capture**: Retain interaction content when you need it; turn capture off per request or globally.
|
|
28
28
|
- **Built-in Observability**: Automatic tracking of latency, costs, and token usage.
|
|
29
29
|
|
|
30
30
|
## Links
|
|
@@ -82,7 +82,7 @@ response = client.send(
|
|
|
82
82
|
"messages": [...],
|
|
83
83
|
"compression": "auto", # "auto" (default), "on", or "off"
|
|
84
84
|
"rate": CompressionRate.HIGH, # MEDIUM (0.5), HIGH (0.33), etc.
|
|
85
|
-
"
|
|
85
|
+
"capture": False # per-request: do not retain message/response bodies
|
|
86
86
|
}
|
|
87
87
|
)
|
|
88
88
|
```
|
|
@@ -91,15 +91,16 @@ response = client.send(
|
|
|
91
91
|
- **`rate`**: Controls the aggressiveness of compression. `HIGH` aims for ~67% token reduction.
|
|
92
92
|
- **`sessionId`**: (Optional) String ID to group multiple requests into a single replayable session in the dashboard.
|
|
93
93
|
- **`userId`**: (Optional) String ID to track usage and costs per unique end-user.
|
|
94
|
-
- **`
|
|
94
|
+
- **`capture`**: (Optional) Per-request override. `False` does not retain messages/responses (metadata like tokens/cost/latency can still be recorded). Precedence: per-request → project setting → default on.
|
|
95
95
|
|
|
96
96
|
### Supported Models
|
|
97
97
|
|
|
98
98
|
The SDK provides a `TokenBeeModel` enum with popular models:
|
|
99
99
|
|
|
100
|
-
- `TokenBeeModel.
|
|
101
|
-
- `TokenBeeModel.
|
|
102
|
-
- `TokenBeeModel.
|
|
100
|
+
- `TokenBeeModel.OPENAI_GPT_6_ASTRA`
|
|
101
|
+
- `TokenBeeModel.ANTHROPIC_CLAUDE_FABLE_5_1`
|
|
102
|
+
- `TokenBeeModel.GEMINI_3_8_FLASH`
|
|
103
|
+
- `TokenBeeModel.XAI_GROK_4_6`
|
|
103
104
|
- ... and many others.
|
|
104
105
|
|
|
105
106
|
## License
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# TokenBee Python SDK
|
|
2
2
|
|
|
3
|
-
Official Python SDK for [TokenBee](https://tokenbee.io)
|
|
3
|
+
Official Python SDK for [TokenBee](https://tokenbee.io) — AI interaction capture, audit, replay, and optimization.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **Unified API**: Access multiple LLM providers (OpenAI, Anthropic, Google, Mistral, etc.) through a single interface.
|
|
8
8
|
- **Intelligent Compression**: Reduce token usage and latency with context-aware compression.
|
|
9
|
-
- **
|
|
9
|
+
- **Configurable Capture**: Retain interaction content when you need it; turn capture off per request or globally.
|
|
10
10
|
- **Built-in Observability**: Automatic tracking of latency, costs, and token usage.
|
|
11
11
|
|
|
12
12
|
## Links
|
|
@@ -64,7 +64,7 @@ response = client.send(
|
|
|
64
64
|
"messages": [...],
|
|
65
65
|
"compression": "auto", # "auto" (default), "on", or "off"
|
|
66
66
|
"rate": CompressionRate.HIGH, # MEDIUM (0.5), HIGH (0.33), etc.
|
|
67
|
-
"
|
|
67
|
+
"capture": False # per-request: do not retain message/response bodies
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
70
|
```
|
|
@@ -73,15 +73,16 @@ response = client.send(
|
|
|
73
73
|
- **`rate`**: Controls the aggressiveness of compression. `HIGH` aims for ~67% token reduction.
|
|
74
74
|
- **`sessionId`**: (Optional) String ID to group multiple requests into a single replayable session in the dashboard.
|
|
75
75
|
- **`userId`**: (Optional) String ID to track usage and costs per unique end-user.
|
|
76
|
-
- **`
|
|
76
|
+
- **`capture`**: (Optional) Per-request override. `False` does not retain messages/responses (metadata like tokens/cost/latency can still be recorded). Precedence: per-request → project setting → default on.
|
|
77
77
|
|
|
78
78
|
### Supported Models
|
|
79
79
|
|
|
80
80
|
The SDK provides a `TokenBeeModel` enum with popular models:
|
|
81
81
|
|
|
82
|
-
- `TokenBeeModel.
|
|
83
|
-
- `TokenBeeModel.
|
|
84
|
-
- `TokenBeeModel.
|
|
82
|
+
- `TokenBeeModel.OPENAI_GPT_6_ASTRA`
|
|
83
|
+
- `TokenBeeModel.ANTHROPIC_CLAUDE_FABLE_5_1`
|
|
84
|
+
- `TokenBeeModel.GEMINI_3_8_FLASH`
|
|
85
|
+
- `TokenBeeModel.XAI_GROK_4_6`
|
|
85
86
|
- ... and many others.
|
|
86
87
|
|
|
87
88
|
## License
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import httpx
|
|
3
3
|
from enum import Enum
|
|
4
|
+
from typing import Optional
|
|
4
5
|
|
|
5
6
|
class CompressionRate(str, Enum):
|
|
6
7
|
LOW = "0.75"
|
|
@@ -20,7 +21,8 @@ class TokenBeeContext(str, Enum):
|
|
|
20
21
|
CODE = "code"
|
|
21
22
|
|
|
22
23
|
class TokenBeeModel(str, Enum):
|
|
23
|
-
# OpenAI —
|
|
24
|
+
# OpenAI — GPT-6 / GPT-5.6 family
|
|
25
|
+
OPENAI_GPT_6_ASTRA = "openai/gpt-6-astra"
|
|
24
26
|
OPENAI_GPT_5_6_SOL = "openai/gpt-5.6-sol"
|
|
25
27
|
OPENAI_GPT_5_6_TERRA = "openai/gpt-5.6-terra"
|
|
26
28
|
OPENAI_GPT_5_6_LUNA = "openai/gpt-5.6-luna"
|
|
@@ -42,6 +44,10 @@ class TokenBeeModel(str, Enum):
|
|
|
42
44
|
OPENAI_O1_MINI = "openai/o1-mini"
|
|
43
45
|
|
|
44
46
|
# Anthropic
|
|
47
|
+
ANTHROPIC_CLAUDE_FABLE_5_1 = "anthropic/claude-fable-5-1"
|
|
48
|
+
ANTHROPIC_CLAUDE_OPUS_5 = "anthropic/claude-opus-5"
|
|
49
|
+
ANTHROPIC_CLAUDE_SONNET_5 = "anthropic/claude-sonnet-5"
|
|
50
|
+
ANTHROPIC_CLAUDE_HAIKU_4_5 = "anthropic/claude-haiku-4-5"
|
|
45
51
|
ANTHROPIC_CLAUDE_SONNET_4 = "anthropic/claude-sonnet-4-latest"
|
|
46
52
|
ANTHROPIC_CLAUDE_OPUS_4 = "anthropic/claude-opus-4-latest"
|
|
47
53
|
ANTHROPIC_CLAUDE_HAIKU_4 = "anthropic/claude-haiku-4-latest"
|
|
@@ -50,6 +56,8 @@ class TokenBeeModel(str, Enum):
|
|
|
50
56
|
ANTHROPIC_CLAUDE_3_5_HAIKU = "anthropic/claude-3-5-haiku-latest"
|
|
51
57
|
|
|
52
58
|
# Google
|
|
59
|
+
GEMINI_3_8_FLASH = "google/gemini-3.8-flash"
|
|
60
|
+
GEMINI_3_1_PRO = "google/gemini-3.1-pro-preview"
|
|
53
61
|
GEMINI_2_5_PRO = "google/gemini-2.5-pro"
|
|
54
62
|
GEMINI_2_5_FLASH = "google/gemini-2.5-flash"
|
|
55
63
|
GEMINI_2_0_FLASH = "google/gemini-2.0-flash"
|
|
@@ -75,6 +83,7 @@ class TokenBeeModel(str, Enum):
|
|
|
75
83
|
GROQ_COMPOUND_MINI = "groq/groq/compound-mini"
|
|
76
84
|
|
|
77
85
|
# xAI
|
|
86
|
+
XAI_GROK_4_6 = "xai/grok-4.6"
|
|
78
87
|
XAI_GROK_3 = "xai/grok-3"
|
|
79
88
|
XAI_GROK_2 = "xai/grok-2-1212"
|
|
80
89
|
XAI_GROK_2_MINI = "xai/grok-2-mini-1212"
|
|
@@ -90,7 +99,7 @@ class TokenBee:
|
|
|
90
99
|
context: str = TokenBeeContext.AUTO,
|
|
91
100
|
model: str = "",
|
|
92
101
|
provider: str = "",
|
|
93
|
-
|
|
102
|
+
capture: Optional[bool] = None
|
|
94
103
|
):
|
|
95
104
|
self.api_key = api_key
|
|
96
105
|
self.llm_key = llm_key
|
|
@@ -104,8 +113,9 @@ class TokenBee:
|
|
|
104
113
|
"X-TokenBee-Rate": rate,
|
|
105
114
|
"X-TokenBee-Strategy": strategy,
|
|
106
115
|
"X-TokenBee-Context": context,
|
|
107
|
-
"X-TokenBee-Privacy": str(privacy).lower()
|
|
108
116
|
}
|
|
117
|
+
if capture is not None:
|
|
118
|
+
self.headers["X-TokenBee-Capture"] = str(capture).lower()
|
|
109
119
|
if model:
|
|
110
120
|
self.headers["X-TokenBee-Model"] = model
|
|
111
121
|
if provider:
|
|
@@ -130,8 +140,8 @@ class TokenBee:
|
|
|
130
140
|
headers["X-TokenBee-Strategy"] = str(input["strategy"])
|
|
131
141
|
if "context" in input:
|
|
132
142
|
headers["X-TokenBee-Context"] = str(input["context"])
|
|
133
|
-
if "
|
|
134
|
-
headers["X-TokenBee-
|
|
143
|
+
if "capture" in input:
|
|
144
|
+
headers["X-TokenBee-Capture"] = str(input["capture"]).lower()
|
|
135
145
|
if "sessionId" in input:
|
|
136
146
|
headers["X-TB-Session-Id"] = str(input["sessionId"])
|
|
137
147
|
if "userId" in input:
|
|
@@ -143,7 +153,7 @@ class TokenBee:
|
|
|
143
153
|
payload.pop("rate", None)
|
|
144
154
|
payload.pop("strategy", None)
|
|
145
155
|
payload.pop("context", None)
|
|
146
|
-
payload.pop("
|
|
156
|
+
payload.pop("capture", None)
|
|
147
157
|
payload.pop("sessionId", None)
|
|
148
158
|
payload.pop("userId", None)
|
|
149
159
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tokenbee-sdk
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
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>
|
|
@@ -18,13 +18,13 @@ Dynamic: requires-python
|
|
|
18
18
|
|
|
19
19
|
# TokenBee Python SDK
|
|
20
20
|
|
|
21
|
-
Official Python SDK for [TokenBee](https://tokenbee.io)
|
|
21
|
+
Official Python SDK for [TokenBee](https://tokenbee.io) — AI interaction capture, audit, replay, and optimization.
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
25
|
- **Unified API**: Access multiple LLM providers (OpenAI, Anthropic, Google, Mistral, etc.) through a single interface.
|
|
26
26
|
- **Intelligent Compression**: Reduce token usage and latency with context-aware compression.
|
|
27
|
-
- **
|
|
27
|
+
- **Configurable Capture**: Retain interaction content when you need it; turn capture off per request or globally.
|
|
28
28
|
- **Built-in Observability**: Automatic tracking of latency, costs, and token usage.
|
|
29
29
|
|
|
30
30
|
## Links
|
|
@@ -82,7 +82,7 @@ response = client.send(
|
|
|
82
82
|
"messages": [...],
|
|
83
83
|
"compression": "auto", # "auto" (default), "on", or "off"
|
|
84
84
|
"rate": CompressionRate.HIGH, # MEDIUM (0.5), HIGH (0.33), etc.
|
|
85
|
-
"
|
|
85
|
+
"capture": False # per-request: do not retain message/response bodies
|
|
86
86
|
}
|
|
87
87
|
)
|
|
88
88
|
```
|
|
@@ -91,15 +91,16 @@ response = client.send(
|
|
|
91
91
|
- **`rate`**: Controls the aggressiveness of compression. `HIGH` aims for ~67% token reduction.
|
|
92
92
|
- **`sessionId`**: (Optional) String ID to group multiple requests into a single replayable session in the dashboard.
|
|
93
93
|
- **`userId`**: (Optional) String ID to track usage and costs per unique end-user.
|
|
94
|
-
- **`
|
|
94
|
+
- **`capture`**: (Optional) Per-request override. `False` does not retain messages/responses (metadata like tokens/cost/latency can still be recorded). Precedence: per-request → project setting → default on.
|
|
95
95
|
|
|
96
96
|
### Supported Models
|
|
97
97
|
|
|
98
98
|
The SDK provides a `TokenBeeModel` enum with popular models:
|
|
99
99
|
|
|
100
|
-
- `TokenBeeModel.
|
|
101
|
-
- `TokenBeeModel.
|
|
102
|
-
- `TokenBeeModel.
|
|
100
|
+
- `TokenBeeModel.OPENAI_GPT_6_ASTRA`
|
|
101
|
+
- `TokenBeeModel.ANTHROPIC_CLAUDE_FABLE_5_1`
|
|
102
|
+
- `TokenBeeModel.GEMINI_3_8_FLASH`
|
|
103
|
+
- `TokenBeeModel.XAI_GROK_4_6`
|
|
103
104
|
- ... and many others.
|
|
104
105
|
|
|
105
106
|
## License
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|