Skip to main content

tensorfeed

Python SDK for the TensorFeed.ai API.

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.

The single best model to use right now, as one signed call. Route Verdict fuses live pricing, contamination-discounted benchmark capability, real production usage, measured p95 latency probes, live incident state, and deprecation flags into one ranked decision, with an AFTA-signed receipt over the exact inputs. Instead of stitching together pricing pages, benchmark leaderboards, status dashboards, and your own latency tests, you get a current, defensible routing answer in one request.

Zero install, no key, one command (works today)

curl -s -A "tensorfeed-cc-quickstart" "https://tensorfeed.ai/api/preview/route-verdict?task=code"

Swap task for reasoning, creative, or general, or pass ?model=<id-or-name> to score a specific model. The free preview is 10 calls per day per IP, no token. Abridged real response:

{
  "verdict": {
    "rank": 1,
    "model": { "name": "Gemini 2.5 Pro", "provider": "google" },
    "pricing": { "blended": 5.625, "unit": "per 1M tokens" },
    "latency": { "measured_p95_ms": 1223, "source": "measured_probe" },
    "operational": { "ok": true, "status": "operational" },
    "composite_score": 0.8449,
    "why": "code quality 0.6498 after trust discount; corroborated by real usage (rank 5, 6.5% share, flat); measured p95 1223 ms; operational; blended $5.625 / 1M"
  },
  "rate_limit": { "limit": 10, "remaining": 9, "scope": "per IP per UTC day" },
  "upgrade": { "premium_endpoint": "/api/premium/route-verdict", "adds": ["runners_up", "AFTA-signed receipt", "filter params", "no rate limit"] }
}

The premium version (/api/premium/route-verdict, 1 credit) adds ranked runners-up, the constraint filters (max_latency_p95_ms, budget, min_quality, require_operational, exclude_deprecated), the AFTA-signed receipt, and no rate limit. It needs a token; credits come from tensorfeed.ai/developers/agent-payments.

Native SDK call

from tensorfeed import TensorFeed

tf = TensorFeed()

# Free preview: the top verdict only, no token. 10 calls/day per IP.
preview = tf.route_verdict_preview(task="code")
print(preview["verdict"]["model"]["name"], preview["verdict"]["why"])

# Premium: runners-up, constraint filters, and the AFTA-signed receipt.
# Needs a token (see the payment quickstart below).
tf_paid = TensorFeed(token="YOUR_TOKEN")
verdict = tf_paid.route_verdict(task="code", max_latency_p95_ms=1500)
print(verdict["verdict"], verdict["runners_up"])

Pass model="<id-or-name>" instead of task= to score one model. Both methods accept exactly one of the two selectors.

The agent path (MCP)

With the @tensorfeed/mcp-server MCP server installed, an agent gets two tools: route_verdict_preview (free, the pick plus reasoning) and route_verdict (1 credit, ranked runners-up, constraint filters, and the AFTA-signed receipt it can audit).

Why it matters

Models, prices, and latency move week to week. Route Verdict is one signed call an agent can act on now and later prove why it routed the way it did, without rebuilding the comparison from scratch each time.

Install

pip install tensorfeed

Stdlib-only. No external dependencies.

Free Tier

from tensorfeed import TensorFeed

tf = TensorFeed()

# News
for article in tf.news(category="research", limit=10)["articles"]:
    print(article["title"])

# Live AI service status
for svc in tf.status()["services"]:
    print(f'{svc["name"]}: {svc["status"]}')

# Is a service down?
print(tf.is_down("claude"))

# Model pricing and benchmarks
print(tf.models())
print(tf.benchmarks())

# Daily history snapshots (the moat)
print(tf.history())  # list of available dates
print(tf.history_snapshot("2026-04-27", "pricing"))

# Free routing preview (top-1 model, 5 calls/day per IP)
preview = tf.routing_preview(task="code")
print(preview["recommendation"])

Premium Tier (paid, USDC on Base)

import os
from eth_account import Account                      # pip install eth-account
from eth_account.messages import encode_defunct
from tensorfeed import TensorFeed, PaymentRequired

