Agent tools · function calling
Tool
Named tools map 1:1 to HTTP routes. An AI loads the catalog, then calls each tool by hitting its method + path — no scraping, no custom SDK required.
How it works
Tools are published at GET /api/v1/tools. Each entry has a name, description, method, path, and JSON Schema parameters.
For OpenAI-style function calling, add ?format=openai — you get a tools[] array ready to pass into a chat completions / responses API.
curl -s http://localhost:3000/api/v1/tools?format=openai
Catalog
- list_apiGET /api/v1
Discover BitCoinBetting external API endpoints, auth rules, and capabilities.
- get_openapiGET /api/v1/openapi.json
Fetch the OpenAPI 3 document for this API.
- get_current_eventGET /api/v1/events/current
Get the live KXBTC15M 15-minute window: market, odds, BTC quote, orderbook, price to beat.
- get_eventGET /api/v1/events/{eventTicker}
Get a specific event/market snapshot by event ticker (live or settled).
- get_event_seriesGET /api/v1/events/{eventTicker}/series
Get chart timeseries for a window (BTC vs price-to-beat, win %).
- list_historyGET /api/v1/history
List settled 15m windows with crosses and max Yes/No win %. Supports filters, sort, cursor pagination (up to 10000).
- get_statsGET /api/v1/stats
Query locally stored window_stats (crosses, peak win %) with filters and aggregates.
- queryPOST /api/v1/query
Flexible POST query across history, stats, current event, event, or series. Preferred for complex filters.
How an agent should use them
- Call list_api or GET /api/v1/tools once per session.
- Bind the OpenAI (or equivalent) function list from ?format=openai.
- When the model emits a tool call, execute the matching HTTP request (path params like {eventTicker} filled from arguments; query params for GET filters).
- Feed the JSON response back as the tool result; paginate with cursor when more rows are needed.
UI tools (this site)
The Historical tab is the human counterpart: filter/sort settled windows, set a Records batch size, and Load N older appends that many more rows. Click a window to open its full chart view.
Admin clears stored SQLite stats and sets the live chart Cap %. Those are browser/server ops — not part of the external tool catalog.