SimpleFunctions

Prediction Market Search API.

One query across Kalshi and Polymarket — normalized, with probabilities and next actions attached.

The prediction market search API runs LLM-driven keyword extraction over a natural-language query, fans the search across Kalshi and Polymarket, and returns one normalized response — titles, tickers, prices, volumes, and a next-actions graph the caller can hit directly. Built for agents and search boxes, free tier with rate-limited unauthenticated access, higher tiers with a Bearer token.

Realist oil painting in Vermeer light style — 16th-century cartographer at the draftsman's table, charts and instruments arrayed

Cartographer at the draftsman's table — every query is a position on the map.

An aggregated LLM answer — not a raw market list

This is the differentiator. The prediction market search API doesn't just return matching contracts — it runs an LLM aggregator over Kalshi, Polymarket, and the surrounding context (FRED macro anchors, traditional ETFs, internal content) and produces a synthesized answer plus the named key factors driving it. The matched markets come back too; the aggregator is what makes the response usable as one block.

One natural-language query → one synthesized answer → a small set of key factors → the markets that price them.

sf query exposes the same aggregator from a terminal.

Queryus recession 2026
aggregated

LLM answer

Prediction markets currently assign a 26% probability of a U.S. recession occurring by the end of 2026. This outlook reflects a backdrop where the unemployment rate is at 4.3% and markets heavily favor that the Federal Reserve will implement zero rate cuts in 2026 (57% probability).

Key factors

  • ·26% recession probability (Polymarket)
  • ·57% expectation of zero Fed rate cuts in 2026
  • ·4.3% unemployment rate (FRED, current)

Top matches

US recession by end of 2026?

polymarket

26¢

Will nominal U.S. GDP growth be above 1.0% in Q1 2026?

kalshi

91¢

How many Fed rate cuts in 2026?: 0 (0 bps)

polymarket

57¢
Querytrump approval rating
aggregated

LLM answer

Current prediction markets suggest Donald Trump's approval rating is likely to drop below 38% for the period between December 2025 and December 2026, with an implied probability of 85%. Markets also indicate a 54% likelihood that his approval rating lands in the 39.0–39.4% bucket for May 1.

Key factors

  • ·85% chance of approval below 38% (Dec 2025 – Dec 2026)
  • ·73% chance of approval below 37% over the same window
  • ·54% chance of 39.0–39.4% approval reading on May 1

Top matches

Trump approval rating below 38% (Dec 2025 – Dec 2026)

kalshi

85¢

Trump approval rating below 37% (Dec 2025 – Dec 2026)

kalshi

73¢

Trump approval rating on May 1?: 39.0–39.4

polymarket

54¢

These cards render real responses from /api/public/query as a human-shaped UI would. The same JSON powers programmatic callers — see the endpoint shape below for the wire format and the example responses further down for the full payloads.

Endpoint and parameters

One endpoint, five knobs. q is required; everything else has a sensible default. The endpoint is part of the prediction market search API on the public surface.

Param
Required
Meaning
Example
q
yes
The natural-language query. The endpoint runs LLM-driven keyword extraction, so phrasing like users actually type works.
"fed rate cut december"
mode
no
raw skips LLM synthesis (fastest). full includes the synthesized answer + key factors. Default: full.
raw / full
sources
no
Comma-separated source list. Default is all: kalshi, polymarket, x, content, traditional.
kalshi,polymarket
limit
no
Max markets per venue. Default 10, max 20.
10
model
no
LLM tier — cheap (default), medium, heavy (heavy requires auth).
medium

Cross-venue normalization

Same fields across both venues — the prediction market search API hides the per-venue quirks behind a single response shape. Kalshi uses tickers; Polymarket uses slugs. Everything else aligns.

Field
Kalshi
Polymarket
title
Question text from the contract
Outcome label (often longer, includes the slate)
ticker / slug
Kalshi market ticker (e.g. KXRATECUT-26DEC31)
Polymarket slug (e.g. how-many-fed-rate-cuts-in-2026)
price
YES price in cents (0–100)
YES outcome price scaled to 0–100
volume
Notional traded volume (USD)
Notional traded volume (USDC)
pageUrl
simplefunctions.dev/markets/<ticker>
simplefunctions.dev/markets/<slug>
apiUrl
/api/public/market/<ticker> for full detail
/api/public/market/<slug> for full detail
inspectUrl
/api/agent/inspect/<ticker> — agent-shaped depth
/api/agent/inspect/<slug> — agent-shaped depth

