---
title: "Reconstruct Hamilton’s Abu Dhabi Pit Stop with the OpenF1 API"
titleOverride: "Reconstruct Hamilton’s Abu Dhabi Pit Stop with the OpenF1 API"
pubDate: 2026-11-18
description: "Use the OpenF1 API and Quickchat AI to trace Lewis Hamilton’s first stop at Abu Dhabi in 2025. Check the lap times, tyre change and 2.4-second stop yourself."
author:
  name: Piotr Grudzień
  image: /blog-assets/authors/piotr_grudzien.jpg
image:
  url: /blog-assets/posts/openf1-race-stint-explainer_bg.webp
  alt: "Illustrated red Formula 1 car beside Hamilton’s lap 8 pit-lane and stationary times"
tags: [tutorials, engineering]
articleCta:
  title: "Build your own Stint Notebook"
  subtitle: "Start with Hamilton’s first stop, then follow another driver through the same race."
  button: "Create your race companion"
  href: https://app.quickchat.ai/register
faq:
  - question: "What is a tyre stint in Formula 1?"
    answer: "A tyre stint is the run of laps a driver completes on one set of tyres. OpenF1 gives each stint a number, a compound and a first and last lap. Hamilton’s first stint in the 2025 Abu Dhabi race covers laps 1 through 8 on soft tyres."
  - question: "Do I need an API key for historical OpenF1 data?"
    answer: "No. OpenF1 offers keyless historical access for personal use for sessions from 2023 onward. Quickchat AI uses credits for conversations and tests. Live access has separate requirements."
  - question: "How long was Hamilton’s first pit stop in Abu Dhabi in 2025?"
    answer: "OpenF1 records 21.601 seconds in the pit lane and 2.4 seconds stationary on lap 8. Its pit endpoint calls these fields lane_duration and stop_duration. The stationary interval is already included in the pit-lane total."
  - question: "How do I get F1 lap times and tyre compounds from the OpenF1 API?"
    answer: "Fetch laps and stints for the same session_key and driver_number. For each lap_number, use the compound from the stint whose lap_start and lap_end include that lap. The laps endpoint supplies lap_duration in seconds."
  - question: "Can these laps show why Ferrari called Hamilton in?"
    answer: "The records show when Hamilton stopped, how long he was stationary and which tyres followed. They do not record the team’s decision. Establishing a strategy such as an undercut requires evidence about a rival and the team’s intent."
  - question: "Can I use the seven laps to estimate stint pace?"
    answer: "You can describe this window if you state which laps you included. The worksheet excludes the pit lap, pit-out laps and missing durations and reports the count and median. A window that crosses two compounds cannot establish representative pace for either stint."
howto:
  - name: "Identify the race and the driver"
    text: "Open the session and driver records for the 2025 Abu Dhabi race, session 9839, driver 44."
  - name: "Create Stint Notebook"
    text: "Save the Main Prompt and build the session and driver GET Actions in Quickchat AI."
  - name: "Connect pit events, tyre stints and lap times"
    text: "Add the three timing Actions and test the inclusive lap interval from 5 to 11."
  - name: "Read the pit stop and the out-lap"
    text: "Ask for Hamilton’s first stop. Join the seven lap times to the tyre intervals and find the pit-out flag."
  - name: "Verify the reply against the call log"
    text: "Compare the recorded request with the source rows and repeat the boundary questions in Simulation."
---

**Lewis Hamilton spent 21.601 seconds in the pit lane on lap 8 of the 2025 Abu Dhabi Grand Prix. His Ferrari stood still for 2.4 seconds.** Both readings come from the same stop. On the timing sheet, the longest lap in that part of his race is actually lap 9.

You can reconstruct the sequence yourself. You'll build **Stint Notebook**, a Quickchat AI Agent that reads the OpenF1 API. Ask for three laps on either side of Hamilton's first stop and you'll get seven timed laps, the change from soft to hard tyres, and links to the records behind the answer.

<div class="tutorial-screen tutorial-panel" style="max-width: 440px">

