Skip to main content
Use our official SDKs to integrate Odds-API.io into your project in minutes. Each SDK wraps the full REST API with type safety, error handling, and built-in best practices.

Official SDKs


Python

Install the SDK:
pip install odds-api-io

Quick Start

from odds_api import OddsAPIClient

client = OddsAPIClient(api_key="YOUR_API_KEY")

# Get all sports
sports = client.get_sports()

# Get Premier League events
events = client.get_events(sport="football", league="england-premier-league")

# Get odds from multiple bookmakers
odds = client.get_event_odds(
    event_id=events[0]['id'],
    bookmakers="Bet365,SingBet,FanDuel"
)

# Display odds with direct bet links
for bookie, markets in odds['bookmakers'].items():
    ml = next((m for m in markets if m['name'] == 'ML'), None)
    if ml:
        o = ml['odds'][0]
        print(f"{bookie}: H {o['home']} | D {o['draw']} | A {o['away']}")

# Direct bet links
for bookie, url in odds.get('urls', {}).items():
    print(f"  Bet at {bookie}: {url}")

Async Support

import asyncio
from odds_api import AsyncOddsAPIClient

async def main():
    async with AsyncOddsAPIClient(api_key="YOUR_API_KEY") as client:
        sports = await client.get_sports()
        events = await client.get_events(sport="basketball", league="usa-nba")
        print(f"Found {len(events)} NBA events")

asyncio.run(main())

Find Value Bets

value_bets = client.get_value_bets(
    bookmaker="Bet365",
    include_event_details=True
)

for bet in sorted(value_bets, key=lambda x: x['expectedValue'], reverse=True)[:5]:
    ev = bet['expectedValue'] - 100
    print(f"+{ev:.1f}% EV | {bet['market']['name']} | {bet['betSide']} @ {bet['bookmakerOdds'][bet['betSide']]}")
    print(f"  Bet link: {bet['bookmakerOdds'].get('href', 'N/A')}")

View on GitHub

Full documentation, examples, and API reference.

Node.js / TypeScript

Install the SDK:
npm install odds-api-io

Quick Start (TypeScript)

import { OddsAPIClient } from 'odds-api-io';

const client = new OddsAPIClient({ apiKey: 'YOUR_API_KEY' });

// Get all sports
const sports = await client.getSports();

// Get Premier League events
const events = await client.getEvents({
  sport: 'football',
  league: 'england-premier-league',
});

// Get odds from multiple bookmakers
const odds = await client.getEventOdds({
  eventId: events[0].id,
  bookmakers: 'Bet365,SingBet,FanDuel',
});

// Display odds with direct bet links
for (const [bookie, markets] of Object.entries(odds.bookmakers)) {
  const ml = markets.find(m => m.name === 'ML');
  if (ml?.odds?.[0]) {
    const o = ml.odds[0];
    console.log(`${bookie}: H ${o.home} | D ${o.draw} | A ${o.away}`);
  }
}

// Direct bet links
for (const [bookie, url] of Object.entries(odds.urls || {})) {
  console.log(`  Bet at ${bookie}: ${url}`);
}

Quick Start (JavaScript)

const { OddsAPIClient } = require('odds-api-io');

const client = new OddsAPIClient({ apiKey: 'YOUR_API_KEY' });

const sports = await client.getSports();
console.log(`Found ${sports.length} sports`);

Find Arbitrage Opportunities

const arbs = await client.getArbitrageBets({
  bookmakers: 'Bet365,SingBet',
  limit: 10,
  includeEventDetails: true,
});

arbs.forEach(arb => {
  console.log(`${arb.profitMargin.toFixed(2)}% profit`);
  arb.legs.forEach(leg => {
    console.log(`  ${leg.bookmaker} | ${leg.side} @ ${leg.odds}`);
  });
});

View on GitHub

Full documentation, examples, and API reference.

MCP Server (AI Tools)

Use Odds-API.io directly from AI coding tools like Claude, Cursor, and VS Code.

Claude Code CLI

claude mcp add odds-api --env ODDS_API_KEY="your-api-key" -- npx -y odds-api-mcp-server

Claude Desktop

Add to your config (~/.config/claude/claude_desktop_config.json):
{
  "mcpServers": {
    "odds-api": {
      "command": "npx",
      "args": ["-y", "odds-api-mcp-server"],
      "env": {
        "ODDS_API_KEY": "your-api-key"
      }
    }
  }
}

Cursor

Add to your MCP settings:
{
  "odds-api": {
    "command": "npx",
    "args": ["-y", "odds-api-mcp-server"],
    "env": {
      "ODDS_API_KEY": "your-api-key"
    }
  }
}
Once configured, ask your AI assistant things like:
  • “Get me upcoming Premier League matches with odds”
  • “Find value bets from Bet365”
  • “Show arbitrage opportunities”

View on GitHub

Installation guide and available tools.

Error Handling

All SDKs include custom error classes for clean error handling:
from odds_api import (
    OddsAPIClient,
    InvalidAPIKeyError,
    RateLimitExceededError,
    NotFoundError,
)

try:
    events = client.get_events(sport="basketball")
except InvalidAPIKeyError:
    print("Invalid API key")
except RateLimitExceededError:
    print("Rate limit exceeded - wait before retrying")
except NotFoundError:
    print("Resource not found")

WebSocket + SDK

Combine REST SDKs with WebSocket for a complete solution. Pre-fetch all odds via REST, then switch to WebSocket for real-time updates:
from odds_api import OddsAPIClient
import websocket, json

# Step 1: Initial snapshot via REST SDK
client = OddsAPIClient(api_key="YOUR_API_KEY")
events = client.get_events(sport="football", league="england-premier-league")

odds_store = {}
for event in events:
    odds = client.get_event_odds(event_id=event['id'], bookmakers="Bet365,SingBet")
    odds_store[str(event['id'])] = odds.get('bookmakers', {})

print(f"Loaded {len(odds_store)} events via REST")

# Step 2: Connect to WebSocket for live updates
def on_message(ws, message):
    data = json.loads(message)
    if data['type'] == 'updated':
        odds_store[data['id']] = {data['bookie']: data['markets']}
        print(f"Updated: Event {data['id']} | {data['bookie']}")

ws = websocket.WebSocketApp(
    f"wss://api.odds-api.io/v3/ws?apiKey=YOUR_API_KEY&markets=ML,Spread,Totals&sport=football",
    on_message=on_message
)
ws.run_forever(ping_interval=30)
See the full WebSocket + prefetch examples in the Python SDK and Node.js SDK repos.

All Repositories

RepositoryTypeInstallLinks
odds-api-pythonPython SDKpip install odds-api-ioPyPI
odds-api-nodeNode.js SDKnpm install odds-api-ionpm
odds-api-mcp-serverMCP Servernpx odds-api-mcp-servernpm
Need an SDK in another language? Let us know at [email protected]