Odds-API.io Python SDK
Official Python SDK for Odds-API.io - Real-time sports betting odds from 365+ bookmakers.
Building with AI? See the AI and vibe coding guide. Prefer JavaScript? Check out the Node.js SDK.
🚀 Features
- ⚡ Fast & Reliable - Built on requests and aiohttp for both sync and async workflows
- 🏀 34 Sports - Basketball, football, tennis, baseball, and more
- 📊 365+ Bookmakers - Comprehensive odds coverage from major sportsbooks worldwide
- 💰 Arbitrage Detection - Find risk-free betting opportunities across bookmakers
- 📈 Value Bets - Identify positive expected value betting opportunities
- 🔴 Live Events - Real-time in-play event tracking and odds
- 🔍 Advanced Search - Search events, participants, and leagues
- ✨ Type Hints - Full type annotations for better IDE support
- 🐍 Modern Python - Supports Python 3.8+
📦 Installation
pip install odds-api-io
🔑 Get Your API Key
Sign up at odds-api.io to get started. Free tier includes:
- 100 requests/hour
- Access to all endpoints
- No credit card required
📚 Documentation
Full API documentation is available at docs.odds-api.io
🏃 Quick Start
Synchronous Client
from odds_api import OddsAPIClient
# Initialize the client
client = OddsAPIClient(api_key="your_api_key_here")
# Get available sports
sports = client.get_sports()
print(f"Found {len(sports)} sports")
# Get upcoming NBA events
events = client.get_events(sport="basketball", league="usa-nba")
# Search for specific games
lakers_games = client.search_events(query="Lakers")
# Get live basketball events
live = client.get_live_events(sport="basketball")
# Find arbitrage opportunities
arb_bets = client.get_arbitrage_bets(
bookmakers="singbet,bet365",
limit=10,
include_event_details=True
)
# Close the client when done
client.close()
Asynchronous Client
import asyncio
from odds_api import AsyncOddsAPIClient
async def main():
# Use async context manager
async with AsyncOddsAPIClient(api_key="your_api_key_here") as client:
# Get sports
sports = await client.get_sports()
# Get upcoming events
events = await client.get_events(sport="basketball", league="usa-nba")
# Find value bets
value_bets = await client.get_value_bets(
bookmaker="singbet",
include_event_details=True
)
print(f"Found {len(value_bets)} value betting opportunities")
# Run async code
asyncio.run(main())
Context Manager (Recommended)
# Sync
with OddsAPIClient(api_key="your_api_key") as client:
sports = client.get_sports()
# Async
async with AsyncOddsAPIClient(api_key="your_api_key") as client:
sports = await client.get_sports()
📖 Examples
Check out the examples/ directory for more detailed examples:
- basic_usage.py - Getting started with the SDK
- async_example.py - Using the async client
- arbitrage_finder.py - Finding arbitrage opportunities
- value_bets.py - Identifying value bets
- settle_bets.py - Grading stored bets as won, lost or void
- odds_tracking.py - Tracking odds movements
- fair-odds-and-closing-lines.ipynb - Notebook: devigging, bookmaker margins, EV against a sharp line and closing line value (view on nbviewer)
🔧 API Reference
Sports & Leagues
| Method | Description | Docs |
|---|---|---|
get_sports() |
Get all available sports | 📖 |
get_leagues(sport) |
Get leagues for a sport | 📖 |
Events
| Method | Description | Docs |
|---|---|---|
get_events(sport, **filters) |
Get events with filters | 📖 |
get_event_by_id(event_id) |
Get specific event details | 📖 |
get_live_events(sport) |
Get currently live events | 📖 |
search_events(query) |
Search events by keyword | 📖 |
Odds
| Method | Description | Docs |
|---|---|---|
get_event_odds(event_id, bookmakers) |
Get odds for an event | 📖 |
get_odds_movement(event_id, bookmaker, market) |
Track odds changes | 📖 |
get_odds_for_multiple_events(event_ids, bookmakers) |
Get odds for multiple events | 📖 |
get_updated_odds_since_timestamp(since, bookmaker, sport, markets) |
Get recently updated odds. markets is required by the API from 15 October 2026 |
📖 |
Participants
| Method | Description | Docs |
|---|---|---|
get_participants(sport, search=None) |
Get teams/players | 📖 |
get_participant_by_id(participant_id) |
Get participant by ID | 📖 |
Bookmakers
| Method | Description | Docs |
|---|---|---|
get_bookmakers() |
Get all available bookmakers | 📖 |
get_selected_bookmakers() |
Get your selected bookmakers | 📖 |
select_bookmakers(bookmakers) |
Select bookmakers | 📖 |
clear_selected_bookmakers() |
Clear selection | 📖 |
Betting Analysis
| Method | Description | Docs |
|---|---|---|
get_arbitrage_bets(bookmakers, **options) |
Find arbitrage opportunities | 📖 |
get_value_bets(bookmaker, **options) |
Find value bets | 📖 |
Settlement
| Method | Description | Docs |
|---|---|---|
get_settlements(event_ids) |
Status, final score and final flag for up to 50 events |
📖 |
grade_bets(selections) |
Grade up to 50 bets as won, lost, void, half won or half lost | 📖 |
⚠️ Error Handling
The SDK provides custom exceptions for different error scenarios:
from odds_api import (
OddsAPIClient,
OddsAPIError,
InvalidAPIKeyError,
RateLimitExceededError,
NotFoundError,
ValidationError
)
client = OddsAPIClient(api_key="your_api_key")
try:
events = client.get_events(sport="basketball")
except InvalidAPIKeyError:
print("Your API key is invalid")
except RateLimitExceededError:
print("Rate limit exceeded - wait before retrying")
except NotFoundError:
print("Resource not found")
except ValidationError as e:
print(f"Invalid parameters: {e}")
except OddsAPIError as e:
print(f"API error: {e}")
🌟 Why Odds-API.io?
- ✅ Most Comprehensive Coverage - 365+ bookmakers across 34 sports and 12,000+ leagues
- ✅ Near-Zero Latency - Real-time odds updates with minimal delay
- ✅ Direct Bet Links - Deep links directly to bookmaker bet slips
- ✅ Value Bet Detection - Automatically calculated expected value
- ✅ Historical Data - Access to past odds and results
- ✅ Developer Friendly - Clean API design with excellent documentation
💡 Use Cases
Build powerful betting tools and analytics:
- 🎯 Arbitrage betting platforms
- 📊 Odds comparison sites
- 📈 Value betting calculators
- 🤖 Automated betting systems
- 📉 Sports analytics dashboards
- 🔔 Odds movement alerts
🆓 Free Tier Limitations
- Limited to 2 bookmakers selected at once
- 100 requests per hour
- No WebSocket access on free tier
📋 Requirements
- Python 3.8 or higher
requestslibrary (for sync client)aiohttplibrary (for async client)
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Links
- Website: odds-api.io
- Documentation: docs.odds-api.io
- API Key: Get your API key
- GitHub: github.com/odds-api-io/odds-api-python
- Issues: Report a bug
- PyPI: pypi.org/project/odds-api-io
💬 Support
Need help? We're here for you:
- 📧 Email: hello@odds-api.io
- 📚 Documentation: docs.odds-api.io
- 🐛 Issues: GitHub Issues
- ⏱️ Response Time: Usually within 24 hours
⚡ Quick Links
Built with ❤️ by the Odds-API.io team
Citation
If you use this package in research or a publication, please cite it. Citation metadata is in CITATION.cff (GitHub renders a "Cite this repository" button from it) and Zenodo metadata is in .zenodo.json.
Outlier AS. odds-api-io: Official Python SDK for Odds-API.io (version 1.0.2). https://github.com/odds-api-io/odds-api-python
Metadata
Release files for odds-api-io 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| odds_api_io-1.1.0.tar.gz | 15.3 kB | Without provenance | Details for odds_api_io-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| odds_api_io-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for odds_api_io-1.1.0-py3-none-any.whl |
Total release size: 31.2 kB
Release files / odds_api_io-1.1.0.tar.gz
| Download URL | odds_api_io-1.1.0.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
150c02aca4457a5971ab84087d49cc8a7ed9c22946685fc59b76ac4bbae0202c
|
|
BLAKE2b-256 checksum How to use checksums |
8507107bdf6ac8877d47105580733caf0d88a207dc84bec01827964c3a0537b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / odds_api_io-1.1.0-py3-none-any.whl
| Download URL | odds_api_io-1.1.0-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de0619c72bb841ac5a7b8dc3499705a5e6ab4a935cbb0b15651598a581e90c28
|
|
BLAKE2b-256 checksum How to use checksums |
1e66461726cc4eda3d894d72c5edbc66d552f3a0e7d05cfb44b271a7fbd413d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for odds-api-io 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.