{"openapi":"3.1.0","info":{"title":"KLane x402 API","version":"1.1.0","description":"Pay-per-call APIs via x402 (USDC on Base). Unpaid requests return 402 with payment requirements.","x-guidance":"All routes are GET with query parameters. Call without payment to receive the x402 challenge (v2 PAYMENT-REQUIRED header, v1 body), then retry with PAYMENT-SIGNATURE (v2) or X-PAYMENT (v1). Funding data: /api/funding/latest?coin=BTC (6 venues, hourly+APR), /api/funding/arb?min_apr=10 (cross-venue spreads), /api/funding/history?coin=ETH&days=7. Upstream failures return 502 and are not charged. Subscription alternative (9 USDC/month, x-api-key): /pro"},"servers":[{"url":"https://klane402.deanhiki.workers.dev"}],"paths":{"/api/cloud/price":{"get":{"operationId":"cloud_price","summary":"Live Azure retail cloud prices (official Azure Retail Prices API), normalized and ranked cheapest-first across regions. Query: sku (e.g. Standard_D2s_v5) or service (e.g. Virtual Machines) + optional region (eastus), os (linux|windows), spot=1, limit. Returns hourly and monthly USD, region, meter. Cached 6h. $0.05 per call.","x-x402-price-usdc":0.05,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.050000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"sku","in":"query","required":true,"schema":{"type":"string"},"example":"Standard_D2s_v5"},{"name":"os","in":"query","required":true,"schema":{"type":"string"},"example":"linux"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"cheapest":[{"sku":"Standard_D2s_v5","region":"eastus","hourlyUsd":0.096,"monthlyUsd":70.08}]}}}},"402":{"description":"Payment required (x402)"}}}},"/api/funding/latest":{"get":{"operationId":"funding_latest","summary":"Live perp funding rates across 6 venues (Hyperliquid, Bybit, Binance, Pacifica, Extended, Lighter), normalized to hourly rate and APR %, with mark price and open interest where the venue API provides it (Bybit/Binance rows come from the Lighter public funding aggregator, marked via:\"lighter-aggregate\", rate only, no mark/OI). Response includes per-venue source status. Query: coin (optional, e.g. BTC), venue (optional). Cached <=60s. $0.005 per call.","x-x402-price-usdc":0.005,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.005000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"coin","in":"query","required":true,"schema":{"type":"string"},"example":"BTC"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"asOf":"2026-10-30T06:00:00Z","rates":[{"venue":"hyperliquid","coin":"BTC","hourly":0.0000125,"apr":10.95}]}}}},"402":{"description":"Payment required (x402)"}}}},"/api/funding/arb":{"get":{"operationId":"funding_arb","summary":"Cross-venue funding arbitrage scanner: for each coin listed on 2+ of Hyperliquid/Bybit/Pacifica/Extended/Lighter, the best long venue (lowest funding) vs short venue (highest), spread in APR %, both sides' open interest. Sorted by spread. Query: min_apr (default 10), min_oi_usd (default 0), limit (default 30). $0.008 per call.","x-x402-price-usdc":0.008,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.008000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"min_apr","in":"query","required":true,"schema":{"type":"string"},"example":"10"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"opportunities":[{"coin":"ETH","longVenue":"hyperliquid","shortVenue":"bybit","spreadApr":25.3}]}}}},"402":{"description":"Payment required (x402)"}}}},"/api/funding/history":{"get":{"operationId":"funding_history","summary":"Funding rate history for a coin: Hyperliquid hourly settlements, plus Bybit per-interval settlements when the Bybit API is reachable from the serving region (otherwise listed in unavailable[]) over the last N days (max 30), each with hourly-normalized rate, APR %, and average APR summary. Query: coin (required), days (default 7). $0.01 per call.","x-x402-price-usdc":0.01,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"coin","in":"query","required":true,"schema":{"type":"string"},"example":"ETH"},{"name":"days","in":"query","required":true,"schema":{"type":"string"},"example":"7"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"coin":"ETH","summary":{"hyperliquid":{"avgApr":8.1,"n":168}},"hyperliquid":[{"t":"2026-10-30T05:00:00Z","hourly":0.0000125,"apr":10.95}]}}}},"402":{"description":"Payment required (x402)"}}}},"/api/yields":{"get":{"operationId":"yields","summary":"Top DeFi yield pools from DefiLlama, filterable: query symbol (e.g. USDC), chain (e.g. Base), stable=1 (stablecoin only), min_tvl (default 1000000), limit (default 25). Returns project, chain, symbol, apy, apyBase, apyReward, tvlUsd, 30d mean apy. Cached 15 min. $0.01 per call.","x-x402-price-usdc":0.01,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"symbol","in":"query","required":true,"schema":{"type":"string"},"example":"USDC"},{"name":"stable","in":"query","required":true,"schema":{"type":"string"},"example":"1"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"pools":[{"project":"aave-v3","chain":"Base","symbol":"USDC","apy":5.1,"tvlUsd":120000000}]}}}},"402":{"description":"Payment required (x402)"}}}},"/api/chat":{"get":{"operationId":"chat","summary":"Chat completion (Llama 3.1 8B). Query: prompt, system (optional). Returns {reply}. $0.002 per call, no API key, pay per call in USDC.","x-x402-price-usdc":0.002,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.002000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"prompt","in":"query","required":true,"schema":{"type":"string"},"example":"Write a haiku about Seoul"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"reply":"..."}}}},"402":{"description":"Payment required (x402)"}}}},"/api/read-url":{"get":{"operationId":"read_url","summary":"Read a public web page as clean text for RAG: returns {title, description, text (<=20k chars), links}. Query: url. $0.005 per URL.","x-x402-price-usdc":0.005,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.005000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"url","in":"query","required":true,"schema":{"type":"string"},"example":"https://example.com"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"title":"Example Domain","text":"This domain is for use in illustrative examples..."}}}},"402":{"description":"Payment required (x402)"}}}},"/api/x402-lint":{"get":{"operationId":"x402_lint","summary":"Lint any x402 endpoint before you pay it: fetches the URL, checks 402 status, x402Version, accepts[] fields (scheme, network, amount, asset, payTo, resource, timeout), known USDC asset, price in USD and discovery metadata. Returns {ok, issues[], summary}. Query: url. $0.01.","x-x402-price-usdc":0.01,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"url","in":"query","required":true,"schema":{"type":"string"},"example":"https://klane402.deanhiki.workers.dev/api/chat"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"ok":true,"issues":[],"summary":{"priceUSD":0.002,"network":"base"}}}}},"402":{"description":"Payment required (x402)"}}}},"/api/payto-check":{"get":{"operationId":"payto_check","summary":"Pre-payment counterparty check for a Base (EVM) address: is it a contract or wallet, nonce (tx count), ETH and USDC balance, OFAC sanctions screening, plus a risk note. Query: address. $0.01. Use before an agent sends funds.","x-x402-price-usdc":0.01,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"address","in":"query","required":true,"schema":{"type":"string"},"example":"0x543e1bae93553c08a7658f5c5404b93dff3d8fa3"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"type":"eoa","txCount":12,"usdc":5.2,"note":"..."}}}},"402":{"description":"Payment required (x402)"}}}},"/api/sentiment":{"get":{"operationId":"sentiment","summary":"Classify sentiment and topics of text (any language incl. Korean). Returns {sentiment: positive|neutral|negative, score, topics[]}. Query: text. $0.003.","x-x402-price-usdc":0.003,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.003000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"text","in":"query","required":true,"schema":{"type":"string"},"example":"배송이 너무 늦어요"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"sentiment":"negative","score":-0.7,"topics":["shipping"]}}}},"402":{"description":"Payment required (x402)"}}}},"/api/translate-ko":{"get":{"operationId":"translate_ko","summary":"Translate any text to natural Korean (or Korean to English with to=en). Query: text, to (ko|en). $0.01 per call.","x-x402-price-usdc":0.01,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"text","in":"query","required":true,"schema":{"type":"string"},"example":"Hello, how much is shipping to Seoul?"},{"name":"to","in":"query","required":true,"schema":{"type":"string"},"example":"ko"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"translation":"안녕하세요, 서울까지 배송비가 얼마인가요?"}}}},"402":{"description":"Payment required (x402)"}}}},"/api/summarize-url":{"get":{"operationId":"summarize_url","summary":"Fetch a public web page and return a 5-bullet English summary plus page title. Query: url. $0.02 per call.","x-x402-price-usdc":0.02,"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.020000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"url","in":"query","required":true,"schema":{"type":"string"},"example":"https://example.com"}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"title":"Example Domain","summary":["..."]}}}},"402":{"description":"Payment required (x402)"}}}}}}