> ## Documentation Index
> Fetch the complete documentation index at: https://docs.odds-api.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SDKs & Libraries

> Official SDKs, wrappers, and tools for Odds-API.io. Get started faster with our Python, Node.js, and MCP integrations.

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

<CardGroup cols={2}>
  <Card title="Python SDK" icon="python" href="https://github.com/odds-api-io/odds-api-python">
    Full-featured Python client with sync and async support. Available on PyPI.
  </Card>

  <Card title="Node.js SDK" icon="node-js" href="https://github.com/odds-api-io/odds-api-node">
    TypeScript-first SDK with full type definitions. Works with ESM and CommonJS.
  </Card>

  <Card title="MCP Server" icon="robot" href="https://github.com/odds-api-io/odds-api-mcp-server">
    Model Context Protocol server for AI tools like Claude, Cursor, and VS Code.
  </Card>
</CardGroup>

***

## Python

Install the SDK:

```bash theme={null}
pip install odds-api-io
```

### Quick Start

```python theme={null}
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

```python theme={null}
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

```python theme={null}
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')}")
```

<Card title="View on GitHub" icon="github" href="https://github.com/odds-api-io/odds-api-python">
  Full documentation, examples, and API reference.
</Card>

***

## Node.js / TypeScript

Install the SDK:

```bash theme={null}
npm install odds-api-io
```

### Quick Start (TypeScript)

```typescript theme={null}
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)

```javascript theme={null}
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

```typescript theme={null}
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}`);
  });
});
```

<Card title="View on GitHub" icon="github" href="https://github.com/odds-api-io/odds-api-node">
  Full documentation, examples, and API reference.
</Card>

***

## MCP Server (AI Tools)

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

### Claude Code CLI

```bash theme={null}
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`):

```json theme={null}
{
  "mcpServers": {
    "odds-api": {
      "command": "npx",
      "args": ["-y", "odds-api-mcp-server"],
      "env": {
        "ODDS_API_KEY": "your-api-key"
      }
    }
  }
}
```

### Cursor

Add to your MCP settings:

```json theme={null}
{
  "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"*

<Card title="View on GitHub" icon="github" href="https://github.com/odds-api-io/odds-api-mcp-server">
  Installation guide and available tools.
</Card>

***

## Error Handling

All SDKs include custom error classes for clean error handling:

<CodeGroup>
  ```python Python theme={null}
  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")
  ```

  ```typescript Node.js theme={null}
  import {
    OddsAPIClient,
    InvalidAPIKeyError,
    RateLimitExceededError,
    NotFoundError,
  } from 'odds-api-io';

  try {
    const events = await client.getEvents({ sport: 'basketball' });
  } catch (error) {
    if (error instanceof InvalidAPIKeyError) {
      console.error('Invalid API key');
    } else if (error instanceof RateLimitExceededError) {
      console.error('Rate limit exceeded');
    } else if (error instanceof NotFoundError) {
      console.error('Not found');
    }
  }
  ```
</CodeGroup>

***

## 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:

```python theme={null}
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)
```

<Tip>
  See the full WebSocket + prefetch examples in the [Python SDK](https://github.com/odds-api-io/odds-api-python/blob/main/examples/websocket_feed.py) and [Node.js SDK](https://github.com/odds-api-io/odds-api-node/blob/main/examples/websocket-feed.ts) repos.
</Tip>

***

## All Repositories

| Repository                                                                | Type        | Install                   | Links                                                    |
| ------------------------------------------------------------------------- | ----------- | ------------------------- | -------------------------------------------------------- |
| [odds-api-python](https://github.com/odds-api-io/odds-api-python)         | Python SDK  | `pip install odds-api-io` | [PyPI](https://pypi.org/project/odds-api-io/)            |
| [odds-api-node](https://github.com/odds-api-io/odds-api-node)             | Node.js SDK | `npm install odds-api-io` | [npm](https://www.npmjs.com/package/odds-api-io)         |
| [odds-api-mcp-server](https://github.com/odds-api-io/odds-api-mcp-server) | MCP Server  | `npx odds-api-mcp-server` | [npm](https://www.npmjs.com/package/odds-api-mcp-server) |

<Note>
  **Need an SDK in another language?** Let us know at [hello@odds-api.io](mailto:hello@odds-api.io)
</Note>
