Providers

A provider is a read-only adapter that fetches from one source and returns the normalized Market shape. PredictionKit ships two; you can add your own.

Polymarket

import { polymarket } from '@prediction-kit/core';
polymarket({ baseUrl?, minIntervalMs?, fetchImpl? });

Backed by the public Gamma API (no auth). Notable handling:

Kalshi

import { kalshi } from '@prediction-kit/core';
kalshi({ baseUrl?, minIntervalMs?, fetchImpl? });

Backed by the public v2 REST API (no auth). Notable handling:

The unified client

const client = createClient({ providers: [polymarket(), kalshi()] });

Custom providers

Implement the PredictionProvider interface and pass it to createClient — every component and hook works with it unchanged.

import type { PredictionProvider } from '@prediction-kit/core';

const myProvider: PredictionProvider = {
  source: 'polymarket', // a registered ProviderSource
  async getMarket(nativeId) {
    /* ... */
  },
  async getMarkets(opts) {
    /* ... */
  },
  async getTrendingMarkets(opts) {
    /* ... */
  },
};