{"openapi":"3.1.0","info":{"title":"Prediction Market X Sentiment (x402)","description":"Agent-native Polymarket/Kalshi sentiment from live X chatter. Pay USDC on Base via HTTP 402. Free: /, /health, /scores, /sample, /catalog, /pricing, MCP at /mcp. Lite $0.35: /top, /shift. Full $0.35: /sentiment, /brief.","version":"1.2.0"},"servers":[{"url":"https://prediction-bot-iggf.onrender.com"}],"paths":{"/":{"get":{"tags":["free"],"summary":"Service index for agents","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogOut"}}}}}}},"/catalog":{"get":{"tags":["free"],"summary":"Machine-readable route catalog","operationId":"catalog_catalog_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogOut"}}}}}}},"/pricing":{"get":{"tags":["free"],"summary":"USDC price ladder","description":"Explicit price ladder for agents and humans.","operationId":"pricing_pricing_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PricingOut"}}}}}}},"/scores":{"get":{"tags":["free"],"summary":"Latest daily X-sentiment scores (free)","description":"Free daily snapshot: the latest X-sentiment score for each market we track,\nwith the change since the previous day. For any other question use /sentiment.","operationId":"free_scores_scores_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/sample":{"get":{"tags":["free"],"summary":"Static example response (no Grok)","operationId":"sample_sample_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SampleOut"}}}}}}},"/about":{"get":{"tags":["free"],"summary":"Human-readable landing page","operationId":"about_about_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/llms.txt":{"get":{"tags":["free"],"summary":"Plain-text summary for LLM agents","operationId":"llms_llms_txt_get","responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/health":{"get":{"tags":["free"],"summary":"Liveness and price ladder","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthOut"}}}}}}},"/sentiment":{"get":{"tags":["paid-full"],"summary":"X sentiment score for a Polymarket/Kalshi market","operationId":"sentiment_sentiment_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","description":"Exact Polymarket or Kalshi market question text, e.g. 'Will Bitcoin hit 150k in 2026'","examples":["Will Bitcoin hit 150k in 2026"],"default":"","title":"Q"},"description":"Exact Polymarket or Kalshi market question text, e.g. 'Will Bitcoin hit 150k in 2026'"}],"responses":{"200":{"description":"Paid result ($0.35 USDC on Base)","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SentimentOut"},{"$ref":"#/components/schemas/MissingQueryOut"}],"title":"Response 200 Sentiment Sentiment Get"}}}},"402":{"description":"Payment required: $0.35 USDC on Base (eip155:8453) via x402. Read the base64 PAYMENT-REQUIRED header, pay, and retry with the PAYMENT-SIGNATURE header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredOut"}}}},"400":{"description":"Missing or over-long q (not charged)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissingQueryOut"}}}},"503":{"description":"Scoring temporarily unavailable; no payment is taken (x402 settles only on success). Retry shortly","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnavailableOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/brief":{"get":{"tags":["paid-full"],"summary":"Score + shift + one-line summary for a market","operationId":"brief_brief_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","description":"Exact Polymarket or Kalshi market question text, e.g. 'Will Bitcoin hit 150k in 2026'","examples":["Will Bitcoin hit 150k in 2026"],"default":"","title":"Q"},"description":"Exact Polymarket or Kalshi market question text, e.g. 'Will Bitcoin hit 150k in 2026'"}],"responses":{"200":{"description":"Paid result ($0.35 USDC on Base)","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/BriefOut"},{"$ref":"#/components/schemas/MissingQueryOut"}],"title":"Response 200 Brief Brief Get"}}}},"402":{"description":"Payment required: $0.35 USDC on Base (eip155:8453) via x402. Read the base64 PAYMENT-REQUIRED header, pay, and retry with the PAYMENT-SIGNATURE header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredOut"}}}},"400":{"description":"Missing or over-long q (not charged)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissingQueryOut"}}}},"503":{"description":"Scoring temporarily unavailable; no payment is taken (x402 settles only on success). Retry shortly","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnavailableOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/shift":{"get":{"tags":["paid-lite"],"summary":"Sentiment change vs previous cached score","operationId":"shift_shift_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","description":"Exact Polymarket or Kalshi market question text, e.g. 'Will Bitcoin hit 150k in 2026'","examples":["Will Bitcoin hit 150k in 2026"],"default":"","title":"Q"},"description":"Exact Polymarket or Kalshi market question text, e.g. 'Will Bitcoin hit 150k in 2026'"}],"responses":{"200":{"description":"Paid result ($0.35 USDC on Base)","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ShiftOut"},{"$ref":"#/components/schemas/MissingQueryOut"}],"title":"Response 200 Shift Shift Get"}}}},"402":{"description":"Payment required: $0.35 USDC on Base (eip155:8453) via x402. Read the base64 PAYMENT-REQUIRED header, pay, and retry with the PAYMENT-SIGNATURE header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredOut"}}}},"400":{"description":"Missing or over-long q (not charged)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissingQueryOut"}}}},"503":{"description":"Scoring temporarily unavailable; no payment is taken (x402 settles only on success). Retry shortly","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnavailableOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/top":{"get":{"tags":["paid-lite"],"summary":"Three most-discussed markets on X with scores","operationId":"top_top_get","responses":{"200":{"description":"Paid result ($0.35 USDC on Base)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopOut"}}}},"402":{"description":"Payment required: $0.35 USDC on Base (eip155:8453) via x402. Read the base64 PAYMENT-REQUIRED header, pay, and retry with the PAYMENT-SIGNATURE header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredOut"}}}},"400":{"description":"Missing or over-long q (not charged)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissingQueryOut"}}}},"503":{"description":"Scoring temporarily unavailable; no payment is taken (x402 settles only on success). Retry shortly","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnavailableOut"}}}}}}}},"components":{"schemas":{"BriefOut":{"properties":{"question":{"type":"string","title":"Question","examples":["Will Bitcoin hit 150k in 2026"]},"score":{"type":"integer","maximum":100.0,"minimum":-100.0,"title":"Score"},"catalyst":{"type":"string","title":"Catalyst"},"volume_signal":{"type":"string","enum":["rising","falling","flat"],"title":"Volume Signal"},"shift":{"type":"integer","title":"Shift","description":"score minus previous cached score (0 if none)"},"score_before":{"type":"integer","title":"Score Before"},"summary":{"type":"string","title":"Summary","description":"One-line human/agent readable summary"},"scored_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scored At"},"odds":{"anyOf":[{"$ref":"#/components/schemas/OddsOut"},{"type":"null"}],"description":"Live Polymarket and Kalshi odds for the matched market"},"tier":{"type":"string","const":"brief","title":"Tier","default":"brief"},"degraded":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Degraded"}},"type":"object","required":["question","score","catalyst","volume_signal","shift","score_before","summary"],"title":"BriefOut"},"CatalogDiscovery":{"properties":{"keywords":{"items":{"type":"string"},"type":"array","title":"Keywords"},"bazaar":{"type":"string","title":"Bazaar"}},"type":"object","required":["keywords","bazaar"],"title":"CatalogDiscovery"},"CatalogOut":{"properties":{"service":{"type":"string","title":"Service"},"base_url":{"type":"string","title":"Base Url"},"network":{"type":"string","title":"Network"},"asset":{"type":"string","title":"Asset"},"pay_to":{"type":"string","title":"Pay To"},"discovery":{"$ref":"#/components/schemas/CatalogDiscovery"},"free":{"items":{"$ref":"#/components/schemas/CatalogRoute"},"type":"array","title":"Free"},"paid":{"items":{"$ref":"#/components/schemas/CatalogRoute"},"type":"array","title":"Paid"},"docs":{"type":"string","title":"Docs"},"demo_client":{"type":"string","title":"Demo Client"},"mcp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mcp"}},"type":"object","required":["service","base_url","network","asset","pay_to","discovery","free","paid","docs","demo_client"],"title":"CatalogOut"},"CatalogRoute":{"properties":{"method":{"type":"string","title":"Method"},"path":{"type":"string","title":"Path"},"price":{"type":"string","title":"Price"},"desc":{"type":"string","title":"Desc"},"query":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Query"}},"type":"object","required":["method","path","price","desc"],"title":"CatalogRoute"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthOut":{"properties":{"status":{"type":"string","const":"ok","title":"Status"},"routes":{"$ref":"#/components/schemas/HealthRoutes"},"price_lite":{"type":"string","title":"Price Lite","examples":["$0.01"]},"price_brief":{"type":"string","title":"Price Brief","examples":["$0.05"]},"price":{"type":"string","title":"Price"},"cache_ttl_sec":{"type":"integer","title":"Cache Ttl Sec"},"network":{"type":"string","title":"Network","examples":["eip155:8453"]},"test_mode":{"type":"boolean","title":"Test Mode"},"odds_index":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Odds Index","description":"Kalshi events index size, age and status"}},"type":"object","required":["status","routes","price_lite","price_brief","price","cache_ttl_sec","network","test_mode"],"title":"HealthOut"},"HealthRoutes":{"properties":{"free":{"items":{"type":"string"},"type":"array","title":"Free"},"paid_lite":{"items":{"type":"string"},"type":"array","title":"Paid Lite"},"paid_brief":{"items":{"type":"string"},"type":"array","title":"Paid Brief"}},"type":"object","required":["free","paid_lite","paid_brief"],"title":"HealthRoutes"},"KalshiOdds":{"properties":{"source":{"type":"string","const":"kalshi","title":"Source","default":"kalshi"},"market":{"type":"string","title":"Market","description":"Matched Kalshi event title (and outcome for multi-outcome events)"},"ticker":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ticker","description":"Kalshi market ticker"},"yes_price":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Yes Price","description":"Yes price (0..1): bid/ask midpoint, else last trade"},"implied_prob_pct":{"type":"number","maximum":100.0,"minimum":0.0,"title":"Implied Prob Pct"},"best_bid":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Best Bid"},"best_ask":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Best Ask"},"volume_24h":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Volume 24H"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"match_score":{"type":"number","title":"Match Score"}},"type":"object","required":["market","yes_price","implied_prob_pct","match_score"],"title":"KalshiOdds"},"MissingQueryOut":{"properties":{"error":{"type":"string","title":"Error","examples":["pass ?q=your+market+question"]}},"type":"object","required":["error"],"title":"MissingQueryOut"},"OddsOut":{"properties":{"polymarket":{"anyOf":[{"$ref":"#/components/schemas/PolymarketOdds"},{"type":"null"}],"description":"Null when no open market matches q closely enough"},"kalshi":{"anyOf":[{"$ref":"#/components/schemas/KalshiOdds"},{"type":"null"}],"description":"Null when no open Kalshi market matches q closely enough"},"fetched_at":{"type":"string","title":"Fetched At"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"odds_unavailable if Polymarket did not respond"},"kalshi_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kalshi Error","description":"kalshi_index_warming or kalshi_unavailable"}},"type":"object","required":["fetched_at"],"title":"OddsOut"},"PaymentRequiredOut":{"properties":{"x402Version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X402Version"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"accepts":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Accepts"}},"type":"object","title":"PaymentRequiredOut","description":"x402 v2: payment requirements are in the base64 PAYMENT-REQUIRED header."},"PolymarketOdds":{"properties":{"source":{"type":"string","const":"polymarket","title":"Source","default":"polymarket"},"market":{"type":"string","title":"Market","description":"Matched Polymarket market question"},"yes_price":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Yes Price","description":"Yes outcome price (0..1)"},"implied_prob_pct":{"type":"number","maximum":100.0,"minimum":0.0,"title":"Implied Prob Pct","description":"yes_price as a percentage"},"best_bid":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Best Bid"},"best_ask":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Best Ask"},"volume_24h":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Volume 24H"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"match_score":{"type":"number","title":"Match Score","description":"0..1 word-overlap score between q and the matched market"}},"type":"object","required":["market","yes_price","implied_prob_pct","match_score"],"title":"PolymarketOdds"},"PricingLadder":{"properties":{"free":{"items":{"type":"string"},"type":"array","title":"Free"},"lite":{"$ref":"#/components/schemas/PricingTier"},"full":{"$ref":"#/components/schemas/PricingTier"}},"type":"object","required":["free","lite","full"],"title":"PricingLadder"},"PricingOut":{"properties":{"currency":{"type":"string","const":"USDC","title":"Currency"},"network":{"type":"string","title":"Network"},"ladder":{"$ref":"#/components/schemas/PricingLadder"},"price_lite":{"type":"string","title":"Price Lite"},"price_brief":{"type":"string","title":"Price Brief"},"notes":{"type":"string","title":"Notes"}},"type":"object","required":["currency","network","ladder","price_lite","price_brief","notes"],"title":"PricingOut"},"PricingTier":{"properties":{"price":{"type":"string","title":"Price"},"routes":{"items":{"type":"string"},"type":"array","title":"Routes"}},"type":"object","required":["price","routes"],"title":"PricingTier"},"SampleOut":{"properties":{"demo":{"type":"boolean","title":"Demo"},"note":{"type":"string","title":"Note"},"example_request":{"type":"string","title":"Example Request"},"example_response":{"$ref":"#/components/schemas/SentimentOut"}},"type":"object","required":["demo","note","example_request","example_response"],"title":"SampleOut"},"SentimentOut":{"properties":{"question":{"type":"string","title":"Question","examples":["Will Bitcoin hit 150k in 2026"]},"score":{"type":"integer","maximum":100.0,"minimum":-100.0,"title":"Score","description":"X sentiment: -100 very bearish .. 100 very bullish"},"catalyst":{"type":"string","title":"Catalyst","description":"One-sentence driver of current chatter","examples":["ETF inflows"]},"volume_signal":{"type":"string","enum":["rising","falling","flat"],"title":"Volume Signal","description":"Is discussion volume rising, falling or flat"},"scored_at":{"type":"string","title":"Scored At","description":"ISO-8601 UTC time the score was computed"},"tier":{"type":"string","const":"sentiment","title":"Tier","default":"sentiment"},"degraded":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Degraded","description":"Set when a cached score is served because live scoring is limited"}},"type":"object","required":["question","score","catalyst","volume_signal","scored_at"],"title":"SentimentOut"},"ShiftOut":{"properties":{"question":{"type":"string","title":"Question","examples":["Will Bitcoin hit 150k in 2026"]},"score_now":{"type":"integer","maximum":100.0,"minimum":-100.0,"title":"Score Now"},"score_before":{"type":"integer","maximum":100.0,"minimum":-100.0,"title":"Score Before"},"shift":{"type":"integer","title":"Shift","description":"score_now minus score_before"},"catalyst":{"type":"string","title":"Catalyst"},"scored_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scored At"},"prior_scored_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prior Scored At"},"note":{"anyOf":[{"type":"string","const":"no_prior_score"},{"type":"null"}],"title":"Note","description":"Present when there is no earlier score to compare"},"degraded":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Degraded"}},"type":"object","required":["question","score_now","score_before","shift","catalyst"],"title":"ShiftOut"},"TopMarket":{"properties":{"question":{"type":"string","title":"Question"},"score":{"type":"integer","maximum":100.0,"minimum":-100.0,"title":"Score"},"catalyst":{"type":"string","title":"Catalyst"},"volume_signal":{"type":"string","enum":["rising","falling","flat"],"title":"Volume Signal"},"scored_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scored At"}},"type":"object","required":["question","score","catalyst","volume_signal"],"title":"TopMarket"},"TopOut":{"properties":{"markets":{"items":{"$ref":"#/components/schemas/TopMarket"},"type":"array","title":"Markets","description":"Up to 3 most-discussed markets on X"},"scored_at":{"type":"string","title":"Scored At"},"degraded":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Degraded"}},"type":"object","required":["markets","scored_at"],"title":"TopOut"},"UnavailableOut":{"properties":{"error":{"type":"string","title":"Error","examples":["rate_limited"]},"question":{"type":"string","title":"Question"},"hint":{"type":"string","title":"Hint"}},"type":"object","required":["error","question","hint"],"title":"UnavailableOut"},"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"}}},"tags":[{"name":"free","description":"Discovery routes, no payment"},{"name":"paid-lite","description":"x402, $0.35 USDC on Base"},{"name":"paid-full","description":"x402, $0.35 USDC on Base"}]}