jents 0.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.
jents-0.1.0/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .eggs/
5
+ build/
6
+ dist/
7
+ .venv/
8
+ venv/
9
+ .env
jents-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jents
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
jents-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,73 @@
1
+ Metadata-Version: 2.4
2
+ Name: jents
3
+ Version: 0.1.0
4
+ Summary: Jents Capture — one line to capture your LLM usage (cost, tokens, latency) into Jents.
5
+ Project-URL: Homepage, https://jents.io
6
+ Project-URL: Documentation, https://app.jents.io/academy
7
+ Author-email: Jents <niv@jents.io>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai,anthropic,cost,jents,llm,observability,openai,telemetry
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Requires-Python: >=3.8
16
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20
17
+ Requires-Dist: opentelemetry-instrumentation-openai>=0.30
18
+ Requires-Dist: opentelemetry-sdk>=1.20
19
+ Provides-Extra: all
20
+ Requires-Dist: opentelemetry-instrumentation-anthropic>=0.30; extra == 'all'
21
+ Provides-Extra: anthropic
22
+ Requires-Dist: opentelemetry-instrumentation-anthropic>=0.30; extra == 'anthropic'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # jents
26
+
27
+ One line to capture your LLM usage — cost, tokens, latency — into [Jents](https://jents.io).
28
+
29
+ ```bash
30
+ pip install jents
31
+ ```
32
+
33
+ ```python
34
+ import jents
35
+ jents.init(api_key="<your ingest key>", team="<your team>")
36
+ ```
37
+
38
+ That's it. Your existing OpenAI / Anthropic calls are now captured automatically and
39
+ sent to your Jents workspace — attributed to the right team (and person, if you set
40
+ `user_id`). Only **metadata** is sent (model, tokens, cost, latency); your prompts and
41
+ responses never leave your process.
42
+
43
+ Get an ingest key in Jents: **Observability → Capture → Generate ingest key**.
44
+
45
+ ## Options
46
+
47
+ ```python
48
+ jents.init(
49
+ api_key="<your ingest key>", # required
50
+ team="Sales", # per-team cost rollups
51
+ user_id="alice@company.com", # optional per-person attribution
52
+ app_name="my-service", # optional service label
53
+ )
54
+ ```
55
+
56
+ Capture Anthropic calls too:
57
+
58
+ ```bash
59
+ pip install "jents[anthropic]"
60
+ ```
61
+
62
+ Self-hosting Jents? Point at your own endpoint:
63
+
64
+ ```python
65
+ jents.init(api_key="...", endpoint="https://jents.your-company.com/api/capture")
66
+ ```
67
+
68
+ ## How it works
69
+
70
+ `jents` is a thin convenience layer over the [OpenTelemetry](https://opentelemetry.io)
71
+ open standard: it configures an OTLP exporter aimed at your Jents Capture endpoint and
72
+ turns on auto-instrumentation for your LLM clients. It composes cleanly with any other
73
+ OpenTelemetry tracing you already run.
jents-0.1.0/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # jents
2
+
3
+ One line to capture your LLM usage — cost, tokens, latency — into [Jents](https://jents.io).
4
+
5
+ ```bash
6
+ pip install jents
7
+ ```
8
+
9
+ ```python
10
+ import jents
11
+ jents.init(api_key="<your ingest key>", team="<your team>")
12
+ ```
13
+
14
+ That's it. Your existing OpenAI / Anthropic calls are now captured automatically and
15
+ sent to your Jents workspace — attributed to the right team (and person, if you set
16
+ `user_id`). Only **metadata** is sent (model, tokens, cost, latency); your prompts and
17
+ responses never leave your process.
18
+
19
+ Get an ingest key in Jents: **Observability → Capture → Generate ingest key**.
20
+
21
+ ## Options
22
+
23
+ ```python
24
+ jents.init(
25
+ api_key="<your ingest key>", # required
26
+ team="Sales", # per-team cost rollups
27
+ user_id="alice@company.com", # optional per-person attribution
28
+ app_name="my-service", # optional service label
29
+ )
30
+ ```
31
+
32
+ Capture Anthropic calls too:
33
+
34
+ ```bash
35
+ pip install "jents[anthropic]"
36
+ ```
37
+
38
+ Self-hosting Jents? Point at your own endpoint:
39
+
40
+ ```python
41
+ jents.init(api_key="...", endpoint="https://jents.your-company.com/api/capture")
42
+ ```
43
+
44
+ ## How it works
45
+
46
+ `jents` is a thin convenience layer over the [OpenTelemetry](https://opentelemetry.io)
47
+ open standard: it configures an OTLP exporter aimed at your Jents Capture endpoint and
48
+ turns on auto-instrumentation for your LLM clients. It composes cleanly with any other
49
+ OpenTelemetry tracing you already run.
@@ -0,0 +1,36 @@
1
+ [project]
2
+ name = "jents"
3
+ version = "0.1.0"
4
+ description = "Jents Capture — one line to capture your LLM usage (cost, tokens, latency) into Jents."
5
+ readme = "README.md"
6
+ requires-python = ">=3.8"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "Jents", email = "niv@jents.io" }]
9
+ keywords = ["llm", "openai", "anthropic", "observability", "cost", "telemetry", "jents", "ai"]
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Operating System :: OS Independent",
14
+ "Topic :: Software Development :: Libraries",
15
+ ]
16
+ dependencies = [
17
+ "opentelemetry-sdk>=1.20",
18
+ "opentelemetry-exporter-otlp-proto-http>=1.20",
19
+ "opentelemetry-instrumentation-openai>=0.30",
20
+ ]
21
+
22
+ [project.optional-dependencies]
23
+ # Capture Anthropic calls too: `pip install "jents[anthropic]"`
24
+ anthropic = ["opentelemetry-instrumentation-anthropic>=0.30"]
25
+ all = ["opentelemetry-instrumentation-anthropic>=0.30"]
26
+
27
+ [project.urls]
28
+ Homepage = "https://jents.io"
29
+ Documentation = "https://app.jents.io/academy"
30
+
31
+ [build-system]
32
+ requires = ["hatchling"]
33
+ build-backend = "hatchling.build"
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["src/jents"]
@@ -0,0 +1,91 @@
1
+ """Jents Capture — one line to send your LLM usage to Jents.
2
+
3
+ import jents
4
+ jents.init(api_key="<your ingest key>", team="<your team>")
5
+
6
+ That's it. Your OpenAI / Anthropic calls are then captured automatically and sent
7
+ to your Jents workspace (model, tokens, cost, latency — never prompt/response
8
+ content). Get an ingest key in Jents under Observability → Capture → Generate
9
+ ingest key.
10
+
11
+ Built on the OpenTelemetry open standard; works alongside any other tracing you
12
+ already run.
13
+ """
14
+ from __future__ import annotations
15
+
16
+ import logging
17
+ from typing import Optional
18
+
19
+ __all__ = ["init", "__version__"]
20
+ __version__ = "0.1.0"
21
+
22
+ # The Jents cloud Capture endpoint. Pass `endpoint=` to point at a self-hosted Jents.
23
+ DEFAULT_ENDPOINT = "https://app.jents.io/api/capture"
24
+
25
+ _log = logging.getLogger("jents")
26
+ _initialized = False
27
+
28
+
29
+ def init(
30
+ api_key: str,
31
+ team: Optional[str] = None,
32
+ user_id: Optional[str] = None,
33
+ endpoint: str = DEFAULT_ENDPOINT,
34
+ app_name: Optional[str] = None,
35
+ ) -> None:
36
+ """Start capturing this process's LLM calls into Jents.
37
+
38
+ Args:
39
+ api_key: Your Jents ingest key (Observability → Capture → Generate ingest key).
40
+ team: Team this usage belongs to, e.g. "Sales" — drives per-team cost rollups.
41
+ user_id: Optional per-person attribution, e.g. an email.
42
+ endpoint: Jents Capture endpoint. Defaults to the Jents cloud.
43
+ app_name: Optional service name shown alongside the usage.
44
+
45
+ Safe to call once at startup; extra calls are ignored.
46
+ """
47
+ global _initialized
48
+ if _initialized:
49
+ return
50
+ if not api_key:
51
+ raise ValueError("jents.init: api_key is required — your Jents ingest key.")
52
+
53
+ from opentelemetry import trace
54
+ from opentelemetry.sdk.resources import Resource
55
+ from opentelemetry.sdk.trace import TracerProvider
56
+ from opentelemetry.sdk.trace.export import BatchSpanProcessor
57
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
58
+
59
+ attrs = {}
60
+ if app_name:
61
+ attrs["service.name"] = app_name
62
+ if team:
63
+ attrs["jents.team"] = team
64
+ if user_id:
65
+ attrs["jents.user_id"] = user_id
66
+ resource = Resource.create(attrs) if attrs else Resource.create({})
67
+
68
+ provider = TracerProvider(resource=resource)
69
+ exporter = OTLPSpanExporter(
70
+ endpoint=endpoint.rstrip("/") + "/v1/traces",
71
+ headers={"Authorization": "Bearer " + api_key},
72
+ )
73
+ provider.add_span_processor(BatchSpanProcessor(exporter))
74
+ trace.set_tracer_provider(provider)
75
+
76
+ _instrument()
77
+ _initialized = True
78
+ _log.debug("jents: capturing to %s", endpoint)
79
+
80
+
81
+ def _instrument() -> None:
82
+ """Best-effort auto-instrumentation for whatever LLM SDKs are installed."""
83
+ for module_name, class_name in (
84
+ ("opentelemetry.instrumentation.openai", "OpenAIInstrumentor"),
85
+ ("opentelemetry.instrumentation.anthropic", "AnthropicInstrumentor"),
86
+ ):
87
+ try:
88
+ module = __import__(module_name, fromlist=[class_name])
89
+ getattr(module, class_name)().instrument()
90
+ except Exception: # SDK not installed / instrumentation unavailable — skip quietly
91
+ continue