Next-actions graph

Every response carries a nextActions block — fully qualified URLs the caller (usually an agent) can fetch directly. Two arrays: inspect for depth on top matches, related for adjacent endpoints worth firing.

inspect[]

For every top match, the agent-shaped inspect URL — full orderbook depth, indicator stack, recent flow, and structured rationale. The "what to look at next" link.

related[]

Adjacent endpoints worth firing — broader scan, indicator screen, contagion gaps, trade ideas. Each is a method + url object the agent can call directly without parsing.

Three example responses

Macro, crypto, election. Real shapes (abridged for readability). Every URL in the response is fully qualified.

Macro · fed rate cutJSON
GET https://simplefunctions.dev/api/public/query?q=fed+rate+cut+december&limit=2

{
  "query": "fed rate cut december",
  "answer": "Found markets matching the December Fed cut question. Top: 'Will the Federal Reserve cut rates before 2027?' @ 51¢.",
  "keyFactors": [
    "Will the Federal Reserve cut rates before 2027?: 51¢ on kalshi",
    "How many Fed rate cuts in 2026?: 0 (0 bps): 57¢ on polymarket"
  ],
  "kalshi": [
    {
      "title": "Will the Federal Reserve cut rates before 2027?",
      "ticker": "KXRATECUT-26DEC31",
      "price": 51,
      "volume": 102953.11,
      "pageUrl": "https://simplefunctions.dev/markets/KXRATECUT-26DEC31",
      "apiUrl": "https://simplefunctions.dev/api/public/market/KXRATECUT-26DEC31",
      "inspectUrl": "https://simplefunctions.dev/api/agent/inspect/KXRATECUT-26DEC31"
    }
  ],
  "polymarket": [
    {
      "title": "How many Fed rate cuts in 2026?: 0 (0 bps)",
      "slug": "how-many-fed-rate-cuts-in-2026",
      "price": 57,
      "volume": 3741066.13,
      "pageUrl": "https://simplefunctions.dev/markets/how-many-fed-rate-cuts-in-2026",
      "apiUrl": "https://simplefunctions.dev/api/public/market/how-many-fed-rate-cuts-in-2026",
      "inspectUrl": "https://simplefunctions.dev/api/agent/inspect/how-many-fed-rate-cuts-in-2026"
    }
  ],
  "meta": { "sources": ["kalshi","polymarket"], "mode": "full", "latencyMs": 4120 },
  "nextActions": {
    "inspect": [
      { "method": "GET", "url": "https://simplefunctions.dev/api/agent/inspect/KXRATECUT-26DEC31" }
    ],
    "related": [
      { "method": "GET", "url": "https://simplefunctions.dev/api/public/screen?keyword=fed%20rate%20cut" }
    ]
  }
}
Crypto · bitcoin etfJSON
GET https://simplefunctions.dev/api/public/query?q=bitcoin+etf+approval&mode=raw&limit=2

{
  "query": "bitcoin etf approval",
  "kalshi": [
    {
      "title": "Will the SEC approve a spot Solana ETF in 2026?",
      "ticker": "KXSOLANAETF-26",
      "price": 38,
      "volume": 41200.50,
      "pageUrl": "https://simplefunctions.dev/markets/KXSOLANAETF-26",
      "apiUrl": "https://simplefunctions.dev/api/public/market/KXSOLANAETF-26",
      "inspectUrl": "https://simplefunctions.dev/api/agent/inspect/KXSOLANAETF-26"
    }
  ],
  "polymarket": [
    {
      "title": "Will a new spot crypto ETF be approved in 2026?",
      "slug": "spot-crypto-etf-approved-2026",
      "price": 64,
      "volume": 188200.00,
      "pageUrl": "https://simplefunctions.dev/markets/spot-crypto-etf-approved-2026",
      "apiUrl": "https://simplefunctions.dev/api/public/market/spot-crypto-etf-approved-2026",
      "inspectUrl": "https://simplefunctions.dev/api/agent/inspect/spot-crypto-etf-approved-2026"
    }
  ],
  "meta": { "sources": ["kalshi","polymarket"], "mode": "raw", "latencyMs": 215 },
  "nextActions": {
    "inspect": [
      { "method": "GET", "url": "https://simplefunctions.dev/api/agent/inspect/spot-crypto-etf-approved-2026" }
    ],
    "related": [
      { "method": "GET", "url": "https://simplefunctions.dev/api/public/scan?q=crypto%20etf" }
    ]
  }
}
Election · 2026 senateJSON
GET https://simplefunctions.dev/api/public/query?q=2026+us+midterms+senate&limit=2

