x402ti
README.md
# x402ti (`v2`)
Deterministic **x402 V2** pay-per-request trading, macro, prediction-market & Solana intelligence API on **Base Mainnet (`eip155:8453`, USDC)**—built for autonomous agents with zero API keys, zero subscriptions, and strict **Pay-Only-On-Success** settlement.
> Informational market/security data only; not financial advice.
- **Live Base URL:** https://x402ti.malwowar.workers.dev
- **x402scan Listing:** https://www.x402scan.com/server/ca2b4d4b-52eb-43f4-9fb0-4eba4d557b9e
- **Discovery:** [`/.well-known/x402`](https://x402ti.malwowar.workers.dev/.well-known/x402) · [`/.well-known/agent-card.json`](https://x402ti.malwowar.workers.dev/.well-known/agent-card.json) · [`/openapi.json`](https://x402ti.malwowar.workers.dev/openapi.json) · [`/llms.txt`](https://x402ti.malwowar.workers.dev/llms.txt) · [`/health`](https://x402ti.malwowar.workers.dev/health)
---
## Endpoints & Pricing (8 Paid Resources — Base Mainnet USDC)
### Multi-Asset Scanners
| Method & Path | Price (USD) | Optional Query Params | What It Returns |
| --- | --- | --- | --- |
| `GET /v1/perps/screener` | `$0.01` | `min_oi_usd` (default `1000000`), `limit` (`1–25`) | Scans all ~180+ Hyperliquid perps: market breadth, median funding APR, and top leaderboards for funding extremes, basis dislocations & turnover |
| `GET /v1/perps/funding-arb` | `$0.015` | `min_oi_usd` (default `100000` per leg), `limit` (`1–25`), `coin` | Live **3-venue** funding spread scanner comparing **Hyperliquid vs. dYdX v4 vs. Kraken Futures** annualized funding rates, bottleneck leg OI & mark spreads |
| `GET /v1/predictions/scanner` | `$0.015` | `venue` (`all`/`polymarket`/`kalshi`), `query`, `min_volume_24h_usd`, `limit` (`1–25`) | Live **Polymarket + Kalshi** scanner: implied probabilities, bid-ask spreads, 24h volume/liquidity ratios, keyword search & high-conviction annualized carry-to-expiry |
| `GET /v1/solana/trending` | `$0.015` | `limit` (`1–8`, default `5`), `max_risk_score` (`0–100`) | Live trending Solana pools **pre-screened in parallel with RugCheck** deterministic risk scores, authority flags, liquidity & 24h trader flow |
### Deep-Dive Derivatives, Macro & Security Briefs
| Method & Path | Price (USD) | Query Params | What It Returns |
| --- | --- | --- | --- |
| `GET /v1/options/surface` | `$0.015` | `currency` (`BTC` default, or `ETH`) | Distills hundreds of live **Deribit** options into ATM IV term structure, contango/backwardation slope, OTM put-call skew, put/call OI ratios, exact **Max Pain** strike & top Call/Put OI walls |
| `GET /v1/macro/liquidity` | `$0.01` | `lookback_obs` (`2–20`, default `5`) | Combines 5 official **US Treasury & NY Fed** primary feeds: exact US public debt, TGA cash balance & flows, ON RRP balance, EFFR/SOFR funding stress spread (bps) & net USD liquidity impulse (`-ΔTGA - ΔRRP`) |
| `GET /v1/perps/snapshot` | `$0.005` | `coin` (req, e.g. `BTC`, `ETH`, `kPEPE`) | Mark/oracle basis (bps), hourly & annualized funding, open interest USD, volume/OI turnover, spread (bps), top-5 L2 depth imbalance & **`$10k` buy/sell VWAP slippage (bps)** |
| `GET /v1/solana/safety` | `$0.01` | `mint` (req, Base58 SPL mint) | Deterministic `0–100` risk score, tier (`LOW`/`MODERATE`/`ELEVATED`/`CRITICAL`), RugCheck risks, authority booleans (`mint`/`freeze`/`mutable`), `lp_locked_pct` & liquidity/FDV ratios |
**Pay-Only-On-Success Guarantee:** Unpaid requests return `HTTP 402` with x402 V2 `PAYMENT-REQUIRED` terms. Only `HTTP 200` settles—`400`, `404`, `502`, and `503` are **never settled**.
---
## Quickstart for AI Agents & Developers
### 1. Discover with AgentCash CLI
```bash
npx -y @agentcash/discovery@latest discover https://x402ti.malwowar.workers.dev --json
```
### 2. Multi-Signal Agent Workflow with `@x402/fetch` (TypeScript, with Spend Cap)
```ts
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.BUYER_PRIVATE_KEY as `0x${string}`);
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.05" });
registerExactEvmScheme(client, { signer: account });
const fetchWithPay = wrapFetchWithPayment(fetch, client);
// 1. Check US Macro USD Liquidity Impulse ($0.01)
const macro = await fetchWithPay(
"https://x402ti.malwowar.workers.dev/v1/macro/liquidity?lookback_obs=5"
).then((r) => r.json());
// 2. Check BTC Options Volatility Surface, Skew & Max Pain ($0.015)
const opts = await fetchWithPay(
"https://x402ti.malwowar.workers.dev/v1/options/surface?currency=BTC"
).then((r) => r.json());
// 3. Scan Polymarket + Kalshi high-conviction carry opportunities ($0.015)
const preds = await fetchWithPay(
"https://x402ti.malwowar.workers.dev/v1/predictions/scanner?venue=all&limit=5"
).then((r) => r.json());
```
### 3. Drop-In Agent Skill & Standalone MCP Server
- **Agent Skill:** Copy [`skills/x402ti/SKILL.md`](./skills/x402ti/SKILL.md) into your agent's skills folder (Claude Code, Cursor, Antigravity, OpenClaw, Codex) to teach your agent all 8 endpoints.
- **MCP Server Wrapper:** See [`mcp/README.md`](./mcp/README.md) to expose all 8 paid endpoints + `/health` as native MCP tools with a configurable per-call USDC spend cap.
---
## Architecture & Self-Hosting
- **Runtime:** Cloudflare Workers (`nodejs_compat`) + Cloudflare D1 + Hono + strict TypeScript (`$0` infrastructure)
- **Payments:** Strict x402 V2 (`@x402/hono`, `@x402/core`, `@x402/evm`, `@x402/extensions`, `@coinbase/x402`) lazily initialized only on `/v1/*`
- **2-Tier Caching & Resilience:** Bounded 500-entry in-isolate TTL `Map` cache + best-effort Cloudflare Edge Cache (`caches.default`, automatically PoP-shared once a custom domain is attached), 3.5s `AbortController` timeouts, 3-tier keyless Solana market fallback, graceful partial-venue fallbacks (2-of-3 perps, 1-of-2 prediction venues, 3-of-5 official US macro feeds), and strict refusal to score missing RugCheck data as safe
- **Operator Console:** Embedded dark-mode dashboard at `/dashboard` (constant-time SHA-256 Bearer auth, CSP/anti-clickjacking headers, D1 telemetry, clickable BaseScan links, and a D1-backed Start/Stop `503` API pause gate)
### Local Development
```bash
npm install
cp .dev.vars.example .dev.vars # fill CDP_API_KEY_ID, CDP_API_KEY_SECRET, DASHBOARD_TOKEN
npm run db:migrate:local
npm test
npm run dev
```
See [SPEC.md](./SPEC.md) for the engineering specification.
## License
MIT — see [LICENSE](./LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues