{"openapi":"3.1.0","info":{"title":"RegimeShift Clearinghouse — Agent-SOFR + on-chain RFQ capital market","description":"Pay-per-call agent-native data + on-chain bilateral RFQ marketplace for AI agents on Base mainnet. Three paid x402 endpoints publish a manipulation-resistant set of derived market metrics: **Agent-SOFR** (decentralized USD short-rate benchmark, 7-source weighted-median + BNS-calibrated variance premium + 6-mode regime premium), **max-LTV** (variance-aware collateral cap), **ETH/BTC VRP** (DVOL minus Parkinson realised vol). On top of these, free clearinghouse endpoints let agents lend/borrow USDC against WETH collateral at 15-30 min tenors, with atomic on-chain settlement via InterAgentRepoV4 (Foundry-tested, 3 audit rounds resolved, Chainlink ETH/USD liquidation, 3% bounty + 1% insurance default waterfall). Two-tier facilitator (Coinbase CDP primary + self-hosted fallback) ensures paid endpoints stay live during upstream incidents. Methodology pages are IPFS-pinned and every paid response includes the SHA-256 content hash so clients can independently verify the math hasn't moved.\n\nLive dashboard: https://regimeshift.xyz · Open-source: https://github.com/tradingdesk26 · Methodology: https://regimeshift.xyz/methodology/agent-sofr-v1","version":"0.1.0","x-guidance":"Pay-per-call data + on-chain RFQ capital market for AI agents on Base mainnet. Agents pay $0.001 USDC via x402 to read Agent-SOFR (decentralized USD short-rate benchmark), max-LTV (variance-aware loan terms), or ETH/BTC volatility risk premium. Free clearinghouse endpoints let agents lend/borrow USDC vs WETH at 15-30 min tenors with atomic on-chain settlement (InterAgentRepoV4, Foundry-tested, 3 audit rounds resolved). Two-tier facilitator (Coinbase CDP primary + self-hosted fallback) — every paid 200 is a real USDC.transferWithAuthorization tx visible on BaseScan. Methodology IPFS-pinned with SHA-256 in every response."},"paths":{"/":{"get":{"summary":"Root","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]}},"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]}},"/manifest":{"get":{"summary":"Manifest","description":"ERC-8257-shaped discovery manifest (canonical /api/manifest).","operationId":"manifest_manifest_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]}},"/quickstart.txt":{"get":{"summary":"Quickstart","description":"Plain-text quickstart for x402 catalog browsers and AI agents.","operationId":"quickstart_quickstart_txt_get","responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}}},"security":[]}},"/stats":{"get":{"summary":"Stats Endpoint","description":"Aggregate request counts (free, for the public dashboard).\n\nBuckets per endpoint:\n  - .402   unpaid probe (also includes wallet-less curl checks)\n  - .200   successful paid call (CDP verify+settle landed)\n  - .other 4xx/5xx for that path\n  - .total all responses","operationId":"stats_endpoint_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]}},"/v1/rate/sofr/usd":{"get":{"tags":["agent-sofr","rates","benchmark","oracle","paid-x402"],"summary":"Agent-SOFR — decentralized USD short-rate benchmark for AI agents (BNS-calibrated, 7-source)","description":"Returns the current Agent-SOFR rate: a manipulation-resistant, decentralized USD short-rate benchmark for inter-agent capital markets on Base mainnet. Aggregates 7 sources via weighted median (Deribit options put-call parity, Hyperliquid PERP funding, Aevo options PCP, Deribit futures basis 3-month, Aave V3 Base USDC borrow, Compound Base USDC borrow, NY Fed SOFR 30-day macro anchor), then adds a variance premium derived from Barndorff-Nielsen–Shephard jump decomposition (lambda=1.097 closed-form on 444k 5-min ETH/USDC bars, ~4.2 years) and a 6-mode regime premium.\n\nUse cases:\n  - Price short-term inter-agent loans against a transparent benchmark rate\n  - Derive carry costs for delta-neutral perp/spot strategies\n  - Anchor variance-aware collateral haircuts (the max-LTV endpoint depends on this)\n  - Replace centralized rate oracles for agent-native applications\n  - Build agent-economy interest rate derivatives (rate swaps, caps, floors)\n\nKeywords: agent SOFR, agent-native benchmark, decentralized short rate, USD short rate oracle, agent capital market, inter-agent lending, x402 paid rate, Base mainnet rate, BNS jump decomposition, variance premium, regime classifier, weighted-median rate aggregation, IPFS-pinned methodology, on-chain rate benchmark, money market rate, risk-free rate proxy, USD interest rate.","operationId":"get_agent_sofr_usd_v1_rate_sofr_usd_get","parameters":[{"name":"horizon","in":"query","required":false,"schema":{"type":"string","default":"1h","title":"Horizon"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"Payment required. Sign EIP-3009 USDC authorization for $0.001 via x402; resend with X-Payment header.","headers":{"payment-required":{"schema":{"type":"string"},"description":"Base64-encoded x402 payment challenge (resource, accepts, extensions.bazaar info+schema)."}}}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.001"}}}},"/v1/risk/max-ltv":{"get":{"tags":["risk","ltv","lending","oracle","paid-x402"],"summary":"Max-safe loan-to-value for collateralized agent loans (variance + regime aware)","description":"Returns the maximum safe loan-to-value (LTV) ratio for a collateralized x402 / RFQ agent loan on Base mainnet. Computes the smaller of two bounds:\n  1. math_max_ltv — Black-Cox first-passage bound from (cv + lambda·j²)-derived      variance over the loan horizon, capped by the lender's max_default_prob\n  2. regime_cap_ltv — hard cap from the 6-mode volatility regime classifier      (LOW/RESTING ~92% → EXTREME/BLOWOFF ~55%)\n\nResponse includes `binding_constraint` so agents see WHY the cap is what it is (math vs regime_cap) — useful for adaptive collateral strategies. Same calibrator as Agent-SOFR (BNS jump decomposition, 444k 5-min ETH/USDC bars, lambda=1.097).\n\nUse cases:\n  - Sizing the `collateral_amount_max` parameter in /v1/intent/borrow\n  - Stress-test existing collateralized lending positions before vol spikes\n  - Build LTV-aware risk dashboards for agent treasuries\n  - Derive auto-rebalance / margin-add triggers when LTV approaches cap\n  - Compare collateral efficiency across volatility regimes for capital allocation\n\nKeywords: max LTV, loan to value, collateralized lending, variance-aware risk, regime-aware lending, Black-Cox default model, max default probability, lender risk parameter, agent loan terms, BNS variance, on-chain risk oracle, collateral haircut, liquidation threshold, agent collateral sizing.","operationId":"get_max_ltv_v1_risk_max_ltv_get","parameters":[{"name":"asset","in":"query","required":false,"schema":{"type":"string","default":"ETH","title":"Asset"}},{"name":"duration_sec","in":"query","required":false,"schema":{"type":"integer","default":3600,"title":"Duration Sec"}},{"name":"max_default_prob","in":"query","required":false,"schema":{"type":"number","default":0.001,"title":"Max Default Prob"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"Payment required. Sign EIP-3009 USDC authorization for $0.001 via x402.","headers":{"payment-required":{"schema":{"type":"string"}}}}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.001"}}}},"/v1/intent/lend":{"post":{"summary":"Post Intent Lend","description":"Submit a lender intent to the order book. Free (matching runs synchronously\non each new intent; matched quote payload available via /v1/matches/recent).","operationId":"post_intent_lend_v1_intent_lend_post","requestBody":{"content":{"application/json":{"schema":{"properties":{"wallet":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"EVM address (checksum or lowercase) of the lender wallet that will fund the loan principal on-chain"},"asset":{"type":"string","enum":["USDC"],"description":"Principal asset (USDC only in v1)"},"amount":{"type":"number","exclusiveMinimum":0.0,"description":"Principal amount to lend, in USDC (e.g. 50.0 = $50)"},"max_duration_sec":{"type":"integer","maximum":86400.0,"minimum":120.0,"description":"Maximum loan duration the lender will commit to (120s - 24h)"},"min_rate_bps":{"type":"integer","maximum":10000.0,"minimum":0.0,"description":"Minimum acceptable rate in basis points (1% = 100 bps)"},"max_default_prob":{"type":"number","maximum":0.01,"minimum":0.0,"description":"Maximum acceptable default probability — caps max-LTV regime, lower = safer collateral demand","default":0.001},"webhook_url":{"type":"string","format":"uri","description":"(optional) Server POSTs full signed-quote payload to this URL within ~1s of match. Best-effort, no retries. Handler must be idempotent on match_id."}},"additionalProperties":true,"type":"object","required":["wallet","asset","amount","max_duration_sec","min_rate_bps"],"title":"LenderIntent","example":{"wallet":"0x9C08414234cf959Cd7d83F50dC5E904515C6e221","asset":"USDC","amount":50.0,"max_duration_sec":1800,"min_rate_bps":480,"max_default_prob":0.001,"webhook_url":"https://my-agent.example/x402/match-callback"}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/v1/intent/borrow":{"post":{"summary":"Post Intent Borrow","description":"Submit a borrower intent. Returns match_id if compatible lender found.","operationId":"post_intent_borrow_v1_intent_borrow_post","requestBody":{"content":{"application/json":{"schema":{"properties":{"wallet":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"EVM address of the borrower wallet — must hold the collateral + approve V4 to pull it"},"principal_asset":{"type":"string","enum":["USDC"],"description":"Asset borrower wants to receive (USDC only in v1)"},"principal_amount":{"type":"number","exclusiveMinimum":0.0,"description":"Principal amount to borrow in USDC"},"collateral_asset":{"type":"string","enum":["WETH"],"description":"Collateral asset (WETH only in v1)"},"collateral_amount_max":{"type":"number","exclusiveMinimum":0.0,"description":"Maximum WETH the borrower is willing to lock as collateral. Matcher will lock the MINIMUM amount the live regime requires (e.g. ~88% LTV in LOW regime, ~55% LTV in EXTREME) — your max is the ceiling, not the target."},"duration_sec":{"type":"integer","maximum":86400.0,"minimum":120.0,"description":"Loan duration in seconds (120s - 24h)"},"max_rate_bps":{"type":"integer","maximum":10000.0,"minimum":0.0,"description":"Maximum acceptable rate in basis points (1% = 100 bps)"},"webhook_url":{"type":"string","format":"uri","description":"(optional) Server POSTs full signed-quote payload to this URL within ~1s of match"}},"additionalProperties":true,"type":"object","required":["wallet","principal_asset","principal_amount","collateral_asset","collateral_amount_max","duration_sec","max_rate_bps"],"title":"BorrowerIntent","example":{"wallet":"0xA44Df66E7e0c5ED31BcA87C3a5b71D2F0F00C2BB","principal_asset":"USDC","principal_amount":50.0,"collateral_asset":"WETH","collateral_amount_max":0.03,"duration_sec":1200,"max_rate_bps":650,"webhook_url":"https://my-agent.example/x402/match-callback"}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/v1/intent/{intent_id}/matches":{"get":{"summary":"Get Intent Matches","description":"All matches for an intent + its fill status — the SWEEP view.\n\nA large lend fills across several borrowers; this returns every resulting\nmatch (oldest first) so a client can originate each one, plus how much of\nthe lender's capacity is filled vs still resting:\n  {ok, intent_id, side, status, amount, remaining, filled, matches:[...]}\nEach match carries {match_id, borrower_intent_id, lender_intent_id,\ncreated_at, quote} where quote is the full signed-quote payload.","operationId":"get_intent_matches_v1_intent__intent_id__matches_get","parameters":[{"name":"intent_id","in":"path","required":true,"schema":{"type":"string","title":"Intent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/auto/provision":{"get":{"summary":"Get Auto Provision","description":"Auto-lend onboarding for regimeshift.xyz/auto/. Ensure the owner's 1-of-1\nSafe + Zodiac Roles module exist (operator-paid, idempotent), and return the\ncalldata her wallet relays to authorize / pause / withdraw. The heavy import\nis lazy so any issue here can never block app startup.","operationId":"get_auto_provision_auto_provision_get","parameters":[{"name":"owner","in":"query","required":true,"schema":{"type":"string","title":"Owner"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/v1/intents/open":{"get":{"summary":"Get Open Intents","description":"Return all currently-open intents from both sides.","operationId":"get_open_intents_v1_intents_open_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]}},"/v1/liquidatable-loans":{"get":{"summary":"Get Liquidatable Loans","description":"Return all currently-active loans whose on-chain LTV ≥ 95% (liquidation\nthreshold) AND grace period has passed. Any agent can call\nInterAgentRepoV4.liquidate(loanId) to claim the 3% bounty.\n\nRead-only — does NOT execute liquidations. Free endpoint (encourages\nmonitoring + competition between liquidators).","operationId":"get_liquidatable_loans_v1_liquidatable_loans_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]}},"/v1/active-loans":{"get":{"summary":"Get Active Loans","description":"Return all currently-active loans with current LTV (whether liquidatable\nor not). Useful for dashboard / lender position monitoring.","operationId":"get_active_loans_v1_active_loans_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]}},"/v1/loans/registry":{"get":{"summary":"Get Loan Registry","description":"Full lifecycle of every V4 loan reconstructed from on-chain event logs.\n\nReturns the last `limit` originated loans (within ~14h lookback), each\nenriched with its close-event tx hash + final status. Cached for 30s.\n\nEach record contains: loan_id, status (active/repaid/defaulted/liquidated),\nborrower, lender, principal, collateral, rate, LTV, regime data (via match),\nand on-chain tx hashes (originate + close).\n\nUseful for public transparency dashboards.","operationId":"get_loan_registry_v1_loans_registry_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/v1/intent/{intent_id}/match":{"get":{"summary":"Long Poll Intent Match","description":"Long-poll for a match on an open intent. Two response modes:\n\nMode 1 (default, `stream=false`) — single JSON response:\n  GET /v1/intent/lend_abc/match?wait=180\n  Returns one of:\n    {ok:true, matched:true,  match_id, quote, elapsed_sec}\n    {ok:true, matched:false, timeout_sec, elapsed_sec, hint}\n\nMode 2 (`stream=true`) — newline-delimited JSON (application/x-ndjson):\n  GET /v1/intent/lend_abc/match?wait=180&stream=true\n  Yields:\n    {\"event\":\"waiting\", \"elapsed_sec\":25.0}     ← heartbeat every 25s\n    {\"event\":\"waiting\", \"elapsed_sec\":50.0}\n    ...\n    {\"event\":\"matched\", \"match_id\", \"quote\", \"elapsed_sec\":67.3}   OR\n    {\"event\":\"timeout\", \"timeout_sec\", \"elapsed_sec\":180.0}\n\nStreaming mode emits a heartbeat every 25s so aggressive idle-timeout\nproxies (CDNs, mobile networks, corporate egress) don't kill the\nconnection mid-wait. Use it when wait > ~60 and you can't control\nthe proxy chain between your agent and our server.\n\n`wait` default 180s (well under our nginx 310s limit), max 300s. Cap\nis intentional — TCP idle limits on CDN/mobile typically kill\nconnections beyond ~5 min, so longer polls are silently dangerous.\n\nIf you have a public HTTPS endpoint that can accept POSTs, prefer\n`webhook_url` at intent submission instead — push delivery, no\ntimeouts, instant. Long-poll is the fallback for agents without\npublic endpoints (local scripts, behind NAT, etc.).","operationId":"long_poll_intent_match_v1_intent__intent_id__match_get","parameters":[{"name":"intent_id","in":"path","required":true,"schema":{"type":"string","title":"Intent Id"}},{"name":"wait","in":"query","required":false,"schema":{"type":"integer","default":180,"title":"Wait"}},{"name":"stream","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Stream"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/v1/matches/recent":{"get":{"summary":"Get Recent Matches","description":"Recent matches with full quote payload (signature, decomposition, contract address).","operationId":"get_recent_matches_v1_matches_recent_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/v1/asset/{asset}/vrp":{"get":{"tags":["vol","vrp","oracle","paid-x402"],"summary":"ETH/BTC Volatility Risk Premium — DVOL minus Parkinson realized vol (72h)","description":"Returns the current Volatility Risk Premium (VRP) for {asset} (ETH or BTC), expressed as Deribit DVOL (annualised implied vol from options) minus the 72-hour Parkinson realised volatility estimator. Positive VRP = implied vol overpriced relative to realised = sell-vol opportunity (premium-collection edge). Negative VRP = implied underpriced = buy-vol opportunity (gamma-long edge). Response includes regime classification (LOW / MID / HIGH), full input audit trail (DVOL, RV_72h, RV_6h, spot price, timestamp, source), and the open methodology URL for verification.\n\nUse cases:\n  - Position-size delta-neutral vol-selling strategies (short straddles, strangles)\n  - Time entry into options spreads when premium is rich or compressed\n  - Compare cross-asset VRP (ETH vs BTC) for relative-value vol trades\n  - Combine with Agent-SOFR carry for total expected return modeling\n  - Build vol-regime triggers for systematic agent strategies\n  - Benchmark options market-makers' fair value vs realised\n\nKeywords: volatility risk premium, VRP, DVOL, Deribit volatility index, Parkinson realized volatility, implied vs realized vol, vol carry, vol surface, sell-vol signal, buy-vol signal, ETH vol, BTC vol, crypto options carry, agent vol oracle, x402 paid vol data, vol regime classifier, on-chain vol oracle, delta-neutral, gamma-long, options premium.","operationId":"get_vrp_v1_asset__asset__vrp_get","parameters":[{"name":"asset","in":"path","required":true,"schema":{"enum":["eth","btc","ETH","BTC"],"type":"string","title":"Asset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"Payment required. Sign EIP-3009 USDC authorization for $0.001 via x402.","headers":{"payment-required":{"schema":{"type":"string"}}}}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.001"}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"servers":[{"url":"/api"},{"url":"https://regimeshift.xyz/api"}]}