tf = TensorFeed()
acct = Account.from_key(os.environ["TENSORFEED_PRIVATE_KEY"])  # NEVER hardcode

# Step 1: get a 30-minute quote. sender_wallet is the Base wallet you will
# send the USDC from (required); quote['wallet'] below is where you send it.
# The server only quotes for a message signed by sender_wallet, so pass a
# signer: the SDK builds the message and calls it once.
quote = tf.buy_credits(
    amount_usd=1.00,
    sender_wallet=acct.address,
    sign_message=lambda m: acct.sign_message(encode_defunct(text=m)).signature.hex(),
)
print(f"Send {quote['amount_usd']} USDC on Base to {quote['wallet']}")
print(f"Memo: {quote['memo']} (expires in {quote['ttl_seconds']}s)")
print(f"Will get: {quote['credits']} credits")

# Step 2: send the USDC tx from sender_wallet
# (or let tf.purchase_credits() below do steps 1 to 3 for you)

# Step 3: confirm with the tx hash
result = tf.confirm(tx_hash="0xYOUR_TX_HASH", nonce=quote["memo"])
print(f"Got {result['credits']} credits, token: {result['token']}")
# The token is also stored on `tf` automatically; routing() will use it.

# Step 4: call premium endpoints
rec = tf.routing(task="code", budget=5.0, top_n=5)
for r in rec["recommendations"]:
    print(f'#{r["rank"]}: {r["model"]["name"]} (score: {r["composite_score"]:.2f})')

# Custom routing weights
rec = tf.routing(
    task="general",
    weights={"quality": 0.6, "cost": 0.3, "availability": 0.1, "latency": 0.0},
)

# Premium history series (1 credit each, range default = last 30 days, max 90)
prices = tf.pricing_series(model="Claude Opus 4.7")
print(f'Price changed {prices["summary"]["delta_pct_blended"]}% over the window')

scores = tf.benchmark_series(model="Claude Opus 4.7", benchmark="swe_bench")
print(f'SWE-bench moved {scores["summary"]["delta_pp"]} pp')

uptime = tf.status_uptime(provider="anthropic")
print(f'Anthropic uptime: {uptime["uptime_pct"]}% over {uptime["days_with_data"]} days')

# Premium webhook watches (1 credit per registration, free reads)
created = tf.create_watch(
    spec={
        "type": "price",
        "model": "Claude Opus 4.7",
        "field": "blended",
        "op": "lt",
        "threshold": 30,
    },
    callback_url="https://agent.example.com/hook",
    secret="any-shared-secret",  # used to sign deliveries
)
watch_id = created["watch"]["id"]
print(f"Watch {watch_id} active until {created['watch']['expires_at']}")

# When a delivery arrives, verify it:
#   sig = request.headers["X-TensorFeed-Signature"]  # "sha256=<hex>"
#   import hmac, hashlib
#   expected = "sha256=" + hmac.new(b"any-shared-secret", body, hashlib.sha256).hexdigest()
#   assert hmac.compare_digest(sig, expected)

print(tf.list_watches())          # see all your active watches
print(tf.get_watch(watch_id))     # check fire_count, last_fired_at
tf.delete_watch(watch_id)         # remove when done

# Check remaining credits
print(tf.balance())

Signing the quote request

buy_credits() requires proof that you control sender_wallet: an EIP-191 (personal_sign) signature by that wallet over this exact message, lines joined with \n:

I am requesting a TensorFeed credit quote for this wallet.

wallet: <sender_wallet, 0x address>
timestamp: <ISO 8601, within 10 minutes of now>
nonce: <16 to 64 hex chars, fresh per quote>

Pass sign_message= (any callable that takes the message string and returns a 0x hex signature) and the SDK fills in the timestamp and a random nonce. If your signer lives elsewhere (a hardware wallet, a remote signing service), build the message yourself and pass both halves:

from tensorfeed import build_quote_message

message = build_quote_message(wallet)          # timestamp=now, nonce=random
signature = my_remote_signer.personal_sign(message)
quote = tf.buy_credits(
    amount_usd=1.00, sender_wallet=wallet, message=message, signature=signature
)

