tokenbee-sdk 0.2.0__tar.gz → 0.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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tokenbee-sdk
3
- Version: 0.2.0
3
+ Version: 0.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>
@@ -35,9 +35,11 @@ pip install tokenbee-sdk
35
35
  ```python
36
36
  from tokenbee import TokenBee, TokenBeeModel, CompressionRate
37
37
 
38
- # Initialize the client
38
+ # Initialize the client with your TokenBee API key
39
+ # AND your LLM provider key (Bring Your Own Key - BYOK)
39
40
  client = TokenBee(
40
- api_key="your_api_key_here",
41
+ api_key="your_tokenbee_api_key",
42
+ llm_key="your_llm_provider_key", # e.g. OpenAI or Anthropic key
41
43
  compression="auto",
42
44
  rate=CompressionRate.MEDIUM
43
45
  )
@@ -55,6 +57,10 @@ response = client.send(
55
57
  print(response["choices"][0]["message"]["content"])
56
58
  ```
57
59
 
60
+ ## Bring Your Own Key (BYOK)
61
+
62
+ TokenBee is a **stateless** gateway. We do not store your LLM provider API keys in our database. You pass your provider key (OpenAI, Anthropic, etc.) through the SDK's `llm_key` parameter. The SDK sends this in the `X-LLM-Key` header, allowing the TokenBee proxy to forward requests to the provider on your behalf while you maintain full control over your billing and security.
63
+
58
64
  ## Advanced Usage
59
65
 
60
66
  ### Compression Control
@@ -20,9 +20,11 @@ pip install tokenbee-sdk
20
20
  ```python
21
21
  from tokenbee import TokenBee, TokenBeeModel, CompressionRate
22
22
 
23
- # Initialize the client
23
+ # Initialize the client with your TokenBee API key
24
+ # AND your LLM provider key (Bring Your Own Key - BYOK)
24
25
  client = TokenBee(
25
- api_key="your_api_key_here",
26
+ api_key="your_tokenbee_api_key",
27
+ llm_key="your_llm_provider_key", # e.g. OpenAI or Anthropic key
26
28
  compression="auto",
27
29
  rate=CompressionRate.MEDIUM
28
30
  )
@@ -40,6 +42,10 @@ response = client.send(
40
42
  print(response["choices"][0]["message"]["content"])
41
43
  ```
42
44
 
45
+ ## Bring Your Own Key (BYOK)
46
+
47
+ TokenBee is a **stateless** gateway. We do not store your LLM provider API keys in our database. You pass your provider key (OpenAI, Anthropic, etc.) through the SDK's `llm_key` parameter. The SDK sends this in the `X-LLM-Key` header, allowing the TokenBee proxy to forward requests to the provider on your behalf while you maintain full control over your billing and security.
48
+
43
49
  ## Advanced Usage
44
50
 
45
51
  ### Compression Control
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tokenbee-sdk"
7
- version = "0.2.0"
7
+ version = "0.2.3"
8
8
  authors = [
9
9
  { name="TokenBee Inc.", email="founders@tokenbee.io" },
10
10
  ]
@@ -6,7 +6,7 @@ long_description = (this_directory / "README.md").read_text()
6
6
 
7
7
  setup(
8
8
  name="tokenbee-sdk",
9
- version="0.2.0",
9
+ version="0.2.3",
10
10
  packages=find_packages(),
11
11
  install_requires=["httpx>=0.23.0"],
12
12
  author="TokenBee Inc.",
@@ -52,7 +52,6 @@ class TokenBee:
52
52
  self,
53
53
  api_key: str,
54
54
  llm_key: str,
55
- base_url: str = "https://api.tokenbee.dev/v1",
56
55
  compression: str = "auto",
57
56
  rate: str = CompressionRate.MEDIUM,
58
57
  model: str = "",
@@ -61,7 +60,7 @@ class TokenBee:
61
60
  ):
62
61
  self.api_key = api_key
63
62
  self.llm_key = llm_key
64
- self.base_url = base_url
63
+ self._base_url = "https://tokenbee.io/v1"
65
64
  self.headers = {
66
65
  "Authorization": f"Bearer {api_key}",
67
66
  "X-LLM-Key": llm_key,
@@ -74,7 +73,7 @@ class TokenBee:
74
73
  if provider:
75
74
  self.headers["X-TokenBee-Provider"] = provider
76
75
 
77
- self.client = httpx.Client(headers=self.headers, base_url=self.base_url)
76
+ self.client = httpx.Client(headers=self.headers, base_url=self._base_url)
78
77
 
79
78
  def send(self, model: str, input: dict):
80
79
  parts = model.split("/")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tokenbee-sdk
3
- Version: 0.2.0
3
+ Version: 0.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>
@@ -35,9 +35,11 @@ pip install tokenbee-sdk
35
35
  ```python
36
36
  from tokenbee import TokenBee, TokenBeeModel, CompressionRate
37
37
 
38
- # Initialize the client
38
+ # Initialize the client with your TokenBee API key
39
+ # AND your LLM provider key (Bring Your Own Key - BYOK)
39
40
  client = TokenBee(
40
- api_key="your_api_key_here",
41
+ api_key="your_tokenbee_api_key",
42
+ llm_key="your_llm_provider_key", # e.g. OpenAI or Anthropic key
41
43
  compression="auto",
42
44
  rate=CompressionRate.MEDIUM
43
45
  )
@@ -55,6 +57,10 @@ response = client.send(
55
57
  print(response["choices"][0]["message"]["content"])
56
58
  ```
57
59
 
60
+ ## Bring Your Own Key (BYOK)
61
+
62
+ TokenBee is a **stateless** gateway. We do not store your LLM provider API keys in our database. You pass your provider key (OpenAI, Anthropic, etc.) through the SDK's `llm_key` parameter. The SDK sends this in the `X-LLM-Key` header, allowing the TokenBee proxy to forward requests to the provider on your behalf while you maintain full control over your billing and security.
63
+
58
64
  ## Advanced Usage
59
65
 
60
66
  ### Compression Control
File without changes