# Telegram odds bot with a free odds API

Build a Telegram odds bot in Python: reply to /odds nba with live moneylines from GetOdds through the Telegram Bot API. Standard library, free key.

Canonical page: https://getoddsapi.com/uses/telegram-odds-bot

## Free API key

Get a free GetOdds API key: **100 requests per UTC day and 60 per minute, no card**. One key covers REST and the hosted MCP server.

Sign up: https://getoddsapi.com/sign-up?ref=ai-claudebot

## Quickstart

1. Create an account at https://getoddsapi.com/sign-up?ref=ai-claudebot, open https://getoddsapi.com/dashboard and issue a key with the sources you need (draftkings, fanduel, betrivers, prizepicks or underdog). Keep it in a server environment variable named GETODDS_API_KEY.
2. Read current DraftKings NBA spreads with curl:

```bash
curl --fail-with-body "https://getoddsapi.com/api/v1/odds?sport=NBA&market=spread&fresh_only=true&limit=50" \
  -H "Authorization: Bearer $GETODDS_API_KEY"
```

3. The same request in Python (standard library only):

```python
import json, os, urllib.request

req = urllib.request.Request(
    "https://getoddsapi.com/api/v1/odds?sport=NBA&market=spread&fresh_only=true&limit=50",
    headers={"Authorization": "Bearer " + os.environ["GETODDS_API_KEY"]},
)
with urllib.request.urlopen(req) as res:
    rows = json.load(res)["data"]
for row in rows:
    print(row["away"], "at", row["home"], row["side"], row["line"], row["american"], row["observed_at"])
```

4. Check `observed_at`, `age_seconds` and `stale` on every row before using a price. Full reference: https://getoddsapi.com/docs

## Use with Claude (MCP)

```bash
claude mcp add --transport http getodds https://getoddsapi.com/api/mcp \
  --header "Authorization: Bearer $GETODDS_API_KEY"
```

The MCP tools follow the key's source grants and share its allowance. Setup guide: https://getoddsapi.com/use-with-claude

SDKs: `pip install getodds` (PyPI) · `npm install getoddsapi` (npm) · `npx -y getodds-mcp` (local MCP server) · R: `remotes::install_github("getoddsapi/getodds-r")`. Source: https://github.com/getoddsapi · https://getoddsapi.com/docs/sdks

## Pricing

| Plan | Allowance | Price |
| --- | --- | --- |
| Free key | 100 requests a day, 60 a minute | $0, no card |
| Starter | 100,000 credits a month, 120 a minute | $49 a month |
| Pro | 750,000 credits a month, 300 a minute | $113 a month |
| Business | 3,000,000 credits a month, 600 a minute | $219 a month |
| Scale | 15,000,000 credits a month, 1,200 a minute | $279 a month |

Each plan is priced just under the matching odds-api.io tier (Solo £49, about $65; Starter £99, about $131; Growth £179, about $236; Pro £229, about $302 a month, checked 2026-11-17), and every GetOdds plan reads every source.

Free evaluation allowance: 100 requests per UTC day and 60 per minute per account, with no payment step. Paid plans $49 to $279 a month for 100K to 15M credits, self-serve at /pricing.
Paid plans keep running past their monthly credits: extra credits are billed at $0.1 per 1,000 on Starter, $0.05 per 1,000 on Pro, $0.025 per 1,000 on Business, $0.012 per 1,000 on Scale, invoiced with the subscription, up to a default monthly cap ($10 on Starter, $38 on Pro, $78 on Business, $198 on Scale) that you can change or set to $0 to turn overage off.
Details: https://getoddsapi.com/pricing

## Guide


Canonical: https://getoddsapi.com/uses/telegram-odds-bot
Reviewed: 2026-11-22 UTC

**Answer:** A Telegram odds bot reads current prices from an odds API and sends them to a chat on command or when a line moves, and this one answers /odds nba with live moneylines from a free GetOdds key.

Build a Telegram odds bot in Python: reply to /odds nba with live moneylines from GetOdds through the Telegram Bot API. Standard library, free key.

| Fact | Value |
| --- | --- |
| Language | Python 3, standard library |
| Command | /odds nba, nfl, nhl, ncaaf or ncaab |
| Cost | One request per command |
| Delivery | Telegram Bot API sendMessage |