![Hamilton’s seven-lap answer in Quickchat AI below the two OpenF1 pit times for lap 8](../../assets/blog/posts/openf1Stint/finish-line.webp)
*This local Quickchat AI run returned seven laps and links to the public pit, stint and lap records.*

</div>

[Download the Stint Notebook kit](https://quickchat.ai/blog-assets/downloads/stint-notebook-kit.zip) for the five Action recipes, Main Prompt, saved OpenF1 responses and a small Python worksheet. You can read the OpenF1 records without an OpenF1 account or API token. You'll sign in to Quickchat AI in step 2.

<a id="race"></a>
## 1. Which Abu Dhabi session are you looking at?

Start with the race and the driver. A Grand Prix weekend contains several sessions, and Hamilton carries number 44 in each of them. A lap number only becomes meaningful once you've fixed both the **session** and the **driver**.

1. Open the [OpenF1 session record](https://api.openf1.org/v1/sessions?session_key=9839). Look for `Race`, `Yas Marina Circuit` and the date **7 December 2025**. Keep `session_key=9839` in every request.
2. Open the [driver record for number 44](https://api.openf1.org/v1/drivers?session_key=9839&driver_number=44). It returns **Lewis Hamilton** and **Ferrari**. Keep that tab open as you add the Actions.

<div class="tutorial-screen tutorial-panel" style="max-width: 540px">

![OpenF1's race session 9839 and Hamilton's driver number 44 connect the pit, stint and lap records](../../assets/blog/posts/openf1Stint/session-keys.webp)
*Keep the race fixed. Changing just the driver number lets you ask the same question about another car in that race.*

</div>

Try the [example on the OpenF1 homepage](https://openf1.org/). Select **Shell** and click **Run**. It returns Hamilton's first three laps. Find `driver_number` and `lap_number` in the JSON.

<div class="tutorial-screen tutorial-panel" style="max-width: 475px">

![OpenF1’s Shell example, Run button and returned lap data for driver 44](../../assets/blog/posts/openf1Stint/openf1-playground.webp)
*Open the [first three lap records](https://api.openf1.org/v1/laps?session_key=9839&driver_number=44&lap_number%3C=3) yourself. The pit-stop question later asks for laps 5 to 11.*

</div>

OpenF1 offers historical data from 2023 for personal use. Its [authentication guide](https://openf1.org/auth.html) explains access to live data.

<a id="agent"></a>
## 2. How do you give the Agent its first two Actions?

1. [Create or sign in to a Quickchat AI account](https://app.quickchat.ai/register). Choose **Add new AI Agent → Set up manually** and name it **Stint Notebook**. You'll need credits for AI replies and tests.
2. Open **Identity → Main Prompt**, paste the instructions below and save. They tell the Agent which evidence to collect before it explains a lap.
3. Go to **Actions & MCPs → Custom Actions → Add Action → API Action → Create manually**. In **API Action Name**, enter `identify_session`. Leave **What to ask the user first** empty. Under **API Endpoint**, choose **GET** and enter the URL below. Leave **Headers** and **Body** empty.
4. In **API Action Description**, enter the description below. Save the Action and switch it on. Repeat with `identify_driver`. For that one, add `driver_number` under **What to ask the user first**, choose **Number**, mark it required and insert it in the URL with **Add AI Data → Parameters**.

<div class="tutorial-screen tutorial-panel" style="max-width: 540px">

![Quickchat AI's API Action editor with the fixed race lookup and GET endpoint](../../assets/blog/posts/openf1Stint/session-editor.webp)
*The race is part of the saved URL. The driver lookup is the first Action that needs a value from the conversation.*

</div>

<details class="tutorial-artifact">
<summary>Copy the Stint Notebook Main Prompt</summary>

```text
You are Stint Notebook. Help a race viewer inspect the completed 2025 Abu Dhabi Grand Prix, OpenF1 session 9839. Confirm the Race session and driver with Actions before reporting race facts. For Hamilton use driver 44 and verify his name. If a driver cannot be found, ask for a valid number. Run Actions one at a time. For a stop, fetch the driver's pit events and stints, then fetch at most ten laps around the selected stop. Three laps on either side means seven rows including the pit lap.
Start with the pit lap, lane_duration in seconds and stop_duration in seconds. Join each lap to its inclusive stint interval. For a lap window, show a compact Markdown table with Lap, Time (s), Tyre and Note. Use three decimal places for lap times. Note the recorded pit lap and the is_pit_out_lap flag; leave the other notes blank. Cite the exact OpenF1 pit, stint and bounded lap queries as short Markdown links.
Use only returned fields. Distinguish time in the pit lane from stationary time. A missing duration is unavailable. If a request fails, say which data you could not retrieve. Timing alone cannot establish team intent. For an aggregate, give the source rows and tell the reader to use the worksheet. Only answer historical questions on demand.
```

</details>

<details class="tutorial-artifact">
<summary>Copy the session and driver Action settings</summary>

```text
identify_session
GET https://api.openf1.org/v1/sessions?session_key=9839
Identify the configured session. Check that session_name is Race, then report its date, circuit and session key.

identify_driver
GET https://api.openf1.org/v1/drivers?session_key=9839&driver_number={{driver_number}}
Resolve the driver by number within this race. Use full_name and driver_number from the response. If no record is found, ask for a valid number.
driver_number (Number, required): Confirmed driver number in this session, such as 44 for Lewis Hamilton.
```

</details>

Open **AI Preview** and ask, `Which session is this, and is driver 44 in it?` Look for the race date and Hamilton's name before moving on. The [guide to building an Agent that calls an API](https://quickchat.ai/post/build-an-ai-agent-that-takes-actions) walks through the editor if this is your first Action.

<a id="timing"></a>
## 3. How do you find the right seven laps?

Let the **pit record choose the window**. Hamilton stopped twice in this race, on laps 8 and 31. Pick the first event, then request three laps before it and three after it. That gives you laps 5 through 11, inclusive. Asking for the laps first would leave the Agent guessing where to look.

<div class="tutorial-screen tutorial-panel" style="max-width: 560px">

![Formula 1's lap 8 pit summary beside the OpenF1 fields for 21.601 seconds in the lane and 2.4 seconds stationary](../../assets/blog/posts/openf1Stint/pit-source.webp)
*Formula 1's [pit stop summary](https://www.formula1.com/en/results/2025/races/1276/abu-dhabi/pit-stop-summary) lists 21.601 seconds. OpenF1 records both that pit-lane total and the 2.4 seconds stationary within it.*

</div>

1. In **Custom Actions**, add `get_driver_pits` and `get_driver_stints`. Both take the same required `driver_number` as the driver lookup. Use the singular endpoint **pit** for stops and **stints** for tyre intervals. The [OpenF1 field reference](https://openf1.org/docs/#pit) defines the timing fields, including the older `pit_duration` alias for lane time.
2. Add `get_driver_laps` with three required **Number** parameters. Use **Add AI Data** to insert `driver_number`, `first_lap` and `last_lap` in the URL. Keep the encoded signs in the recipe. The resulting filters mean **lap number ≥ first lap** and **lap number ≤ last lap**.
3. In **Test Response**, enter **44**, **5** and **11**. Check both ends of the returned array, save the Actions and switch all three on. Keep this Action to ten laps or fewer per question. The prompt requests that limit. The API URL itself accepts wider ranges.

<div class="tutorial-screen tutorial-panel" style="max-width: 560px">

![The lap Action in Quickchat AI with its driver, first lap and last lap parameters](../../assets/blog/posts/openf1Stint/lap-range-editor.webp)
*The two bounds belong in the same GET. A missing bound can pull in the rest of the race.*

</div>

<details class="tutorial-artifact">
<summary>Copy the pit, stint and lap Action settings</summary>

```text
get_driver_pits
GET https://api.openf1.org/v1/pit?session_key=9839&driver_number={{driver_number}}
Retrieve recorded pit events for the confirmed driver. Identify the requested pit lap. lane_duration is total time in the pit lane, stop_duration is stationary time; both are seconds. Preserve missing values.
driver_number (Number, required): Confirmed driver number in this session, such as 44 for Lewis Hamilton.

get_driver_stints
GET https://api.openf1.org/v1/stints?session_key=9839&driver_number={{driver_number}}
Retrieve tyre compounds and inclusive lap_start and lap_end boundaries for this driver. Use these intervals to label the pit and surrounding laps.
driver_number (Number, required): Confirmed driver number in this session, such as 44 for Lewis Hamilton.

get_driver_laps
GET https://api.openf1.org/v1/laps?session_key=9839&driver_number={{driver_number}}&lap_number%3E={{first_lap}}&lap_number%3C={{last_lap}}
Retrieve an inclusive interval of at most ten laps after selecting the pit event. Use lap_number, lap_duration in seconds and is_pit_out_lap. Preserve null durations. If OpenF1 returns HTTP 429, stop and ask the reader to try later. Do not repeat the lap request in the same turn.
driver_number (Number, required): Confirmed driver number in this session, such as 44 for Lewis Hamilton.
first_lap (Number, required): First lap number of the inclusive interval around the selected pit event.
last_lap (Number, required): Last lap number of the inclusive interval, at most nine above first_lap.
```

</details>

<a id="laps"></a>
## 4. What changed on laps 8 and 9?

In **AI Preview**, send `Show Hamilton's three laps before and after his first pit stop in the 2025 Abu Dhabi race.` Read the answer from the pit event outward. Lap 8 is the final lap OpenF1 assigns to the **soft** stint. Lap 9 is the first lap on **hard** tyres and the only row in this window with `is_pit_out_lap` set to `true`.

<div class="tutorial-screen tutorial-panel" style="max-width: 620px">

![Hamilton's 58-lap race divided into soft tyres on laps 1–8, hard on 9–31 and medium on 32–58](../../assets/blog/posts/openf1Stint/stint-timeline.webp)
*Find the compound by locating a lap between a stint's start and end. Lap 8 still belongs to the first stint.*

</div>

| Lap | Time (s) | Tyre | Pit record |
| ---: | ---: | --- | --- |
| 5 | 90.229 | Soft | |
| 6 | 90.254 | Soft | |
| 7 | 90.539 | Soft | |
| **8** | **92.249** | **Soft** | Pit entry |
| **9** | **108.500** | **Hard** | Pit out |
| 10 | 88.517 | Hard | |
| 11 | 89.022 | Hard | |

The longest lap in the window, **108.500 seconds**, includes the trip back out onto the circuit. The first full lap after that took **88.517 seconds**. Comparing those two rows as ordinary laps on the same compound would hide the one thing that makes them different. You can inspect every number in the [seven lap records](https://api.openf1.org/v1/laps?session_key=9839&driver_number=44&lap_number%3E=5&lap_number%3C=11) and check the [tyre intervals](https://api.openf1.org/v1/stints?session_key=9839&driver_number=44).

<div class="tutorial-screen tutorial-panel" style="max-width: 600px">

![Lap durations for Hamilton from laps 5 to 11, with the 108.500-second out-lap marked](../../assets/blog/posts/openf1Stint/lap-window.webp)
*The pit event and the peak in lap time sit on adjacent rows. The out-lap flag tells you which lap to set aside for a pace comparison.*

</div>

**Try one calculation.** Unzip the kit and run `python3 worksheet.py` in its directory. It lists every included and excluded lap. Excluding the pit lap, the out-lap and any missing durations leaves **five laps with a median of 90.229 seconds**. That describes the selected laps across two compounds. To study either stint's pace, choose a window inside that stint and state your exclusions.

<a id="check"></a>
## 5. How do you check an AI race explanation?

1. Open the conversation in **Inbox**, expand its called Actions, then open **View logs** on the lap Action. In our run all five reads returned HTTP 200. On the lap call, match session **9839**, driver **44** and bounds **5** and **11** to the seven returned rows.
2. Ask `Did Hamilton pit because Ferrari wanted an undercut?` Stint Notebook retrieved both stops and explained that the records leave Ferrari's reasoning open. For the time spent stationary, check `stop_duration` in the [original pit record](https://api.openf1.org/v1/pit?session_key=9839&driver_number=44).
3. Open **Testing → Simulation**, choose **Create Dataset** and choose **Paste messages** and paste the kit's test questions. A line containing only `---` separates each question from the next. Save the dataset and select **Run**. Include an unknown driver and a request for live updates. For driver **999**, our provider lookup returned **404**. Ask for a valid driver number when a lookup finds no record. If OpenF1 returns a missing duration or a temporary error, leave that value unavailable.

<div class="tutorial-screen tutorial-panel" style="max-width: 540px">

![Quickchat AI's lap call log shows the driver, both lap bounds and the returned response](../../assets/blog/posts/openf1Stint/lap-receipt.webp)
*The call log lets you compare the actual request with the stop the answer describes.*

</div>

<div class="tutorial-screen tutorial-panel" style="max-width: 520px">

![Testing in Quickchat AI with the Stint Notebook questions for the race and its timing limits](../../assets/blog/posts/openf1Stint/simulation.webp)
*Use the same questions after changing an Action description. Check both the reply and the data the Action retrieved.*

</div>

<div class="tutorial-screen tutorial-panel" style="max-width: 470px">

![Quickchat AI answers the undercut question with the recorded pit stops and explains the limit of the timing data](../../assets/blog/posts/openf1Stint/boundary.webp)
*The stops establish when Ferrari called Hamilton in. The timing feed has no field for the team’s intent.*

</div>

**One change worth testing.** We simulated an HTTP 429 on the lap lookup while the other four reads succeeded. The Agent tried the lap request twice. We added the instruction in the lap Action description to stop after a rate limit and ran the same question again. This time it tried once, reported the verified pit stop and left the lap times unavailable. You can count the attempts in View logs when testing your own wording.

If you already manage Quickchat AI from [ChatGPT](https://chatgpt.com/plugins/plugin_asdk_app_6a4656c688748191be4c5247fb0d5dfc) or [Claude](https://claude.ai/directory/connectors/app-quickchat-ai), you can give that assistant the kit's `actions.json` and `main-prompt.txt` and ask it to prepare the five GET Actions for session 9839. Review their URLs before enabling them. Running a test uses your Quickchat AI credits.

**Take the notebook to the second stop.** Ask for Hamilton's next change of tyres. This time the pit record should send you to **lap 31**, and the first lap of the **medium** stint should be **32**. You now have two places to check the answer before you even read the explanation.

## Frequently asked questions

### What is a tyre stint in Formula 1?

A tyre stint is the run of laps a driver completes on one set of tyres. OpenF1 gives each stint a number, a compound and a first and last lap. Hamilton’s first stint in the 2025 Abu Dhabi race covers laps 1 through 8 on soft tyres.

### Do I need an API key for historical OpenF1 data?

No. OpenF1 offers keyless historical access for personal use for sessions from 2023 onward. Quickchat AI uses credits for conversations and tests. Live access has separate requirements.

### How long was Hamilton’s first pit stop in Abu Dhabi in 2025?

OpenF1 records 21.601 seconds in the pit lane and 2.4 seconds stationary on lap 8. Its pit endpoint calls these fields lane_duration and stop_duration. The stationary interval is already included in the pit-lane total.

### How do I get F1 lap times and tyre compounds from the OpenF1 API?

Fetch laps and stints for the same session_key and driver_number. For each lap_number, use the compound from the stint whose lap_start and lap_end include that lap. The laps endpoint supplies lap_duration in seconds.

### Can these laps show why Ferrari called Hamilton in?

The records show when Hamilton stopped, how long he was stationary and which tyres followed. They do not record the team’s decision. Establishing a strategy such as an undercut requires evidence about a rival and the team’s intent.

### Can I use the seven laps to estimate stint pace?

You can describe this window if you state which laps you included. The worksheet excludes the pit lap, pit-out laps and missing durations and reports the count and median. A window that crosses two compounds cannot establish representative pace for either stint.

---

Not answered on this page? Ask Quickchat AI directly: https://app.quickchat.ai/v1/api_core/public-question/quickchat/ask/?q=your+question&placement=www-markdown-footer-ask-v1&format=html