{
  "query": "2026 us midterms senate",
  "answer": "Markets pricing 2026 US Senate composition. Top contracts cover the Senate balance and individual state outcomes.",
  "kalshi": [
    {
      "title": "Will Republicans control the US Senate after 2026 midterms?",
      "ticker": "KXSENATEGOP-26",
      "price": 56,
      "volume": 612400.00,
      "pageUrl": "https://simplefunctions.dev/markets/KXSENATEGOP-26",
      "apiUrl": "https://simplefunctions.dev/api/public/market/KXSENATEGOP-26",
      "inspectUrl": "https://simplefunctions.dev/api/agent/inspect/KXSENATEGOP-26"
    }
  ],
  "polymarket": [
    {
      "title": "Senate control after 2026 midterms",
      "slug": "senate-control-after-2026-midterms",
      "price": 54,
      "volume": 2140000.00,
      "pageUrl": "https://simplefunctions.dev/markets/senate-control-after-2026-midterms",
      "apiUrl": "https://simplefunctions.dev/api/public/market/senate-control-after-2026-midterms",
      "inspectUrl": "https://simplefunctions.dev/api/agent/inspect/senate-control-after-2026-midterms"
    }
  ],
  "meta": { "sources": ["kalshi","polymarket"], "mode": "full", "latencyMs": 3780 },
  "nextActions": {
    "inspect": [
      { "method": "GET", "url": "https://simplefunctions.dev/api/agent/inspect/senate-control-after-2026-midterms" }
    ],
    "related": [
      { "method": "GET", "url": "https://simplefunctions.dev/api/public/query-gov?q=senate%20composition" }
    ]
  }
}

Use cases

Four shipped integrations of the prediction market search API. The endpoint is deliberately minimal so it composes — most production callers chain it into a follow-up call.

Agent author

Natural-language search inside an agent loop — the LLM hands a user query straight to /api/public/query, gets normalized markets back, picks one to inspect or trade against.

Dashboard search

A search box on a research or trading dashboard — typing "iran oil" returns Kalshi + Polymarket contracts side by side with prices, plus traditional ETFs for cross-asset context.

Research lookup

Quick "is there a market for this?" check — a researcher pastes a thesis fragment and gets the list of contracts that already price it, including content (blog / opinion) the team has written about it.

News integration

Live probability snippets attached to news articles — the article body is the query, the response carries the matching market and price.

Read next from the library

Matched from SimpleFunctions blog, opinions, technical guides, concepts, and learn pages.

Browse library
Blogtech

MCP Servers for Prediction Markets: Connect Claude Code to Kalshi and Polymarket

Connect Claude Code, Cursor, or Cline to Kalshi and Polymarket prediction markets via MCP. One-line setup, 18 tools, real-time market data for AI agents.

Technicalpatterns

Cross-Venue Edge Detection: Kalshi vs Polymarket

How to detect and exploit price divergences between Kalshi and Polymarket. Covers why pure arbitrage fails, cross-venue edge detection algorithms, and thesis-informed trading strategies.

Conceptmethodology

Cross-Venue Convergence Dynamics: Why Kalshi and Polymarket Converge — and When They Don't

Why the same outcome on Kalshi and Polymarket usually trades within 2-5 cents — and the three specific things that cause the gap to widen. Diagnostic guide and worked convergence trade.

Blogtech

We Let an LLM Agent Autonomously Manage Kalshi Positions — Here's Its Architecture

How we built an LLM agent that autonomously manages prediction market positions on Kalshi — architecture, risk gates, handoff notes, and design decisions.

Blogmarkets

Kalshi vs Polymarket: Which Prediction Market Should You Trade?

