tokenbee-sdk 1.2.1__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.
@@ -1,9 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tokenbee-sdk
3
- Version: 1.2.1
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>
7
+ Project-URL: Homepage, https://tokenbee.io
8
+ Project-URL: Dashboard, https://tokenbee.io/dashboard
9
+ Project-URL: Repository, https://github.com/tokenBee/gateway
7
10
  Classifier: Programming Language :: Python :: 3
8
11
  Classifier: License :: OSI Approved :: MIT License
9
12
  Classifier: Operating System :: OS Independent
@@ -15,7 +18,7 @@ Dynamic: requires-python
15
18
 
16
19
  # TokenBee Python SDK
17
20
 
18
- Official Python SDK for [TokenBee](https://tokenbee.dev) - The Intelligent LLM Inference Gateway with Observability, Compression, and Privacy.
21
+ Official Python SDK for [TokenBee](https://tokenbee.io) - The Intelligent LLM Inference Gateway with Observability, Compression, and Privacy.
19
22
 
20
23
  ## Features
21
24
 
@@ -24,6 +27,11 @@ Official Python SDK for [TokenBee](https://tokenbee.dev) - The Intelligent LLM I
24
27
  - **Privacy Guard**: Automatic PII masking and privacy-preserving inference.
25
28
  - **Built-in Observability**: Automatic tracking of latency, costs, and token usage.
26
29
 
30
+ ## Links
31
+
32
+ - **Homepage**: [https://tokenbee.io](https://tokenbee.io)
33
+ - **Dashboard**: [https://tokenbee.io/dashboard](https://tokenbee.io/dashboard)
34
+
27
35
  ## Installation
28
36
 
29
37
  ```bash
@@ -65,20 +73,26 @@ TokenBee is a **stateless** gateway. We do not store your LLM provider API keys
65
73
 
66
74
  ### Compression Control
67
75
 
68
- 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.
69
77
 
70
78
  ```python
71
79
  response = client.send(
72
80
  model=TokenBeeModel.ANTHROPIC_CLAUDE_3_5_SONNET,
73
81
  input={
74
82
  "messages": [...],
75
- "compression": "on",
76
- "rate": CompressionRate.HIGH,
83
+ "compression": "auto", # "auto" (default), "on", or "off"
84
+ "rate": CompressionRate.HIGH, # MEDIUM (0.5), HIGH (0.33), etc.
77
85
  "privacy": True
78
86
  }
79
87
  )
80
88
  ```
81
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
+
82
96
  ### Supported Models
83
97
 
84
98
  The SDK provides a `TokenBeeModel` enum with popular models:
@@ -1,6 +1,6 @@
1
1
  # TokenBee Python SDK
2
2
 
3
- Official Python SDK for [TokenBee](https://tokenbee.dev) - The Intelligent LLM Inference Gateway with Observability, Compression, and Privacy.
3
+ Official Python SDK for [TokenBee](https://tokenbee.io) - The Intelligent LLM Inference Gateway with Observability, Compression, and Privacy.
4
4
 
5
5
  ## Features
6
6
 
@@ -9,6 +9,11 @@ Official Python SDK for [TokenBee](https://tokenbee.dev) - The Intelligent LLM I
9
9
  - **Privacy Guard**: Automatic PII masking and privacy-preserving inference.
10
10
  - **Built-in Observability**: Automatic tracking of latency, costs, and token usage.
11
11
 
12
+ ## Links
13
+
14
+ - **Homepage**: [https://tokenbee.io](https://tokenbee.io)
15
+ - **Dashboard**: [https://tokenbee.io/dashboard](https://tokenbee.io/dashboard)
16
+
12
17
  ## Installation
13
18
 
14
19
  ```bash
@@ -50,20 +55,26 @@ TokenBee is a **stateless** gateway. We do not store your LLM provider API keys
50
55
 
51
56
  ### Compression Control
52
57
 
53
- 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.
54
59
 
55
60
  ```python
56
61
  response = client.send(
57
62
  model=TokenBeeModel.ANTHROPIC_CLAUDE_3_5_SONNET,
58
63
  input={
59
64
  "messages": [...],
60
- "compression": "on",
61
- "rate": CompressionRate.HIGH,
65
+ "compression": "auto", # "auto" (default), "on", or "off"
66
+ "rate": CompressionRate.HIGH, # MEDIUM (0.5), HIGH (0.33), etc.
62
67
  "privacy": True
63
68
  }
64
69
  )
65
70
  ```
66
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
+
67
78
  ### Supported Models
68
79
 
69
80
  The SDK provides a `TokenBeeModel` enum with popular models:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tokenbee-sdk"
7
- version = "1.2.1"
7
+ version = "1.2.3"
8
8
  authors = [
9
9
  { name="TokenBee Inc.", email="founders@tokenbee.io" },
10
10
  ]
@@ -20,3 +20,8 @@ dependencies = [
20
20
  "httpx>=0.23.0",
21
21
  ]
22
22
 
23
+ [project.urls]
24
+ Homepage = "https://tokenbee.io"
25
+ Dashboard = "https://tokenbee.io/dashboard"
26
+ Repository = "https://github.com/tokenBee/gateway"
27
+
@@ -6,7 +6,7 @@ long_description = (this_directory / "README.md").read_text()
6
6
 
7
7
  setup(
8
8
  name="tokenbee-sdk",
9
- version="1.2.1",
9
+ version="1.2.3",
10
10
  packages=find_packages(),
11
11
  install_requires=["httpx>=0.23.0"],
12
12
  author="TokenBee Inc.",
@@ -20,4 +20,9 @@ setup(
20
20
  "License :: OSI Approved :: MIT License",
21
21
  "Operating System :: OS Independent",
22
22
  ],
23
+ project_urls={
24
+ "Homepage": "https://tokenbee.io",
25
+ "Dashboard": "https://tokenbee.io/dashboard",
26
+ "Source": "https://github.com/tokenBee/gateway",
27
+ },
23
28
  )
@@ -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,9 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tokenbee-sdk
3
- Version: 1.2.1
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>
7
+ Project-URL: Homepage, https://tokenbee.io
8
+ Project-URL: Dashboard, https://tokenbee.io/dashboard
9
+ Project-URL: Repository, https://github.com/tokenBee/gateway
7
10
  Classifier: Programming Language :: Python :: 3
8
11
  Classifier: License :: OSI Approved :: MIT License
9
12
  Classifier: Operating System :: OS Independent
@@ -15,7 +18,7 @@ Dynamic: requires-python
15
18
 
16
19
  # TokenBee Python SDK
17
20
 
18
- Official Python SDK for [TokenBee](https://tokenbee.dev) - The Intelligent LLM Inference Gateway with Observability, Compression, and Privacy.
21
+ Official Python SDK for [TokenBee](https://tokenbee.io) - The Intelligent LLM Inference Gateway with Observability, Compression, and Privacy.
19
22
 
20
23
  ## Features
21
24
 
@@ -24,6 +27,11 @@ Official Python SDK for [TokenBee](https://tokenbee.dev) - The Intelligent LLM I
24
27
  - **Privacy Guard**: Automatic PII masking and privacy-preserving inference.
25
28
  - **Built-in Observability**: Automatic tracking of latency, costs, and token usage.
26
29
 
30
+ ## Links
31
+
32
+ - **Homepage**: [https://tokenbee.io](https://tokenbee.io)
33
+ - **Dashboard**: [https://tokenbee.io/dashboard](https://tokenbee.io/dashboard)
34
+
27
35
  ## Installation
28
36
 
29
37
  ```bash
@@ -65,20 +73,26 @@ TokenBee is a **stateless** gateway. We do not store your LLM provider API keys
65
73
 
66
74
  ### Compression Control
67
75
 
68
- 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.
69
77
 
70
78
  ```python
71
79
  response = client.send(
72
80
  model=TokenBeeModel.ANTHROPIC_CLAUDE_3_5_SONNET,
73
81
  input={
74
82
  "messages": [...],
75
- "compression": "on",
76
- "rate": CompressionRate.HIGH,
83
+ "compression": "auto", # "auto" (default), "on", or "off"
84
+ "rate": CompressionRate.HIGH, # MEDIUM (0.5), HIGH (0.33), etc.
77
85
  "privacy": True
78
86
  }
79
87
  )
80
88
  ```
81
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
+
82
96
  ### Supported Models
83
97
 
84
98
  The SDK provides a `TokenBeeModel` enum with popular models:
File without changes