2sio
1.9.0
1.82.0
1.81.0
1.80.4
1.80.3
1.80.2
1.80.0
1.8.0
1.79.9
1.79.8
1.79.7
1.79.6
1.79.5
1.79.3
1.79.27
1.79.26
1.79.25
1.79.24
1.79.23
1.79.22
1.79.21
1.79.20
1.79.2
1.79.19
1.79.18
1.79.17
1.79.16
1.79.15
1.79.14
1.79.13
1.79.12
1.79.11
1.79.10
1.79.1
1.79.0
1.78.0
1.77.0
1.76.0
1.75.0
1.74.0
1.73.0
1.72.0
1.71.0
1.70.0
1.7.0
1.69.0
1.68.0
1.67.0
1.66.0
1.64.0
1.63.0
1.62.0
1.61.0
1.60.0
1.6.0
1.59.0
1.58.0
1.57.1
1.57.0
1.56.0
1.55.0
1.54.0
1.53.0
1.52.0
1.51.0
1.50.0
1.5.0
1.49.0
1.48.0
1.47.0
1.46.0
1.45.0
1.44.0
1.43.0
1.42.1
1.42.0
1.41.0
1.40.0
1.4.0
1.39.0
1.38.0
1.37.0
1.36.0
1.35.0
1.34.0
1.33.0
1.32.0
1.31.0
1.30.1
1.3.0
1.25.0
1.2.0
1.15.0
1.14.0
1.13.0
1.12.0
1.11.2
1.11.0
1.10.0
1.1.0
1.0.0
0.9.0
0.8.0
0.7.0
0.6.0
0.5.0
0.4.0
0.37.0
0.36.0
0.35.0
0.34.0
0.33.0
0.32.0
0.31.0
0.30.0
0.3.0
0.29.0
0.28.0
0.27.0
0.26.0
0.25.0
0.24.0
0.23.0
0.22.1
0.22.0
0.21.0
0.20.0
0.2.0
0.19.0
0.18.0
0.17.0
0.16.1
0.16.0
0.15.0
0.14.0
0.13.1
0.13.0
0.12.0
0.11.0
0.10.0
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
1.9.0
1.82.0
1.81.0
1.80.4
1.80.3
1.80.2
1.80.0
1.8.0
1.79.9
1.79.8
1.79.7
1.79.6
1.79.5
1.79.3
1.79.27
1.79.26
1.79.25
1.79.24
1.79.23
1.79.22
1.79.21
1.79.20
1.79.2
1.79.19
1.79.18
1.79.17
1.79.16
1.79.15
1.79.14
1.79.13
1.79.12
1.79.11
1.79.10
1.79.1
1.79.0
1.78.0
1.77.0
1.76.0
1.75.0
1.74.0
1.73.0
1.72.0
1.71.0
1.70.0
1.7.0
1.69.0
1.68.0
1.67.0
1.66.0
1.64.0
1.63.0
1.62.0
1.61.0
1.60.0
1.6.0
1.59.0
1.58.0
1.57.1
1.57.0
1.56.0
1.55.0
1.54.0
1.53.0
1.52.0
1.51.0
1.50.0
1.5.0
1.49.0
1.48.0
1.47.0
1.46.0
1.45.0
1.44.0
1.43.0
1.42.1
1.42.0
1.41.0
1.40.0
1.4.0
1.39.0
1.38.0
1.37.0
1.36.0
1.35.0
1.34.0
1.33.0
1.32.0
1.31.0
1.30.1
1.3.0
1.25.0
1.2.0
1.15.0
1.14.0
1.13.0
1.12.0
1.11.2
1.11.0
1.10.0
1.1.0
1.0.0
0.9.0
0.8.0
0.7.0
0.6.0
0.5.0
0.4.0
0.37.0
0.36.0
0.35.0
0.34.0
0.33.0
0.32.0
0.31.0
0.30.0
0.3.0
0.29.0
0.28.0
0.27.0
0.26.0
0.25.0
0.24.0
0.23.0
0.22.1
0.22.0
0.21.0
0.20.0
0.2.0
0.19.0
0.18.0
0.17.0
0.16.1
0.16.0
0.15.0
0.14.0
0.13.1
0.13.0
0.12.0
0.11.0
0.10.0
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
توضیحات
Python client for 2s.io — 575+ pay-per-call tools for AI agents: ground-truth data, AI gateway, agent infra (storage, locks, queues, watchers). x402 USDC on Base/Solana, no API keys, upto usage billing, free trials.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | 2sio-1.9.0 |
| نام | 2sio |
| نسخه کتابخانه | 1.9.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Josh Alley <josh@alley.io> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/2sio/ |
| مجوز | MIT |
# 2sio (Python)
**Python client for [2s.io](https://2s.io) — 575+ pay-per-call tools for AI agents: more ground-truth data than any other x402 API, a full AI gateway (chat, image, multi-model consensus), and agent infrastructure (wallet-scoped storage, locks, queues, schedules, watchers). USDC on Base or Solana via x402.**
**upto billing (new on 2s):** AI endpoints also accept the x402 `upto` scheme — authorize the quoted max, get settled for your **actual usage** (a real on-chain example settled at 1/42nd of the quote). Exact-scheme calls work unchanged.
```bash
pip install 2sio
```
## 🎁 Try before you buy — free, no wallet
Verify any endpoint before funding a wallet. `trial=True` makes free calls (one per endpoint per hour, no key, no signup):
```python
from twosio import TwoS
trial = TwoS(trial=True)
print(trial.validate.iban(iban="GB82WEST12345698765432").data["items"][0]["valid"])
# real result; once/hour/endpoint, then raises TwoSError(code="TRIAL_EXHAUSTED")
```
Pass `private_key=...` (below) to pay per call for unlimited access.
## 🔔 Watchers — get woken up, don't poll
Most endpoints are reads. **Watchers** flip that: arm one once and we POST you a **signed callback the instant something happens** — a wallet moves, a stock crosses your price, a company reports earnings. No polling loop. Flat **$0.05** to arm; callbacks are EIP-191-signed (verify offline) and retried with exponential backoff, with a pull backstop via `watchers.status`.
```python
res = client.watchers.stock_price(
ticker="AAPL", conditionType="above", threshold=250,
callbackUrl="https://your-agent.app/hooks/aapl",
)
print(res.data["items"][0]["watcherId"]) # we POST your payload here the moment AAPL crosses $250
# also: client.watchers.crypto_address_activity(...), client.watchers.earnings(...)
```
## Quick start
```python
import os
from twosio import TwoS
# private_key is an EVM key (0x...) holding USDC on Base mainnet.
client = TwoS(private_key=os.environ["EVM_PRIVATE_KEY"])
r = client.patents.search(q="neural network", limit=5)
print(r.data["hits"][0]["title"])
print("paid:", r.cost_usd, "USDC, tx:", r.settlement["tx_hash"])
```
Settles on Base mainnet in ~2 seconds. Prices start at $0.0025/call.
If you'd rather construct the signer yourself (e.g. for a custodial KMS-backed wallet), pass it directly:
```python
from eth_account import Account
signer = Account.from_key(os.environ["EVM_PRIVATE_KEY"])
client = TwoS(signer=signer)
```
## What's included
An ever-expanding catalog of 575+ endpoints across 113+ groups (live count in the [directory](https://2s.io/api/directory)), namespaced by group — spanning AI (incl. multi-model consensus), agent primitives, control plane (distributed locks, durable queues, scheduled callbacks, pub/sub), storage (key-value / documents / vectors / private blobs), watchers (signed push callbacks), security (CVE / KEV / EPSS, IOC, exploits), identity resolution (ID crosswalks), patents & trademarks, law & sanctions, government & public records, finance & treasury, vehicles & aviation, health & medical, business & GLEIF/KYB, energy & agriculture, maritime & telecom, geo / weather / earth, space, science & papers, property & licenses, internet, crypto, music & news, text redaction & PII scrubbing, and data validators / utilities:
```python
client.patents.search(q="...")
client.security.cve(id="CVE-2024-3094")
client.crypto.address_validate(chain="eth", address="0xd8dA...")
client.ai.summarize(url="https://example.com")
client.law.sanctions_check(name="John Smith")
client.business.entity_match(name="Acme Corp")
client.geocode.address(query="350 5th Ave, New York, NY")
client.weather.zip(zip="94103")
# ... and 530+ more
```
Full catalog: <https://2s.io/api/directory>. OpenAPI: <https://2s.io/api/openapi>.
## Safety
- The client refuses to sign payments above `max_price_usd`. **There is no default cap** (`max_price_usd` defaults to `inf`) — set it to opt into a ceiling.
- Optional `on_payment_requested` hook for per-call approval.
```python
client = TwoS(
private_key=os.environ["EVM_PRIVATE_KEY"],
max_price_usd=0.05,
on_payment_requested=lambda info: info["amount_usd"] < 0.02,
)
```
## Errors
- `TwoSError` — HTTP error from 2s.io.
- `PaymentRefusedError` — local refusal (price cap or hook).
## License
MIT.
نیازمندی
| مقدار | نام |
|---|---|
| - | eth-account>=0.13 |
| - | httpx>=0.27 |
| - | x402[evm,httpx]>=2.0 |
| xtr | x402[svm]>=2.12; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.10 | Python |
نحوه نصب
نصب پکیج whl 2sio-1.9.0:
pip install 2sio.whl
نصب پکیج tar.gz 2sio-1.9.0:
pip install 2sio.tar.gz