tldrapi 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.
tldrapi-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UnityCubed / TLDRapi
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.
tldrapi-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,210 @@
1
+ Metadata-Version: 2.4
2
+ Name: tldrapi
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the TLDRapi summarization API. Summarize text at 5 quality tiers with 20+ built-in voice styles.
5
+ Author-email: Ehren Biglari <unitycubedapps@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://unitycubed.com/tldrapi
8
+ Project-URL: Documentation, https://unitycubed.com/tldrapi/docs
9
+ Project-URL: Repository, https://github.com/unitycubedapps/tldrapi-python
10
+ Project-URL: Issues, https://github.com/unitycubedapps/tldrapi-python/issues
11
+ Keywords: tldrapi,summarize,summarizer,summary,tldr,abstract,llm,ai,nlp
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: Text Processing :: Linguistic
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: httpx<1.0,>=0.24
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7; extra == "dev"
32
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
33
+ Requires-Dist: respx>=0.20; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ > ### ⚠️ Service notice
37
+ >
38
+ > **The RapidAPI listing that backs this SDK is temporarily unavailable while we work through a launch-day issue. Please check back in a few days.**
39
+ # tldrapi — Python SDK for TLDRapi
40
+
41
+ Official Python client for [TLDRapi](https://tldrapi.com) — summarize any
42
+ content, in one API call. 5 quality tiers, 20+ built-in voice styles,
43
+ custom voices for paid tiers. Thin (one runtime dep: `httpx`), sync +
44
+ async, typed exceptions per error class.
45
+
46
+ **TLDRapi is distributed through the RapidAPI marketplace at launch.**
47
+ Subscribe to the TLDRapi listing on RapidAPI, get your `X-RapidAPI-Key`
48
+ from the RapidAPI dashboard, and pass it to the client.
49
+
50
+ ```bash
51
+ pip install tldrapi
52
+ ```
53
+
54
+ ## Get your app's RapidAPI key
55
+
56
+ 1. Sign in at [rapidapi.com](https://rapidapi.com)
57
+ 2. Subscribe to the [TLDRapi Summarizer](https://rapidapi.com/thunderAPIs256/api/tldrapi-summarizer) listing (start with **BASIC** — free)
58
+ 3. Go to **Console** (top nav) → **Applications** → **Add App** (or open an existing one)
59
+ 4. In the App → **Authorizations** tab → click the copy icon next to your Authorization Key
60
+
61
+ That's the app's `X-RapidAPI-Key`. Pass it to the SDK constructor.
62
+
63
+ *Legacy path (deprecated): upper-right (?) → Legacy Developer Dashboard → Add New App → Authorization tab. The new Console path above is simpler.*
64
+
65
+ The Authorization Key field is the same value in both places — RapidAPI just labels it differently depending on which interface you use:
66
+
67
+ **New Console:**
68
+
69
+ ![RapidAPI Console — Authorization Method labeled "RAPIDAPI"](https://raw.githubusercontent.com/unitycubed/tldrapi-docs/main/img/rapidapi-key-label-console.png)
70
+
71
+ **Legacy Developer Dashboard:**
72
+
73
+ ![RapidAPI Legacy Developer Dashboard — Authorization Method labeled "API key"](https://raw.githubusercontent.com/unitycubed/tldrapi-docs/main/img/rapidapi-key-label-legacy.png)
74
+
75
+
76
+
77
+ ## Quick start
78
+
79
+ ```python
80
+ from tldrapi import TLDRapi
81
+
82
+ client = TLDRapi(rapidapi_key="YOUR_RAPIDAPI_KEY")
83
+ result = client.summarize("Long text here...", tier="standard")
84
+ print(result.summary)
85
+ print(f"Credits remaining: {result.credits.get('remaining')}")
86
+ ```
87
+
88
+ ## Async
89
+
90
+ ```python
91
+ import asyncio
92
+ from tldrapi import AsyncTLDRapi
93
+
94
+ async def main():
95
+ async with AsyncTLDRapi(rapidapi_key="YOUR_RAPIDAPI_KEY") as client:
96
+ r = await client.summarize("Long text here...", tier="deep")
97
+ print(r.summary)
98
+
99
+ asyncio.run(main())
100
+ ```
101
+
102
+ ## Quality tiers
103
+
104
+ Pass `tier="quick" | "standard" | "deep" | "premium" | "ultra"` per
105
+ call. Higher tier → higher quality, more credits, larger allowed input.
106
+
107
+ | Tier | Credits/call | Max input tokens | Best for |
108
+ |-----------|-------------:|-----------------:|-----------------------------------|
109
+ | quick | 1 | 4,000 | Short texts, previews |
110
+ | standard | 5 | 16,000 | Default |
111
+ | deep | 30 | 32,000 | Longer content, deeper reasoning |
112
+ | premium | 110 | 64,000 | Substantial documents |
113
+ | ultra | 400 | 100,000 | Long-form / research-grade |
114
+
115
+ Live rates: `client.rates()`.
116
+
117
+ ## Session pinning
118
+
119
+ If you're processing a batch and want the same underlying model for
120
+ every call, pass `session_id` from the previous result:
121
+
122
+ ```python
123
+ r1 = client.summarize("Doc 1")
124
+ r2 = client.summarize("Doc 2", session_id=r1.session_id)
125
+ r3 = client.summarize("Doc 3", session_id=r1.session_id)
126
+ ```
127
+
128
+ ## Error handling
129
+
130
+ All SDK exceptions inherit from `TLDRapiError`. Catch specifically:
131
+
132
+ ```python
133
+ from tldrapi import (
134
+ TLDRapi,
135
+ InsufficientCreditsError,
136
+ RateLimitError,
137
+ LanguageNotSupportedError,
138
+ QualitySelectionRequiresPaidPlanError,
139
+ ServerError,
140
+ TimeoutError,
141
+ )
142
+
143
+ client = TLDRapi(rapidapi_key="YOUR_RAPIDAPI_KEY")
144
+
145
+ try:
146
+ r = client.summarize(user_text, tier="deep")
147
+ except InsufficientCreditsError as e:
148
+ top_up_url = e.response_body.get("options", {}).get("top_up", {}).get("url")
149
+ # …present top-up flow to your user…
150
+ except RateLimitError as e:
151
+ time.sleep(e.retry_after_seconds or 60)
152
+ # …retry once the plan window resets…
153
+ except LanguageNotSupportedError as e:
154
+ lang = e.response_body.get("detected_language_name")
155
+ # …English-only at launch; cross-lingual is a Month 2-3 feature…
156
+ except QualitySelectionRequiresPaidPlanError:
157
+ # Free plan can't select tiers; retry without tier=
158
+ r = client.summarize(user_text)
159
+ except TimeoutError:
160
+ # Long inputs on deep+ can legitimately need >60s. Retry with a bigger timeout.
161
+ r = client.summarize(user_text, tier="deep", timeout=120)
162
+ ```
163
+
164
+ Every error carries `.status_code`, `.request_id` (X-Request-ID from
165
+ the response — attach when reporting issues), and `.response_body`
166
+ (the full parsed JSON error body).
167
+
168
+ ## Configuration
169
+
170
+ ```python
171
+ client = TLDRapi(
172
+ rapidapi_key="YOUR_RAPIDAPI_KEY",
173
+ rapidapi_host="tldrapi-summarizer.p.rapidapi.com", # override to point at a staging listing
174
+ base_url=None, # default = https://{rapidapi_host}
175
+ timeout=60.0, # default 60s per request
176
+ retries=3, # 5xx + network retries, exponential backoff
177
+ )
178
+ ```
179
+
180
+ ## Retries
181
+
182
+ The client automatically retries **5xx** responses and transient
183
+ network failures with exponential backoff + jitter (default 3
184
+ attempts).
185
+
186
+ **Not retried**:
187
+ - **4xx responses** — permanent failures; retrying an
188
+ `insufficient_credits` would waste more of the same failing call.
189
+ - **429 rate-limit** — honor the server's `Retry-After` header. The
190
+ SDK exposes it on `RateLimitError.retry_after_seconds`.
191
+
192
+ ## Usage & rates
193
+
194
+ ```python
195
+ u = client.usage() # this month's calls, credits charged/remaining
196
+ r = client.rates() # current credits/call per tier
197
+ ```
198
+
199
+ ## Development
200
+
201
+ ```bash
202
+ pip install -e '.[dev]'
203
+ pytest -q # 20 tests, all HTTP mocked via respx
204
+ ```
205
+
206
+ ## License
207
+
208
+ Released under the MIT License — see [LICENSE](LICENSE).
209
+
210
+ Copyright (c) 2026 Ehren Biglari / Unity Cubed.
@@ -0,0 +1,175 @@
1
+ > ### ⚠️ Service notice
2
+ >
3
+ > **The RapidAPI listing that backs this SDK is temporarily unavailable while we work through a launch-day issue. Please check back in a few days.**
4
+ # tldrapi — Python SDK for TLDRapi
5
+
6
+ Official Python client for [TLDRapi](https://tldrapi.com) — summarize any
7
+ content, in one API call. 5 quality tiers, 20+ built-in voice styles,
8
+ custom voices for paid tiers. Thin (one runtime dep: `httpx`), sync +
9
+ async, typed exceptions per error class.
10
+
11
+ **TLDRapi is distributed through the RapidAPI marketplace at launch.**
12
+ Subscribe to the TLDRapi listing on RapidAPI, get your `X-RapidAPI-Key`
13
+ from the RapidAPI dashboard, and pass it to the client.
14
+
15
+ ```bash
16
+ pip install tldrapi
17
+ ```
18
+
19
+ ## Get your app's RapidAPI key
20
+
21
+ 1. Sign in at [rapidapi.com](https://rapidapi.com)
22
+ 2. Subscribe to the [TLDRapi Summarizer](https://rapidapi.com/thunderAPIs256/api/tldrapi-summarizer) listing (start with **BASIC** — free)
23
+ 3. Go to **Console** (top nav) → **Applications** → **Add App** (or open an existing one)
24
+ 4. In the App → **Authorizations** tab → click the copy icon next to your Authorization Key
25
+
26
+ That's the app's `X-RapidAPI-Key`. Pass it to the SDK constructor.
27
+
28
+ *Legacy path (deprecated): upper-right (?) → Legacy Developer Dashboard → Add New App → Authorization tab. The new Console path above is simpler.*
29
+
30
+ The Authorization Key field is the same value in both places — RapidAPI just labels it differently depending on which interface you use:
31
+
32
+ **New Console:**
33
+
34
+ ![RapidAPI Console — Authorization Method labeled "RAPIDAPI"](https://raw.githubusercontent.com/unitycubed/tldrapi-docs/main/img/rapidapi-key-label-console.png)
35
+
36
+ **Legacy Developer Dashboard:**
37
+
38
+ ![RapidAPI Legacy Developer Dashboard — Authorization Method labeled "API key"](https://raw.githubusercontent.com/unitycubed/tldrapi-docs/main/img/rapidapi-key-label-legacy.png)
39
+
40
+
41
+
42
+ ## Quick start
43
+
44
+ ```python
45
+ from tldrapi import TLDRapi
46
+
47
+ client = TLDRapi(rapidapi_key="YOUR_RAPIDAPI_KEY")
48
+ result = client.summarize("Long text here...", tier="standard")
49
+ print(result.summary)
50
+ print(f"Credits remaining: {result.credits.get('remaining')}")
51
+ ```
52
+
53
+ ## Async
54
+
55
+ ```python
56
+ import asyncio
57
+ from tldrapi import AsyncTLDRapi
58
+
59
+ async def main():
60
+ async with AsyncTLDRapi(rapidapi_key="YOUR_RAPIDAPI_KEY") as client:
61
+ r = await client.summarize("Long text here...", tier="deep")
62
+ print(r.summary)
63
+
64
+ asyncio.run(main())
65
+ ```
66
+
67
+ ## Quality tiers
68
+
69
+ Pass `tier="quick" | "standard" | "deep" | "premium" | "ultra"` per
70
+ call. Higher tier → higher quality, more credits, larger allowed input.
71
+
72
+ | Tier | Credits/call | Max input tokens | Best for |
73
+ |-----------|-------------:|-----------------:|-----------------------------------|
74
+ | quick | 1 | 4,000 | Short texts, previews |
75
+ | standard | 5 | 16,000 | Default |
76
+ | deep | 30 | 32,000 | Longer content, deeper reasoning |
77
+ | premium | 110 | 64,000 | Substantial documents |
78
+ | ultra | 400 | 100,000 | Long-form / research-grade |
79
+
80
+ Live rates: `client.rates()`.
81
+
82
+ ## Session pinning
83
+
84
+ If you're processing a batch and want the same underlying model for
85
+ every call, pass `session_id` from the previous result:
86
+
87
+ ```python
88
+ r1 = client.summarize("Doc 1")
89
+ r2 = client.summarize("Doc 2", session_id=r1.session_id)
90
+ r3 = client.summarize("Doc 3", session_id=r1.session_id)
91
+ ```
92
+
93
+ ## Error handling
94
+
95
+ All SDK exceptions inherit from `TLDRapiError`. Catch specifically:
96
+
97
+ ```python
98
+ from tldrapi import (
99
+ TLDRapi,
100
+ InsufficientCreditsError,
101
+ RateLimitError,
102
+ LanguageNotSupportedError,
103
+ QualitySelectionRequiresPaidPlanError,
104
+ ServerError,
105
+ TimeoutError,
106
+ )
107
+
108
+ client = TLDRapi(rapidapi_key="YOUR_RAPIDAPI_KEY")
109
+
110
+ try:
111
+ r = client.summarize(user_text, tier="deep")
112
+ except InsufficientCreditsError as e:
113
+ top_up_url = e.response_body.get("options", {}).get("top_up", {}).get("url")
114
+ # …present top-up flow to your user…
115
+ except RateLimitError as e:
116
+ time.sleep(e.retry_after_seconds or 60)
117
+ # …retry once the plan window resets…
118
+ except LanguageNotSupportedError as e:
119
+ lang = e.response_body.get("detected_language_name")
120
+ # …English-only at launch; cross-lingual is a Month 2-3 feature…
121
+ except QualitySelectionRequiresPaidPlanError:
122
+ # Free plan can't select tiers; retry without tier=
123
+ r = client.summarize(user_text)
124
+ except TimeoutError:
125
+ # Long inputs on deep+ can legitimately need >60s. Retry with a bigger timeout.
126
+ r = client.summarize(user_text, tier="deep", timeout=120)
127
+ ```
128
+
129
+ Every error carries `.status_code`, `.request_id` (X-Request-ID from
130
+ the response — attach when reporting issues), and `.response_body`
131
+ (the full parsed JSON error body).
132
+
133
+ ## Configuration
134
+
135
+ ```python
136
+ client = TLDRapi(
137
+ rapidapi_key="YOUR_RAPIDAPI_KEY",
138
+ rapidapi_host="tldrapi-summarizer.p.rapidapi.com", # override to point at a staging listing
139
+ base_url=None, # default = https://{rapidapi_host}
140
+ timeout=60.0, # default 60s per request
141
+ retries=3, # 5xx + network retries, exponential backoff
142
+ )
143
+ ```
144
+
145
+ ## Retries
146
+
147
+ The client automatically retries **5xx** responses and transient
148
+ network failures with exponential backoff + jitter (default 3
149
+ attempts).
150
+
151
+ **Not retried**:
152
+ - **4xx responses** — permanent failures; retrying an
153
+ `insufficient_credits` would waste more of the same failing call.
154
+ - **429 rate-limit** — honor the server's `Retry-After` header. The
155
+ SDK exposes it on `RateLimitError.retry_after_seconds`.
156
+
157
+ ## Usage & rates
158
+
159
+ ```python
160
+ u = client.usage() # this month's calls, credits charged/remaining
161
+ r = client.rates() # current credits/call per tier
162
+ ```
163
+
164
+ ## Development
165
+
166
+ ```bash
167
+ pip install -e '.[dev]'
168
+ pytest -q # 20 tests, all HTTP mocked via respx
169
+ ```
170
+
171
+ ## License
172
+
173
+ Released under the MIT License — see [LICENSE](LICENSE).
174
+
175
+ Copyright (c) 2026 Ehren Biglari / Unity Cubed.
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tldrapi"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for the TLDRapi summarization API. Summarize text at 5 quality tiers with 20+ built-in voice styles."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "Ehren Biglari", email = "unitycubedapps@gmail.com" }]
13
+ keywords = ["tldrapi", "summarize", "summarizer", "summary", "tldr", "abstract", "llm", "ai", "nlp"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ "Topic :: Text Processing :: Linguistic",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = [
31
+ "httpx>=0.24,<1.0",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ dev = [
36
+ "pytest>=7",
37
+ "pytest-asyncio>=0.21",
38
+ "respx>=0.20",
39
+ ]
40
+
41
+ [project.urls]
42
+ Homepage = "https://unitycubed.com/tldrapi"
43
+ Documentation = "https://unitycubed.com/tldrapi/docs"
44
+ Repository = "https://github.com/unitycubedapps/tldrapi-python"
45
+ Issues = "https://github.com/unitycubedapps/tldrapi-python/issues"
46
+
47
+ [tool.setuptools.packages.find]
48
+ include = ["tldrapi*"]
49
+
50
+ [tool.pytest.ini_options]
51
+ asyncio_mode = "auto"
52
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+