Each signed message is good for one quote. The server answers sender_proof_expired for a stale timestamp, sender_proof_invalid when the signature does not match the wallet, and sender_proof_replayed for a reused nonce. Calling buy_credits() with no signer and no message raises ValueError before any request is sent.

Only an externally owned account (a plain private key) can produce this signature. Smart contract wallets cannot, and should pay per call through the x402 X-PAYMENT flow instead.

Auto-Send (optional, web3 extra)

The base SDK keeps you dependency-free, but if you want to skip the manual tx step, install with the web3 extra:

pip install 'tensorfeed[web3]'

Then tf.purchase_credits() quotes, signs, broadcasts, and confirms in one call. The same key signs the quote request message and the USDC transfer:

import os
from tensorfeed import TensorFeed

tf = TensorFeed()

result = tf.purchase_credits(
    amount_usd=1.00,
    private_key=os.environ["TENSORFEED_PRIVATE_KEY"],  # NEVER hardcode
    # rpc_url="https://base-mainnet.g.alchemy.com/v2/<key>",  # optional
)
print(result["token"])      # auto-stored on tf
print(result["tx_hash"])    # for your records
print(result["credits"])    # how many credits were minted

# Token already on tf, so:
rec = tf.routing(task="code")

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.

Reusing a Token Across Sessions

Save the token after confirm(). Reuse it next time:

# Save once
token = result["token"]

# Reuse in another process / job
tf = TensorFeed(token=token)
print(tf.balance())
rec = tf.routing(task="code")

Framework Tools (LangChain, CrewAI)

Drop TensorFeed into an agent framework as ready-made tools.

pip install 'tensorfeed[langchain]'   # or 'tensorfeed[crewai]'
from tensorfeed.langchain import tensorfeed_tools, tensorfeed_premium_tools

# Five free tools (news, status, attention, harnesses, routing preview)
free = tensorfeed_tools()

# Free plus the paid catalog (whats_new, full routing, compare models,
# cost projection, news search, provider deep dive, status leaderboard)
all_tools = tensorfeed_tools(token="YOUR_TOKEN", include_premium=True)

# Just the paid catalog
paid = tensorfeed_premium_tools(token="YOUR_TOKEN")

CrewAI is identical: from tensorfeed.crewai import tensorfeed_tools, tensorfeed_premium_tools.

The default tensorfeed_tools() stays free-only and unchanged, so existing code keeps working. Premium is opt-in via include_premium=True.

Payment posture. The premium tools never move funds. Attach them with or without a token: called without spendable credits they return a short, actionable guidance string (explaining that an operator provisions credits out of band) instead of paying or raising. There is no code path from a tool call to the wallet or the web3 signer. Credit purchases stay an explicit, per-action operator decision, by design. This is enforced in one shared module and covered by tests, including a static guard that fails if a future change introduces an autonomous-payment path.

Error Handling

from tensorfeed import TensorFeed, PaymentRequired, RateLimited, TensorFeedError

tf = TensorFeed(token="bad_token")
try:
    tf.routing(task="code")
except PaymentRequired as e:
    # 402: token invalid, expired, or out of credits
    # e.payload contains wallet, credits required, top_up_at, etc.
    print("Need to top up:", e.payload)
except RateLimited as e:
    # 429: free preview tier hit its 5/day per-IP limit
    print("Hit the rate limit:", e.payload)
except TensorFeedError as e:
    # Other API errors
    print("API error", e.status_code, e.payload)

API Reference

Free

Method Description
tf.news(category=, limit=) Latest AI news articles
tf.status() Real-time AI service status
tf.status_summary() Lightweight status summary
tf.models() Model pricing and specs
tf.benchmarks() Benchmark scores
tf.is_down(service_name) Check if a specific service is down
tf.agent_activity() Agent traffic metrics
tf.history() List of available daily snapshot dates
tf.history_snapshot(date, type) Read a specific snapshot
tf.routing_preview(task=) Top-1 routing recommendation (5/day/IP)
tf.health() API health check
tf.payment_info() Wallet, pricing, supported payment flows
tf.buy_credits(amount_usd=, sender_wallet=, sign_message=) Generate a 30-min payment quote (or pass message= and signature= instead of sign_message=)
build_quote_message(wallet, timestamp=, nonce=) Build the exact quote message sender_wallet signs
tf.confirm(tx_hash=, nonce=) Verify USDC tx, mint credit token