In-depth comparison of Kalshi and Polymarket for prediction market traders. Regulatory structure, liquidity, fees, API tooling, and cross-venue trading with SimpleFunctions.

Blogproduct

Wikipedia for Probabilities

We built a probability index covering 3,200+ events across Kalshi and Polymarket. Cross-venue, liquidity-weighted, updated every 15 minutes. Designed for AI agents, indexed for Google. The canonical answer layer for event probabilities.

FAQ

What is the prediction market search API?

A single REST endpoint at /api/public/query that takes a natural-language query and returns an aggregated LLM answer — a synthesized one-paragraph take, the named key factors driving it, and the matched markets across Kalshi, Polymarket, internal content, and traditional ETFs. The aggregator is the differentiator vs raw keyword search; the response also carries a next-actions graph so agents can chain to inspect or related endpoints without parsing.

What is the aggregated LLM answer?

For every query, the endpoint runs an LLM synthesis pass over the matched markets, FRED macro anchors, traditional ETFs, and internal content — and produces a one-paragraph answer in plain English plus a short list of key factors (typically 3 bullets). The synthesis is what lets a search box or an agent treat one query as one answer; the raw markets are still in the response for callers that want them.

How does keyword matching work?

The endpoint runs an LLM-driven query understanding step that extracts 2–3 search variants, ranking keywords, optional price targets, and any year mention. Both venue catalogs are searched with all variants; results are de-duplicated and ranked by overlap with the ranking keywords plus volume.

How are results ranked?

A composite score: keyword overlap with the ranking keywords (high weight), notional volume (medium weight), and recency of contract activity (light weight). Top matches per venue are returned up to the limit (default 10 per venue, max 20).

What is the latency?

mode=raw is single-digit hundreds of milliseconds — venue catalog search only. mode=full (default) adds the LLM synthesis step; expect a few seconds depending on the model tier and result size. Use raw for agent loops that want the matches without the synthesized answer.

What does the JSON shape look like?

Top-level fields: query (echoed), contextSuggestion (slug), answer (synthesized text), keyFactors (string[]), kalshi (Match[]), polymarket (Match[]), traditional (Etf[]), x (Post[]), theses (Match[]), content (Doc[]), meta (sources, mode, latencyMs, ts), nextActions ({ inspect: Action[], related: Action[] }). Match records carry title, ticker or slug, price, volume, pageUrl, apiUrl, inspectUrl.

Is there a free tier?

Yes. Unauthenticated access is rate-limited to 10 requests per minute and uses the cheap LLM tier. Add a Bearer token (Authorization: Bearer sf_live_xxx) for 60/min and the medium tier; auth + heavy tier unlocks the heaviest model.

Does it work for agents?

Yes — the response is shaped for tool-use. The nextActions block names the next URLs to call (inspect for depth, related for adjacent endpoints). Agents typically use mode=raw on the first hop (cheap, fast), then call the inspect URL for the chosen ticker on the second hop.

How is this different from /api/public/scan?

scan is the literal keyword search — exact substring matching on titles and tags, no LLM, fastest. query is LLM-enhanced — it extracts keywords, runs multiple search variants, joins traditional ETFs, attaches an answer. Use scan when you already know the keyword; use query when the user is typing in natural language.

How is this different from /screen?

screen is filter-driven discovery — give it indicator constraints (IY > 12%, spread < 3¢, regime = neutral) and it returns markets matching the filter. query is keyword-driven discovery — give it words, it returns matches. Different intents; many production agents call both.

How does pagination work?

Per-venue limit is the only pagination knob (default 10, max 20). Beyond that, the endpoint expects the caller to refine the query — narrower keywords, scoped sources, or a follow-up call to /api/public/scan with structured filters. The endpoint is designed for top-N retrieval, not full-catalog browsing.

Which languages are supported?

Queries are interpreted by the LLM, which handles English, Spanish, French, Portuguese, Mandarin, Japanese, German, and most European languages well. Market titles themselves come from the venues — Kalshi is English-only; Polymarket is mostly English with some non-English slates.

Are next-actions URLs absolute?

Yes. Every URL in the response — pageUrl, apiUrl, inspectUrl, nextActions[].url — is fully qualified (https://simplefunctions.dev/...). Agents can pass them directly to fetch without joining against a base URL.

Related surfaces