odds-api 0.1.0

Official Rust SDK for odds-api.net
Documentation

Install

Install from crates.io after publishing:

cargo add odds-api

Or use the GitHub repo before the crate is published:

[dependencies]
odds-api = { git = "https://github.com/odds-api/odds-api-rust", tag = "v0.1.0" }

For local development from the GitHub repo:

git clone https://github.com/odds-api/odds-api-rust.git
cd odds-api-rust
cargo test

Quickstart

use odds_api::{query_params, OddsApiClient};

#[tokio::main]
async fn main() -> odds_api::Result<()> {
    let client = OddsApiClient::from_env()?;
    let params = query_params([("sport", "rugby-league"), ("league", "NRL")]);

    let events = client.search_events(Some(&params)).await?;
    println!("{events:#}");

    Ok(())
}

The SDK reads ODDS_API_KEY and ODDS_API_BASE_URL from the environment:

let client = OddsApiClient::from_env()?;
let sports = client.list_sports().await?;

Common methods

  • list_sports
  • list_bookmakers
  • list_leagues
  • search_events
  • get_event
  • get_event_bookmakers
  • get_odds_snapshot
  • get_odds_history
  • find_best_odds
  • compare_bookmakers
  • find_arbitrage
  • find_positive_ev
  • get_line_movement
  • search_racing_events
  • get_racing_event
  • get_racing_odds
  • get_results
  • get_api_metadata
  • get_me
  • get_usage
  • get_limits
  • get_market_schema

Examples

examples/basic.rs
examples/arbitrage_scanner.rs

Run an example:

export ODDS_API_KEY="your_api_key"
cargo run --example basic

Why use this SDK?

odds-api-rust keeps the Python and Go SDKs' small, mock-friendly shape while using idiomatic Rust:

  • async requests with reqwest
  • ODDS_API_KEY and ODDS_API_BASE_URL support
  • API key auth with X-API-Key
  • optional bearer token support
  • typed error variants for auth, rate limits, validation, and server errors
  • helper methods for common sports, racing, odds, betting, account, and metadata workflows
  • generic get and post methods for endpoints not covered yet

Safety

Arbitrage and positive EV examples are betting research workflows, not guaranteed-profit systems. Always account for stale odds, limits, delays, suspensions, voids, jurisdiction, and execution risk.

Links