Token-required

Method Cost Description
tf.balance() Free Check remaining credits
tf.usage() Free Per-token call history (last 100 calls aggregated by endpoint)
tf.routing(task=, budget=, top_n=, weights=) 1 credit Top-N ranked routing with full detail
tf.pricing_series(model=, from_date=, to_date=) 1 credit Daily price points for one model with min/max/delta summary
tf.benchmark_series(model=, benchmark=, from_date=, to_date=) 1 credit Score evolution for a benchmark on one model, returns delta_pp
tf.status_uptime(provider=, from_date=, to_date=) 1 credit Uptime % per provider with incident days (degraded = half)
tf.create_watch(spec=, callback_url=, secret=, fire_cap=) 1 credit Register a webhook watch (price / status / digest)
tf.create_digest_watch(cadence=, callback_url=, secret=, fire_cap=) 1 credit Convenience: scheduled daily/weekly digest of pricing changes
tf.list_watches() Free List all active watches owned by the current token
tf.get_watch(watch_id) Free Read one watch including fire_count and last_fired_at
tf.delete_watch(watch_id) Free Remove an owned watch
tf.premium_agents_directory(category=, status=, sort=, limit=, ...) 1 credit Enriched directory: status, news, traffic, pricing, trending_score per agent
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
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
tf.provider_deepdive(provider) 5 credits One provider's full profile: status + all models + benchmarks joined + news + traffic
tf.compare_models(ids=) 1 credit Side-by-side compare of 2-5 models with normalized benchmarks + rankings
tf.whats_new(days=, news_limit=) 1 credit Agent morning brief: pricing changes + incidents + top news from last 1-7 days

Auto-send (requires tensorfeed[web3])

Method Description
tf.purchase_credits(amount_usd=, private_key=, rpc_url=) One-call quote + sign + broadcast + confirm. Returns token, credits, tx_hash, block_number.

Wallet & Trust

The TensorFeed payment wallet is 0x549c82e6bfc54bdae9a2073744cbc2af5d1fc6d1 on Base mainnet. USDC contract: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913.

Cross-check this address before sending funds at:

If any source disagrees, do not send.

Premium Data Terms

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).

No refunds; credits do not expire

All credit purchases are final and non-refundable per Section 17.5 of the Terms. Credits never expire while the token holds them, and a zero-balance token is deleted 30 days after its last use. 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.

Sanctions

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.

License

MIT

Metadata

Release files for tensorfeed 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tensorfeed 3.1.0
File Size Uploaded Provenance Actions
tensorfeed-3.1.0.tar.gz 57.9 kB Without provenance Details for tensorfeed-3.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tensorfeed 3.1.0
File Interpreter ABI Platform Actions
tensorfeed-3.1.0-py3-none-any.whl Python 3 none any Details for tensorfeed-3.1.0-py3-none-any.whl

Total release size: 104.2 kB

Release files / tensorfeed-3.1.0.tar.gz

Download URL tensorfeed-3.1.0.tar.gz
Size 57.9 kB
Tags Source
SHA-256 checksum
How to use checksums
64fada4c9181c9fc10309d16a3a38028e28dbe0e84c2f693f60e6e65ce36475b
BLAKE2b-256 checksum
How to use checksums
e96a998e8792241483d975e2c135d660faf6a0d3b664131b6f513409a823a08c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / tensorfeed-3.1.0-py3-none-any.whl

Download URL tensorfeed-3.1.0-py3-none-any.whl
Size 46.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cc0900f95e8fd796161af2ca4a4ba233f22ce15ee47387ae61e4f7e4735c3cf
BLAKE2b-256 checksum
How to use checksums
f92e8b6cb64fbc8dfeae64a89a928a72a71881ebc1310e327039069a4d0d1c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for tensorfeed 3.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page