# Tarnak x402 Toolkit

> Keyless pay-per-call APIs for AI agents on Base mainnet (eip155:8453), USDC over x402 v2. No API key, account or signup. Unpaid requests get HTTP 402 with payment requirements (PayAI facilitator).

## Quickstart (x402, 3 steps)
1. GET a paid route unpaid -> HTTP 402; the x402 v2 challenge is base64 in the `PAYMENT-REQUIRED` header.
2. Sign `accepts[0]` (USDC on Base, `exact`/EIP-3009) with the buyer wallet and retry with `PAYMENT-SIGNATURE: <base64 payload>`.
3. HTTP 200 means the facilitator settled; the body is the result. Free sample: GET /v1/token/verdict/free?address=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (10 calls/IP/day).

## Free sample
- [GET /v1/token/verdict/free](https://api.capousd-student-tools.me/v1/token/verdict/free?address=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913): free token verdict, 10 calls per IP per day.
- [GET /gpu](https://api.capousd-student-tools.me/gpu): free live GPU rental price snapshot with a paid JSON/report upsell, for humans and browsing agents.
- [GET /v1/gpu/report?preview=1](https://api.capousd-student-tools.me/v1/gpu/report?model=A100&hours=24&preview=1): free structured GPU report preview - one cheapest offer, live offer count, and the paid-report link. No wallet.

## GPU report: free preview -> paid
1. GET /v1/gpu/report?model=A100&hours=24&preview=1 -> 200 preview (free).
2. GET /v1/gpu/report?model=A100&hours=24 unpaid -> 402; accepts[0].amount is 100000 atomic USDC ($0.10).
3. Retry with PAYMENT-SIGNATURE -> 200 report with cheapest, recommended, alternatives, cost scenarios, 7-day history, spread, and a rent|caution|hold decision.
Optional: &compare=H100 for a model comparison, &format=markdown for an LLM-readable report.

## Paid endpoints (price per call, USDC on Base)
- [POST /v1/extract](https://api.capousd-student-tools.me/v1/extract): $0.004 - URL or HTML -> clean markdown, title, meta
- [POST /v1/repair](https://api.capousd-student-tools.me/v1/repair): $0.005 - Repair malformed JSON from LLM output
- [POST /v1/text](https://api.capousd-student-tools.me/v1/text): $0.003 - stats, keywords, sentiment, chunks
- [GET /v1/util/hash](https://api.capousd-student-tools.me/v1/util/hash): $0.001 - sha256/slugify/base64
- [GET /v1/token/verdict](https://api.capousd-student-tools.me/v1/token/verdict): $0.02 - Should your agent buy this token? GoPlus contract risk + DexScreener market data, plus a 2-3 sentence AI narrative, a 0-100 risk score and a confidence label. Free sample at /v1/token/verdict/free (10/IP/day); $0.02/call in USDC on Base.
- [GET /v1/services](https://api.capousd-student-tools.me/v1/services): $0.002 - Find x402-payable DePIN/data services by task: an x402 service directory to list DePIN services and agent-buyable APIs with price and network
- [GET /v1/gpu/prices](https://api.capousd-student-tools.me/v1/gpu/prices): $0.01 - Compare GPU rental prices and find the cheapest H100/A100/RTX rental per hour: a GPU rental comparison across DePIN networks covering decentralized GPU rental, H100 vs A100 cost, GPU cloud pricing and AI compute cost per hour. Use before renting AI compute or choosing the cheapest A100/H100. GET ?model=A100 (or H100), no API key. $0.01/call in USDC on Base.
- [GET /v1/providers/rank](https://api.capousd-student-tools.me/v1/providers/rank): $0.01 - Compare DePIN compute providers and DePIN compute cost: a GPU provider comparison ranking H100/A100/RTX rental providers by uptime, price and network. Use when choosing a reliable DePIN GPU provider or comparing decentralized GPU rental options; for latency-sensitive placement, compare provider uptime and network before renting. $0.01/call in USDC on Base, no API key.
- [GET /v1/gpu/report](https://api.capousd-student-tools.me/v1/gpu/report): $0.10 - Decision-ready GPU rental cost report for 24-720 GPU-hours. Avoid paying $30 more for a 24h H100 rental. Compare spreads, uptime, and get a rent/hold decision. Returns cheapest and recommended A100/H100/RTX offers, price spread, estimated cost for your hours, 7-day price history and a rent/don't-rent call - more useful than a raw price list when an agent must choose a provider. GET ?model=A100&hours=24, optional compare=H100, format=json|markdown, no API key. $0.10/call in USDC on Base.
- [GET /v1/gpu/procurement](https://api.capousd-student-tools.me/v1/gpu/procurement): $5.00 - GPU procurement decision for a workload: model, hours, quantization and optional budget in; recommended GPU offer, alternatives, required GPU count, all-in cost and a rent/caution/hold call out. Use before renting compute for llama-3-70b, Mixtral, Qwen or DeepSeek. GET ?model=llama-3-70b&hours=24, no API key. $5.00/call in USDC on Base.
- [POST /v1/gpu/procurement](https://api.capousd-student-tools.me/v1/gpu/procurement): $5.00 - GPU procurement decision for a workload JSON body: {model, hours, quantization?, gpu_count?, budget_usd?, region?}. Returns recommended GPU offer, alternatives, all-in cost and a rent/caution/hold call. No API key. $5.00/call in USDC on Base.
- [POST /v1/inference](https://api.capousd-student-tools.me/v1/inference): $0.002 - OpenAI-compatible chat completions from the local abliterated Qwen2.5 model. Send {model, messages, max_tokens?}; returns an OpenAI-shaped response. One call includes up to 1,000 completion tokens; max_tokens is capped at 1,000. No account or API key; pay per call in USDC on Base. $0.002/call.
- [POST /v1/inference/chat/completions](https://api.capousd-student-tools.me/v1/inference/chat/completions): $0.002 - OpenAI SDK-compatible path alias for /v1/inference. Base URL https://api.capousd-student-tools.me/v1/inference, model local, $0.002/call for up to 1,000 completion tokens; no API key.
- [GET /v1/token/risk](https://api.capousd-student-tools.me/v1/token/risk): $0.004 - Focused rug/honeypot risk report: honeypot, buy/sell tax, top-10 concentration, blockers
- [GET /v1/markdown](https://api.capousd-student-tools.me/v1/markdown): $0.004 - URL to markdown: fetch a public URL (or raw HTML) and convert it to clean markdown, title and meta for LLM ingestion
- [GET /v1/gas](https://api.capousd-student-tools.me/v1/gas): $0.002 - Get the gas price on Base mainnet: base fee, priority fee and suggested max fee (gwei) before sending a transaction

## Machine-readable
- [OpenAPI](https://api.capousd-student-tools.me/openapi.json)
- [x402 manifest](https://api.capousd-student-tools.me/.well-known/x402)
- [agents.json](https://api.capousd-student-tools.me/agents.json)
- [JSON catalog](https://api.capousd-student-tools.me/v1/tools)
