tensorfeed 1.3.0__tar.gz → 1.19.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.
- {tensorfeed-1.3.0/tensorfeed.egg-info → tensorfeed-1.19.0}/PKG-INFO +53 -5
- tensorfeed-1.3.0/PKG-INFO → tensorfeed-1.19.0/README.md +272 -257
- {tensorfeed-1.3.0 → tensorfeed-1.19.0}/pyproject.toml +17 -2
- {tensorfeed-1.3.0 → tensorfeed-1.19.0}/tensorfeed/__init__.py +1 -1
- tensorfeed-1.19.0/tensorfeed/client.py +1279 -0
- tensorfeed-1.19.0/tensorfeed/crewai.py +174 -0
- tensorfeed-1.19.0/tensorfeed/langchain.py +257 -0
- tensorfeed-1.19.0/tensorfeed/llamaindex.py +132 -0
- tensorfeed-1.3.0/README.md → tensorfeed-1.19.0/tensorfeed.egg-info/PKG-INFO +305 -230
- {tensorfeed-1.3.0 → tensorfeed-1.19.0}/tensorfeed.egg-info/SOURCES.txt +3 -0
- tensorfeed-1.19.0/tensorfeed.egg-info/requires.txt +13 -0
- tensorfeed-1.3.0/tensorfeed/client.py +0 -549
- tensorfeed-1.3.0/tensorfeed.egg-info/requires.txt +0 -4
- {tensorfeed-1.3.0 → tensorfeed-1.19.0}/setup.cfg +0 -0
- {tensorfeed-1.3.0 → tensorfeed-1.19.0}/tensorfeed/web3_signer.py +0 -0
- {tensorfeed-1.3.0 → tensorfeed-1.19.0}/tensorfeed.egg-info/dependency_links.txt +0 -0
- {tensorfeed-1.3.0 → tensorfeed-1.19.0}/tensorfeed.egg-info/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tensorfeed
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: Python SDK for the TensorFeed.ai API: AI news, status, model pricing, premium history series +
|
|
3
|
+
Version: 1.19.0
|
|
4
|
+
Summary: Python SDK for the TensorFeed.ai API: AI news, status, model pricing, premium routing + history series + webhook watches, agent payments via USDC on Base (optional web3 auto-send)
|
|
5
5
|
Author-email: "TensorFeed.ai" <feedback@tensorfeed.ai>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://tensorfeed.ai
|
|
@@ -24,6 +24,12 @@ Description-Content-Type: text/markdown
|
|
|
24
24
|
Provides-Extra: web3
|
|
25
25
|
Requires-Dist: web3>=6.0; extra == "web3"
|
|
26
26
|
Requires-Dist: eth-account>=0.10; extra == "web3"
|
|
27
|
+
Provides-Extra: langchain
|
|
28
|
+
Requires-Dist: langchain-core>=0.3; extra == "langchain"
|
|
29
|
+
Provides-Extra: llamaindex
|
|
30
|
+
Requires-Dist: llama-index-core>=0.11; extra == "llamaindex"
|
|
31
|
+
Provides-Extra: crewai
|
|
32
|
+
Requires-Dist: crewai>=0.70; extra == "crewai"
|
|
27
33
|
|
|
28
34
|
# tensorfeed
|
|
29
35
|
|
|
@@ -117,6 +123,31 @@ diff = tf.history_compare(
|
|
|
117
123
|
)
|
|
118
124
|
print(f'{len(diff["changed"])} price changes, {len(diff["added"])} new models')
|
|
119
125
|
|
|
126
|
+
# Premium webhook watches (1 credit per registration, free reads)
|
|
127
|
+
created = tf.create_watch(
|
|
128
|
+
spec={
|
|
129
|
+
"type": "price",
|
|
130
|
+
"model": "Claude Opus 4.7",
|
|
131
|
+
"field": "blended",
|
|
132
|
+
"op": "lt",
|
|
133
|
+
"threshold": 30,
|
|
134
|
+
},
|
|
135
|
+
callback_url="https://agent.example.com/hook",
|
|
136
|
+
secret="any-shared-secret", # used to sign deliveries
|
|
137
|
+
)
|
|
138
|
+
watch_id = created["watch"]["id"]
|
|
139
|
+
print(f"Watch {watch_id} active until {created['watch']['expires_at']}")
|
|
140
|
+
|
|
141
|
+
# When a delivery arrives, verify it:
|
|
142
|
+
# sig = request.headers["X-TensorFeed-Signature"] # "sha256=<hex>"
|
|
143
|
+
# import hmac, hashlib
|
|
144
|
+
# expected = "sha256=" + hmac.new(b"any-shared-secret", body, hashlib.sha256).hexdigest()
|
|
145
|
+
# assert hmac.compare_digest(sig, expected)
|
|
146
|
+
|
|
147
|
+
print(tf.list_watches()) # see all your active watches
|
|
148
|
+
print(tf.get_watch(watch_id)) # check fire_count, last_fired_at
|
|
149
|
+
tf.delete_watch(watch_id) # remove when done
|
|
150
|
+
|
|
120
151
|
# Check remaining credits
|
|
121
152
|
print(tf.balance())
|
|
122
153
|
```
|
|
@@ -212,11 +243,24 @@ except TensorFeedError as e:
|
|
|
212
243
|
| Method | Cost | Description |
|
|
213
244
|
|--------|------|-------------|
|
|
214
245
|
| `tf.balance()` | Free | Check remaining credits |
|
|
246
|
+
| `tf.usage()` | Free | Per-token call history (last 100 calls aggregated by endpoint) |
|
|
215
247
|
| `tf.routing(task=, budget=, top_n=, weights=)` | 1 credit | Top-N ranked routing with full detail |
|
|
216
248
|
| `tf.pricing_series(model=, from_date=, to_date=)` | 1 credit | Daily price points for one model with min/max/delta summary |
|
|
217
249
|
| `tf.benchmark_series(model=, benchmark=, from_date=, to_date=)` | 1 credit | Score evolution for a benchmark on one model, returns delta_pp |
|
|
218
250
|
| `tf.status_uptime(provider=, from_date=, to_date=)` | 1 credit | Uptime % per provider with incident days (degraded = half) |
|
|
219
251
|
| `tf.history_compare(from_date=, to_date=, snapshot_type=)` | 1 credit | Diff two snapshots: added, removed, changed entries with deltas |
|
|
252
|
+
| `tf.create_watch(spec=, callback_url=, secret=, fire_cap=)` | 1 credit | Register a webhook watch (price / status / digest) |
|
|
253
|
+
| `tf.create_digest_watch(cadence=, callback_url=, secret=, fire_cap=)` | 1 credit | Convenience: scheduled daily/weekly digest of pricing changes |
|
|
254
|
+
| `tf.list_watches()` | Free | List all active watches owned by the current token |
|
|
255
|
+
| `tf.get_watch(watch_id)` | Free | Read one watch including fire_count and last_fired_at |
|
|
256
|
+
| `tf.delete_watch(watch_id)` | Free | Remove an owned watch |
|
|
257
|
+
| `tf.premium_agents_directory(category=, status=, sort=, limit=, ...)` | 1 credit | Enriched directory: status, news, traffic, pricing, trending_score per agent |
|
|
258
|
+
| `tf.news_search(q=, from_date=, to_date=, provider=, category=, limit=)` | 1 credit | Full-text news search with date/provider filters, relevance scoring, recency boost |
|
|
259
|
+
| `tf.cost_projection(models=, input_tokens_per_day=, output_tokens_per_day=, horizon=)` | 1 credit | Project workload cost across 1-10 models, 4 horizons, cheapest-monthly ranking |
|
|
260
|
+
| `tf.forecast(target=, model=, field=, benchmark=, lookback=, horizon=)` | 1 credit | Linear-regression forecast for a price or benchmark series with 95% CI and confidence label |
|
|
261
|
+
| `tf.provider_deepdive(provider)` | 1 credit | One provider's full profile: status + all models + benchmarks joined + news + traffic |
|
|
262
|
+
| `tf.compare_models(ids=)` | 1 credit | Side-by-side compare of 2-5 models with normalized benchmarks + rankings |
|
|
263
|
+
| `tf.whats_new(days=, news_limit=)` | 1 credit | Agent morning brief: pricing changes + incidents + top news from last 1-7 days |
|
|
220
264
|
|
|
221
265
|
### Auto-send (requires `tensorfeed[web3]`)
|
|
222
266
|
|
|
@@ -239,11 +283,15 @@ If any source disagrees, do not send.
|
|
|
239
283
|
|
|
240
284
|
## Premium Data Terms
|
|
241
285
|
|
|
242
|
-
Premium API responses are licensed for inference use only. Use of TensorFeed premium data for training, fine-tuning, evaluation, or distillation of ML models is prohibited.
|
|
286
|
+
Premium API responses are licensed for inference use only. Use of TensorFeed premium data for training, fine-tuning, evaluation, or distillation of ML models is prohibited (Section 17.1 of the [Terms](https://tensorfeed.ai/terms#premium)).
|
|
287
|
+
|
|
288
|
+
## No refunds; credits do not expire
|
|
289
|
+
|
|
290
|
+
All credit purchases are final and non-refundable per Section 17.5 of the [Terms](https://tensorfeed.ai/terms#premium). Credits never expire and are jointly redeemable on tensorfeed.ai and terminalfeed.io. The recommended pattern is to buy in small increments (for example, $1 USDC for 50 credits) until call volume is calibrated, then top up as needed.
|
|
243
291
|
|
|
244
|
-
##
|
|
292
|
+
## Sanctions
|
|
245
293
|
|
|
246
|
-
|
|
294
|
+
Premium API access is unavailable to persons or entities subject to OFAC, EU, UK, or UN sanctions, and to residents of comprehensively sanctioned jurisdictions (Cuba, Iran, North Korea, Syria, Crimea, Donetsk, Luhansk). Inbound credit-purchase transactions are screened against the Chainalysis public sanctions API. See Section 17.9 of the [Terms](https://tensorfeed.ai/terms#premium).
|
|
247
295
|
|
|
248
296
|
## Links
|
|
249
297
|
|
|
@@ -1,257 +1,272 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
print(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
print(f
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
print(f
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
)
|
|
145
|
-
print(result["
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
tf
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
|
194
|
-
|
|
195
|
-
| `tf.
|
|
196
|
-
| `tf.
|
|
197
|
-
| `tf.
|
|
198
|
-
| `tf.
|
|
199
|
-
| `tf.
|
|
200
|
-
| `tf.
|
|
201
|
-
| `tf.
|
|
202
|
-
| `tf.
|
|
203
|
-
| `tf.
|
|
204
|
-
| `tf.
|
|
205
|
-
| `tf.
|
|
206
|
-
| `tf.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
|
213
|
-
|
|
214
|
-
| `tf.
|
|
215
|
-
| `tf.
|
|
216
|
-
| `tf.
|
|
217
|
-
| `tf.
|
|
218
|
-
| `tf.
|
|
219
|
-
| `tf.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
|
224
|
-
|
|
225
|
-
| `tf.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
- [
|
|
254
|
-
|
|
255
|
-
##
|
|
256
|
-
|
|
257
|
-
|
|
1
|
+
# tensorfeed
|
|
2
|
+
|
|
3
|
+
Python SDK for the [TensorFeed.ai](https://tensorfeed.ai) API.
|
|
4
|
+
|
|
5
|
+
Free endpoints (news, status, models, benchmarks, history, routing preview) need no auth. The premium tier (top-N routing, plus more endpoints landing later) is paid via USDC on Base. No accounts, no API keys, no traditional payment processors.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install tensorfeed
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Stdlib-only. No external dependencies.
|
|
14
|
+
|
|
15
|
+
## Free Tier
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from tensorfeed import TensorFeed
|
|
19
|
+
|
|
20
|
+
tf = TensorFeed()
|
|
21
|
+
|
|
22
|
+
# News
|
|
23
|
+
for article in tf.news(category="research", limit=10)["articles"]:
|
|
24
|
+
print(article["title"])
|
|
25
|
+
|
|
26
|
+
# Live AI service status
|
|
27
|
+
for svc in tf.status()["services"]:
|
|
28
|
+
print(f'{svc["name"]}: {svc["status"]}')
|
|
29
|
+
|
|
30
|
+
# Is a service down?
|
|
31
|
+
print(tf.is_down("claude"))
|
|
32
|
+
|
|
33
|
+
# Model pricing and benchmarks
|
|
34
|
+
print(tf.models())
|
|
35
|
+
print(tf.benchmarks())
|
|
36
|
+
|
|
37
|
+
# Daily history snapshots (the moat)
|
|
38
|
+
print(tf.history()) # list of available dates
|
|
39
|
+
print(tf.history_snapshot("2026-04-27", "pricing"))
|
|
40
|
+
|
|
41
|
+
# Free routing preview (top-1 model, 5 calls/day per IP)
|
|
42
|
+
preview = tf.routing_preview(task="code")
|
|
43
|
+
print(preview["recommendation"])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Premium Tier (paid, USDC on Base)
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from tensorfeed import TensorFeed, PaymentRequired
|
|
50
|
+
|
|
51
|
+
tf = TensorFeed()
|
|
52
|
+
|
|
53
|
+
# Step 1: get a 30-minute quote
|
|
54
|
+
quote = tf.buy_credits(amount_usd=1.00)
|
|
55
|
+
print(f"Send {quote['amount_usd']} USDC on Base to {quote['wallet']}")
|
|
56
|
+
print(f"Memo: {quote['memo']} (expires in {quote['ttl_seconds']}s)")
|
|
57
|
+
print(f"Will get: {quote['credits']} credits")
|
|
58
|
+
|
|
59
|
+
# Step 2: send the USDC tx with your wallet
|
|
60
|
+
# (auto-send via web3 is on the roadmap; for v1.1 you sign and send manually)
|
|
61
|
+
|
|
62
|
+
# Step 3: confirm with the tx hash
|
|
63
|
+
result = tf.confirm(tx_hash="0xYOUR_TX_HASH", nonce=quote["memo"])
|
|
64
|
+
print(f"Got {result['credits']} credits, token: {result['token']}")
|
|
65
|
+
# The token is also stored on `tf` automatically; routing() will use it.
|
|
66
|
+
|
|
67
|
+
# Step 4: call premium endpoints
|
|
68
|
+
rec = tf.routing(task="code", budget=5.0, top_n=5)
|
|
69
|
+
for r in rec["recommendations"]:
|
|
70
|
+
print(f'#{r["rank"]}: {r["model"]["name"]} (score: {r["composite_score"]:.2f})')
|
|
71
|
+
|
|
72
|
+
# Custom routing weights
|
|
73
|
+
rec = tf.routing(
|
|
74
|
+
task="general",
|
|
75
|
+
weights={"quality": 0.6, "cost": 0.3, "availability": 0.1, "latency": 0.0},
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Premium history series (1 credit each, range default = last 30 days, max 90)
|
|
79
|
+
prices = tf.pricing_series(model="Claude Opus 4.7")
|
|
80
|
+
print(f'Price changed {prices["summary"]["delta_pct_blended"]}% over the window')
|
|
81
|
+
|
|
82
|
+
scores = tf.benchmark_series(model="Claude Opus 4.7", benchmark="swe_bench")
|
|
83
|
+
print(f'SWE-bench moved {scores["summary"]["delta_pp"]} pp')
|
|
84
|
+
|
|
85
|
+
uptime = tf.status_uptime(provider="anthropic")
|
|
86
|
+
print(f'Anthropic uptime: {uptime["uptime_pct"]}% over {uptime["days_with_data"]} days')
|
|
87
|
+
|
|
88
|
+
diff = tf.history_compare(
|
|
89
|
+
from_date="2026-04-01", to_date="2026-04-27", snapshot_type="pricing",
|
|
90
|
+
)
|
|
91
|
+
print(f'{len(diff["changed"])} price changes, {len(diff["added"])} new models')
|
|
92
|
+
|
|
93
|
+
# Premium webhook watches (1 credit per registration, free reads)
|
|
94
|
+
created = tf.create_watch(
|
|
95
|
+
spec={
|
|
96
|
+
"type": "price",
|
|
97
|
+
"model": "Claude Opus 4.7",
|
|
98
|
+
"field": "blended",
|
|
99
|
+
"op": "lt",
|
|
100
|
+
"threshold": 30,
|
|
101
|
+
},
|
|
102
|
+
callback_url="https://agent.example.com/hook",
|
|
103
|
+
secret="any-shared-secret", # used to sign deliveries
|
|
104
|
+
)
|
|
105
|
+
watch_id = created["watch"]["id"]
|
|
106
|
+
print(f"Watch {watch_id} active until {created['watch']['expires_at']}")
|
|
107
|
+
|
|
108
|
+
# When a delivery arrives, verify it:
|
|
109
|
+
# sig = request.headers["X-TensorFeed-Signature"] # "sha256=<hex>"
|
|
110
|
+
# import hmac, hashlib
|
|
111
|
+
# expected = "sha256=" + hmac.new(b"any-shared-secret", body, hashlib.sha256).hexdigest()
|
|
112
|
+
# assert hmac.compare_digest(sig, expected)
|
|
113
|
+
|
|
114
|
+
print(tf.list_watches()) # see all your active watches
|
|
115
|
+
print(tf.get_watch(watch_id)) # check fire_count, last_fired_at
|
|
116
|
+
tf.delete_watch(watch_id) # remove when done
|
|
117
|
+
|
|
118
|
+
# Check remaining credits
|
|
119
|
+
print(tf.balance())
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Auto-Send (optional, web3 extra)
|
|
123
|
+
|
|
124
|
+
The base SDK keeps you dependency-free, but if you want to skip the manual tx step, install with the `web3` extra:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pip install 'tensorfeed[web3]'
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Then `tf.purchase_credits()` quotes, signs, broadcasts, and confirms in one call:
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
import os
|
|
134
|
+
from tensorfeed import TensorFeed
|
|
135
|
+
|
|
136
|
+
tf = TensorFeed()
|
|
137
|
+
|
|
138
|
+
result = tf.purchase_credits(
|
|
139
|
+
amount_usd=1.00,
|
|
140
|
+
private_key=os.environ["TENSORFEED_PRIVATE_KEY"], # NEVER hardcode
|
|
141
|
+
# rpc_url="https://base-mainnet.g.alchemy.com/v2/<key>", # optional
|
|
142
|
+
)
|
|
143
|
+
print(result["token"]) # auto-stored on tf
|
|
144
|
+
print(result["tx_hash"]) # for your records
|
|
145
|
+
print(result["credits"]) # how many credits were minted
|
|
146
|
+
|
|
147
|
+
# Token already on tf, so:
|
|
148
|
+
rec = tf.routing(task="code")
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Security: read the key from a secret manager or env var. Never commit it. The raw key is held in memory only for the duration of one signing call.
|
|
152
|
+
|
|
153
|
+
## Reusing a Token Across Sessions
|
|
154
|
+
|
|
155
|
+
Save the token after `confirm()`. Reuse it next time:
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
# Save once
|
|
159
|
+
token = result["token"]
|
|
160
|
+
|
|
161
|
+
# Reuse in another process / job
|
|
162
|
+
tf = TensorFeed(token=token)
|
|
163
|
+
print(tf.balance())
|
|
164
|
+
rec = tf.routing(task="code")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Error Handling
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from tensorfeed import TensorFeed, PaymentRequired, RateLimited, TensorFeedError
|
|
171
|
+
|
|
172
|
+
tf = TensorFeed(token="bad_token")
|
|
173
|
+
try:
|
|
174
|
+
tf.routing(task="code")
|
|
175
|
+
except PaymentRequired as e:
|
|
176
|
+
# 402: token invalid, expired, or out of credits
|
|
177
|
+
# e.payload contains wallet, credits required, top_up_at, etc.
|
|
178
|
+
print("Need to top up:", e.payload)
|
|
179
|
+
except RateLimited as e:
|
|
180
|
+
# 429: free preview tier hit its 5/day per-IP limit
|
|
181
|
+
print("Hit the rate limit:", e.payload)
|
|
182
|
+
except TensorFeedError as e:
|
|
183
|
+
# Other API errors
|
|
184
|
+
print("API error", e.status_code, e.payload)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## API Reference
|
|
188
|
+
|
|
189
|
+
### Free
|
|
190
|
+
|
|
191
|
+
| Method | Description |
|
|
192
|
+
|--------|-------------|
|
|
193
|
+
| `tf.news(category=, limit=)` | Latest AI news articles |
|
|
194
|
+
| `tf.status()` | Real-time AI service status |
|
|
195
|
+
| `tf.status_summary()` | Lightweight status summary |
|
|
196
|
+
| `tf.models()` | Model pricing and specs |
|
|
197
|
+
| `tf.benchmarks()` | Benchmark scores |
|
|
198
|
+
| `tf.is_down(service_name)` | Check if a specific service is down |
|
|
199
|
+
| `tf.agent_activity()` | Agent traffic metrics |
|
|
200
|
+
| `tf.history()` | List of available daily snapshot dates |
|
|
201
|
+
| `tf.history_snapshot(date, type)` | Read a specific snapshot |
|
|
202
|
+
| `tf.routing_preview(task=)` | Top-1 routing recommendation (5/day/IP) |
|
|
203
|
+
| `tf.health()` | API health check |
|
|
204
|
+
| `tf.payment_info()` | Wallet, pricing, supported payment flows |
|
|
205
|
+
| `tf.buy_credits(amount_usd=)` | Generate a 30-min payment quote |
|
|
206
|
+
| `tf.confirm(tx_hash=, nonce=)` | Verify USDC tx, mint credit token |
|
|
207
|
+
|
|
208
|
+
### Token-required
|
|
209
|
+
|
|
210
|
+
| Method | Cost | Description |
|
|
211
|
+
|--------|------|-------------|
|
|
212
|
+
| `tf.balance()` | Free | Check remaining credits |
|
|
213
|
+
| `tf.usage()` | Free | Per-token call history (last 100 calls aggregated by endpoint) |
|
|
214
|
+
| `tf.routing(task=, budget=, top_n=, weights=)` | 1 credit | Top-N ranked routing with full detail |
|
|
215
|
+
| `tf.pricing_series(model=, from_date=, to_date=)` | 1 credit | Daily price points for one model with min/max/delta summary |
|
|
216
|
+
| `tf.benchmark_series(model=, benchmark=, from_date=, to_date=)` | 1 credit | Score evolution for a benchmark on one model, returns delta_pp |
|
|
217
|
+
| `tf.status_uptime(provider=, from_date=, to_date=)` | 1 credit | Uptime % per provider with incident days (degraded = half) |
|
|
218
|
+
| `tf.history_compare(from_date=, to_date=, snapshot_type=)` | 1 credit | Diff two snapshots: added, removed, changed entries with deltas |
|
|
219
|
+
| `tf.create_watch(spec=, callback_url=, secret=, fire_cap=)` | 1 credit | Register a webhook watch (price / status / digest) |
|
|
220
|
+
| `tf.create_digest_watch(cadence=, callback_url=, secret=, fire_cap=)` | 1 credit | Convenience: scheduled daily/weekly digest of pricing changes |
|
|
221
|
+
| `tf.list_watches()` | Free | List all active watches owned by the current token |
|
|
222
|
+
| `tf.get_watch(watch_id)` | Free | Read one watch including fire_count and last_fired_at |
|
|
223
|
+
| `tf.delete_watch(watch_id)` | Free | Remove an owned watch |
|
|
224
|
+
| `tf.premium_agents_directory(category=, status=, sort=, limit=, ...)` | 1 credit | Enriched directory: status, news, traffic, pricing, trending_score per agent |
|
|
225
|
+
| `tf.news_search(q=, from_date=, to_date=, provider=, category=, limit=)` | 1 credit | Full-text news search with date/provider filters, relevance scoring, recency boost |
|
|
226
|
+
| `tf.cost_projection(models=, input_tokens_per_day=, output_tokens_per_day=, horizon=)` | 1 credit | Project workload cost across 1-10 models, 4 horizons, cheapest-monthly ranking |
|
|
227
|
+
| `tf.forecast(target=, model=, field=, benchmark=, lookback=, horizon=)` | 1 credit | Linear-regression forecast for a price or benchmark series with 95% CI and confidence label |
|
|
228
|
+
| `tf.provider_deepdive(provider)` | 1 credit | One provider's full profile: status + all models + benchmarks joined + news + traffic |
|
|
229
|
+
| `tf.compare_models(ids=)` | 1 credit | Side-by-side compare of 2-5 models with normalized benchmarks + rankings |
|
|
230
|
+
| `tf.whats_new(days=, news_limit=)` | 1 credit | Agent morning brief: pricing changes + incidents + top news from last 1-7 days |
|
|
231
|
+
|
|
232
|
+
### Auto-send (requires `tensorfeed[web3]`)
|
|
233
|
+
|
|
234
|
+
| Method | Description |
|
|
235
|
+
|--------|-------------|
|
|
236
|
+
| `tf.purchase_credits(amount_usd=, private_key=, rpc_url=)` | One-call quote + sign + broadcast + confirm. Returns token, credits, tx_hash, block_number. |
|
|
237
|
+
|
|
238
|
+
## Wallet & Trust
|
|
239
|
+
|
|
240
|
+
The TensorFeed payment wallet is `0x549c82e6bfc54bdae9a2073744cbc2af5d1fc6d1` on Base mainnet. USDC contract: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`.
|
|
241
|
+
|
|
242
|
+
Cross-check this address before sending funds at:
|
|
243
|
+
|
|
244
|
+
- https://tensorfeed.ai/llms.txt
|
|
245
|
+
- https://tensorfeed.ai/api/payment/info
|
|
246
|
+
- https://github.com/RipperMercs/tensorfeed (README)
|
|
247
|
+
- https://x.com/tensorfeed (bio)
|
|
248
|
+
|
|
249
|
+
If any source disagrees, do not send.
|
|
250
|
+
|
|
251
|
+
## Premium Data Terms
|
|
252
|
+
|
|
253
|
+
Premium API responses are licensed for inference use only. Use of TensorFeed premium data for training, fine-tuning, evaluation, or distillation of ML models is prohibited (Section 17.1 of the [Terms](https://tensorfeed.ai/terms#premium)).
|
|
254
|
+
|
|
255
|
+
## No refunds; credits do not expire
|
|
256
|
+
|
|
257
|
+
All credit purchases are final and non-refundable per Section 17.5 of the [Terms](https://tensorfeed.ai/terms#premium). Credits never expire and are jointly redeemable on tensorfeed.ai and terminalfeed.io. The recommended pattern is to buy in small increments (for example, $1 USDC for 50 credits) until call volume is calibrated, then top up as needed.
|
|
258
|
+
|
|
259
|
+
## Sanctions
|
|
260
|
+
|
|
261
|
+
Premium API access is unavailable to persons or entities subject to OFAC, EU, UK, or UN sanctions, and to residents of comprehensively sanctioned jurisdictions (Cuba, Iran, North Korea, Syria, Crimea, Donetsk, Luhansk). Inbound credit-purchase transactions are screened against the Chainalysis public sanctions API. See Section 17.9 of the [Terms](https://tensorfeed.ai/terms#premium).
|
|
262
|
+
|
|
263
|
+
## Links
|
|
264
|
+
|
|
265
|
+
- [API Docs](https://tensorfeed.ai/developers)
|
|
266
|
+
- [TensorFeed.ai](https://tensorfeed.ai)
|
|
267
|
+
- [GitHub](https://github.com/RipperMercs/tensorfeed)
|
|
268
|
+
- [Changelog](https://tensorfeed.ai/changelog)
|
|
269
|
+
|
|
270
|
+
## License
|
|
271
|
+
|
|
272
|
+
MIT
|