f1verse

Documentation Β·
MCP server Β·
llms.txt Β·
Changelog Β· Contributing Β·
Security Β· License
The story layer for Formula 1 data. Data libraries fetch and tidy β
f1verse tells you what happened: lead changes, laps led, event timelines,
stint strategy, race pace β and what happens next: title probabilities from
a season simulation that ships with its own backtest.
Zero dependencies. Standard library only. Full live-timing coverage from
2023; lap-by-lap racing back to 1996, pit stops to 2011, and results,
qualifying and standings to 1950 β each answer stating which era it came
from and what that era does not hold.
import f1verse
race = f1verse.load(2026, 12)
race.laps_led()
race.leader_runs()
race.results()[7]
race.race_pace()
race.story()
race.championship_prediction()
race.team_radio()
f1verse.championship_projection(2026)
f1verse.title_scenarios(2026)
Give it to an AI agent
f1verse ships its own MCP server. No install step, no dependencies:
{"mcpServers": {"f1verse": {"command": "uvx", "args": ["--from", "f1verse", "f1verse-mcp"]}}}
That is the whole setup β the server is standard library only, so it
starts and answers tools/list in about 140 ms instead of unpacking a
scientific stack into a throwaway environment first. Eight tools, not
eighty: a model picks the right one.
For any other LLM pipeline, the library describes itself:
f1verse.tools()
f1verse.tools("openai")
f1verse.call_tool("f1_race_story", {"year": 2026, "round": 12})
Errors are written for the caller that has to fix them without reading
this page:
f1verse.call_tool("f1_race_summary", {})
f1verse.load_session(2026, 12, "Qualy")
The whole weekend, not just the race
f1verse.sessions(2026, 12)
q = f1verse.load_session(2026, 12, "Qualifying")
q.results()[0]
q.segments()["q1"]
Each kind gets the classification it actually has. Qualifying gaps are to
the fastest lap of that segment β the pole-sitter above was 0.085 s
off in Q1 β because a single "gap to leader" column would misreport the
session. A sprint loads as a Race; practice is a best-lap table.
Is this data safe to publish?
crosscheck answers do independent sources agree. quality_report adds
the three things that verdict is silent about: how complete the data is,
how old the copy is, and whether the classification is still provisional.
The chequered flag is not the final classification β scrutineering
disqualifications and penalties land hours later and rewrite rows in
place. So the rows the stewards can change are not cached forever until
the session is final, and any change that is seen is recorded:
before = race.snapshot()
...
f1verse.diff(before, race.refresh().snapshot())
f1verse.revisions()
f1verse.vintage(rec)
There is deliberately no as_of= time travel: f1verse can tell you what
it sees now and when it saw a value change, not reconstruct a value
nobody here ever fetched.
How the race actually unfolded
race = f1verse.load(2025, 24)
race.running_order()[30]
race.position_changes()[1]
race.battles()[0]
battles finds pairs that held consecutive positions within 1.5 s for at
least three laps. A scrap for eighth that ran a third of the race never
shows up in a classification; it is often the best part of the afternoon.
Races from before the live feeds
old = f1verse.load_archive(2008, 18)
old.coverage
old.leader_runs()
old.laps_led()
The coverage block is not decoration. 2008 has no stint data anywhere, so
ArchiveRace has no stints() β rather than returning an empty dict that
reads like "no pit stops happened". What the era recorded, you get; what it
did not, it says.
Seasons against each other
f1verse.season_shape(2025)
f1verse.title_margins(top=5)
Points systems changed repeatedly, so a raw margin cannot compare eras β one
point in 1958 was most of a win. Every row also carries the gap measured in
wins, which is the comparison that survives the rule changes.
Where the passing happened
f1verse.overtake_hotspots(race)[0]
The timing feed publishes an OvertakeState per car that almost never
changes β about a hundred transitions in nineteen thousand records. That
sparsity is the value: the transitions are a free index of the moments worth
looking at, from the same feed that times the race. Read it as "something
happened here", then confirm against running_order.
Beyond a single race
f1verse.career("max_verstappen")
f1verse.milestones("max_verstappen")
f1verse.circuit_profile(2026, 13)
profile = f1verse.circuit_profile(2026, 13)
profile["layout"]["corners"][0]
f1verse.circuit_survey(2026, 13)["corners"]["corners"][0]
f1verse.circuit_profile(2026, 13, measure=True)["audit"]
f1verse.circuit_facts("Austin")
f1verse.circuit_audit(2026, 13)
f1verse.circuit_directory()
f1verse.circuit_history("monza")
f1verse.head_to_head(2026)
f1verse.standings(2026)
Tyre life, and what the stewards struck out
f1verse.stint_degradation(race)[3]
f1verse.circuit_abrasion(race)
f1verse.tyre_outlook(race)
A car gets faster all race as it burns fuel, so raw lap times understate
degradation on every stint. Rates are fitted to fuel-normalised clean
laps only, and a stint with too few of them returns
{'degradation_s_per_lap': None, 'reason': 'too few clean laps'} rather
than a number fitted to noise.
f1verse.lap_deletions(session.race_control)
A reinstated lap keeps the reversal visible instead of being quietly
dropped. Check this before treating a fastest lap or a qualifying
position as settled.
Live timing, straight off the wire
from f1verse.sources import liveclient
with liveclient.LiveFeed() as feed:
for topic, patch, stamp in feed.messages():
...
liveclient.run("session-{n}.jsonl")
The official SignalR feed over a WebSocket written in the standard
library β no websocket package, no SignalR client. Connecting takes three
undocumented courtesies (an affinity cookie only handed to a pre-flight
request, the official application's user agent, an invocation id on the
subscription); they live in one place so no caller rediscovers them.
Recorded frames carry a millisecond arrival stamp β the difference
between an archive and a screenshot β so replay() runs a session back at
true speed. The stream is not a lap table, so
f1verse.sources.timing.laps_from_stream rebuilds one: arrival order
lies, sector times land after the next lap has begun, and qualifying
carries phantom lap times that are really the gap between two runs. Every
rebuilt lap row carries its provenance.
Running this on a schedule
f1verse.status(2026)
f1verse.due(2026, processed=[...session keys you already handled...])
Caching is policy-driven, not blanket: lap and telemetry data is immutable
and cached forever, schedules expire every few hours β a calendar cached
for a season would hide a cancelled round for the rest of the year β and
rows the stewards can still rewrite expire until the session is final.
f1verse.cache_info() and f1verse.clear_cache(older_than=...) are there
for operators; clear_cache never drops the revision journal.
Telemetry, track position, conditions
f1verse.lap_telemetry(race, "NOR", 40)
f1verse.lap_trace(race, "NOR", 40)
f1verse.top_speeds(race)
f1verse.weather_summary(race)
Telemetry is high-frequency, so these take a bounded window and filter
server-side rather than downloading a session and trimming it locally.
Grounded narration
facts = f1verse.race_facts(race)
f1verse.brief(race)
result = f1verse.narrate(
race,
generate=lambda prompt: my_model(prompt),
cache_dir=".cache/narration",
)
narrate accepts any text-generation callback; f1verse has no model SDK
dependency. Drafts are checked against the structured fact sheet. Unknown
numbers and driver codes are rejected, generation is retried at most twice,
and a deterministic summary is returned if verification still fails. The
optional cache is exact-match only and stores verified text.
Who wins the championship β and who still can
Two different questions, and mixing them is how a projection ends up
implying somebody is out when the arithmetic says otherwise.
f1verse.title_scenarios(2026)
f1verse.championship_projection(2026)
A simulated finish is resampled from the positions that driver has
actually finished in, not drawn from a curve around their average. The
distinction decides championships: alternating wins and retirements is a
different proposition from finishing fourth every weekend, and the mean
is the same for both. Retirements fire at each driver's measured rate,
sprints score on their own table, and ties break on wins then seconds,
as the regulations do.
Every run also re-draws the driver's own level first, bootstrapping their
results before playing the season against that version of them β twelve
races is a small sample, and treating it as settled truth is how a
forecast becomes more confident than anyone should be.
f1verse.backtest_projection()
Replayed at round 12 of 2019-2025 it went 5/5 when it claimed 90%+; both
misses were seasons it had itself called at 53% and 57% β the two that ran
to the final round. Read the buckets, not the headline: a model that says
55% and is wrong has done nothing wrong.
championship_prediction (in feeds) is a different thing β F1's own
live "if it ended now" table. championship_projection is this model.
One reports, the other forecasts.
Predictions, pit-stop verdicts, official documents
f1verse.win_probabilities({"NOR": 1, "ANT": 2, "RUS": 3},
year=2026, upto_round=12, circuit_id="monza")
f1verse.pit_exchanges(race, pit_loss_s=22.74)
f1verse.fia_documents(2026)
f1verse.power_unit_documents(2026)
Why this exists
Raw timing data needs a lot of domain knowledge before it means anything:
- Classified gaps are not comparable across lapped cars. A car one lap
down can show a smaller number than one that finished ahead on the lead
lap. β
format_gap applies the broadcast convention (+1 LAP).
- "Who led the race" has to be derived. Lead changes, laps led and the
moments they happened are not published as such.
β
leader_runs, laps_led, timeline.
- Race pace needs rules, not just a threshold: in/out laps and laps run
under SC/VSC have to go, or the number is meaningless.
β
race_pace applies them by default.
- Web and video pipelines need plain JSON. Every f1verse output is
JSON-safe Python, ready to serialise.
- Data quality should be checkable in code, not read from logs.
β
crosscheck and quality_report return structured verdicts.
- Results change after the flag. A cache that treats a classification
as immutable makes a stewards' decision invisible.
β revisable rows expire until the session is final; changes are recorded.
Additional live-timing feeds
The official live-timing archive publishes several feeds that are rarely
surfaced. f1verse parses three of them, with the same caching and
rate-limit etiquette as the rest of the library:
f1verse.championship_prediction(session)
f1verse.team_radio(session)
f1verse.timing_stats(session)
Running continuously
See OPERATIONS.md for caching policy, rate limits and
scheduling.
Tests
pip install -e ".[test]" && pytest -q
Sources
| Layer | What it gives |
|---|
| Race data | laps, stints, pits, positions, results, overtakes |
| Live-timing archive | championship projection, team radio, timing stats |
| Historic records | careers, circuit records, standings β 1950 onward |
| Circuit geometry | track outline, corners, marshal sectors, pit loss |
All are public endpoints, read at runtime. See src/f1verse/sources/ for
the exact hosts, and NOTICE for how upstream data rights relate to this
project's own license.
Design rules
- Zero required dependencies. The native loader reads public REST
endpoints and the official live-timing archive directly, with its own
on-disk cache and polite pacing.
- Everything returned is plain JSON-safe Python.
- F1 domain rules are defaults, not options.
- Cross-checked where possible β lapped-car gaps, for instance, are
computed by convention and confirmed against a second source.
- Code only. No timing data, media, or images are bundled or
redistributed; data is fetched by the end user.
License
Apache-2.0. See LICENSE and NOTICE.
Use it privately or commercially; read it, change it, redistribute it, and
build products or hosted services on it. Preserve the license and notices,
state significant changes, and observe the license's patent terms. There is no
source-disclosure requirement for software or services that use f1verse.
This license covers f1verse's own source. The Formula 1 data it reads at
runtime belongs to its respective rights holders under their own terms.
Roadmap
- Broader cross-validation coverage
- Deviation detection: expected range, actual, evidence
- Localisation packages
Unofficial fan project. Not affiliated with, endorsed by, or associated
with Formula 1, FIA, FOM, or any F1 team. F1, FORMULA 1 and related marks
are trademarks of Formula One Licensing BV. This library contains code
only β no timing data, media, or images are included or redistributed;
data is fetched by the end user from publicly accessible endpoints,
subject to the respective providers' terms.