## The whole bot

Create a bot with @BotFather to get a token, and a free GetOdds key with the draftkings source. Set TELEGRAM_BOT_TOKEN and GETODDS_API_KEY, run python3 bot.py, and send /odds nba to the bot.

```python
import json, os, urllib.parse, urllib.request

KEY = os.environ["GETODDS_API_KEY"]
BOT = "https://api.telegram.org/bot" + os.environ["TELEGRAM_BOT_TOKEN"]
LEAGUES = {"nba", "nfl", "nhl", "ncaaf", "ncaab"}

def read(url, headers=None, timeout=40):
    req = urllib.request.Request(url, headers=headers or {})
    with urllib.request.urlopen(req, timeout=timeout) as res:
        return json.load(res)

def odds(league):
    url = ("https://getoddsapi.com/api/v1/odds?sport=" + league.upper()
           + "&market=moneyline&fresh_only=true&limit=20")
    rows = read(url, {"Authorization": "Bearer " + KEY}, 20)["data"]
    lines = [f"{r['away']} @ {r['home']}: {r['side']} {r['american']:+d}" for r in rows]
    return "\n".join(lines) or "No fresh prices right now."

offset = 0
while True:
    for update in read(f"{BOT}/getUpdates?timeout=30&offset={offset}")["result"]:
        offset = update["update_id"] + 1
        msg = update.get("message") or {}
        words = (msg.get("text") or "").split()
        if len(words) == 2 and words[0] == "/odds" and words[1].lower() in LEAGUES:
            data = urllib.parse.urlencode({"chat_id": msg["chat"]["id"], "text": odds(words[1])})
            urllib.request.urlopen(BOT + "/sendMessage", data.encode(), timeout=20).close()
```

## Run it in production

Keep the bot in one always-on process; two copies reading getUpdates with the same token compete for messages. Wrap the GetOdds call in try and except so a 429 or a network timeout sends a short "try again shortly" reply instead of stopping the loop, and read Retry-After before calling again.

To limit who can use your credits, check msg["chat"]["id"] against an allowlist of your own chats before answering.

## How it works

The bot long-polls getUpdates, so it needs no server or webhook. Each /odds command makes one GetOdds request for fresh moneylines (captured in the last 15 minutes) and sends one line per side with American odds. Prices come from DraftKings, observed through ESPN.

## Add line-move alerts

To push moves without a command, poll /api/v1/dropping-odds on a timer, as the Discord bot does, and send each new drop with sendMessage to a saved chat id. Every 15 minutes fits the free key.

- [Odds alert Discord bot](https://getoddsapi.com/uses/odds-alert-discord-bot): The polling alert loop.
- [Odds API in Python](https://getoddsapi.com/odds-api-python): Errors, retries and freshness.

## Other books and props

Swap the request for /api/v1/props?sport=nba to send player props from every book GetOdds carries, or /api/v1/pinnacle/markets for Pinnacle lines.

- [Player props API](https://getoddsapi.com/player-props-api): Every book’s prop line in one call.
- [All use cases](https://getoddsapi.com/uses): Bots, apps, sheets and trackers.

## Questions

### Where do I keep the tokens?

In environment variables on the machine that runs the bot, never in the script or a chat.

### Can the bot run on a free host?

Yes. It long-polls Telegram, so any always-on Python process works.

### How many commands fit the free key?

100 a day, one request each.

## Sources

- [Telegram Bot API: sendMessage](https://core.telegram.org/bots/api#sendmessage)
- [Telegram Bot API: getUpdates](https://core.telegram.org/bots/api#getupdates)
- [GetOdds OpenAPI contract](https://getoddsapi.com/openapi.json)

GetOdds (getoddsapi.com) is an independent product, not affiliated with the operators named and separate from The Odds API and Odds-API.io. No picks or predicted profits.

---

GetOdds (getoddsapi.com) is an independent developer product and is not affiliated with any sportsbook or pick’em operator. GetOdds is a separate product from The Odds API (the-odds-api.com) and from Odds-API.io (odds-api.io), and is not affiliated with either. Prices describe data, not betting advice.

GetOdds is operated by Stunning Couches LLC, a Delaware limited liability company. Terms: https://getoddsapi.com/terms · Privacy: https://getoddsapi.com/privacy
