@apicity/openf1

中文文档
0.27.0发布于 2026/11/06MITTypeScriptES Module近 30 天下载 3491

OpenF1 API provider for Formula 1 historical and authenticated live REST data.

原始使用文档
文档目录25 节
  1. Installation
  2. Quick Start
  3. REST Examples
  4. Authenticated REST
  5. API Reference
  6. carData
  7. championshipDrivers
  8. championshipTeams
  9. drivers
  10. intervals
  11. laps
  12. location
  13. meetings
  14. overtakes
  15. pit
  16. position
  17. raceControl
  18. sessionResult
  19. sessions
  20. startingGrid
  21. stints
  22. teamRadio
  23. token
  24. weather
  25. License

@apicity/openf1

npm dependencies TypeScript docs

OpenF1 API provider for Formula 1 historical and authenticated live REST data.

Runtime dependencies:

  • zod@^4.6.6 — request schemas attached to OpenF1 endpoint methods as .schema

Installation

npm install @apicity/openf1
# or
pnpm add @apicity/openf1

Quick Start

import { createOpenF1 } from "@apicity/openf1";

const openf1 = createOpenF1();

REST Examples

OpenF1 historical REST data is public and does not require an API key.

import { createOpenF1 } from "@apicity/openf1";

const openf1 = createOpenF1();

const meetings = await openf1.v1.meetings({
  year: 2024,
  country_name: ["Singapore", "Monaco"],
});

const recentMeetings = await openf1.v1.meetings({
  filters: [
    { field: "date_start", op: ">=", value: "2024-01-01T00:00:00Z" },
  ],
});

Use arrays for repeated equality filters and filters for OpenF1 comparison operators such as >=, <, and >.

Authenticated REST

OpenF1 live REST access uses the same /v1/{collection} endpoints with a Bearer token. See the OpenF1 auth guide for the upstream token contract.

import { createOpenF1 } from "@apicity/openf1";

const openf1 = createOpenF1();

const token = await openf1.token({
  username: "[email protected]",
  password: "placeholder-password",
});

const liveOpenF1 = createOpenF1({
  accessToken: token.access_token,
});

const liveSessions = await liveOpenF1.v1.sessions({
  session_key: "latest",
});

For refreshable tokens, provide a tokenProvider. The provider is called for REST reads and this package does not store credentials or tokens outside the client instance.

declare function fetchTokenSomewhereElse(): Promise<{ access_token: string }>;

const openf1 = createOpenF1({
  tokenProvider: async () => {
    const token = await fetchTokenSomewhereElse();
    return token.access_token;
  },
});

API Reference

19 endpoints across 19 groups. Each method mirrors an upstream URL path.

carData

GET openf1.v1.carData

GET https://api.openf1.org/v1/car_data{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.carData({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

championshipDrivers

GET openf1.v1.championshipDrivers

GET https://api.openf1.org/v1/championship_drivers{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.championshipDrivers({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

championshipTeams

GET openf1.v1.championshipTeams

GET https://api.openf1.org/v1/championship_teams{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.championshipTeams({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

drivers

GET openf1.v1.drivers

GET https://api.openf1.org/v1/drivers{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.drivers({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

intervals

GET openf1.v1.intervals

GET https://api.openf1.org/v1/intervals{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.intervals({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

laps

GET openf1.v1.laps

GET https://api.openf1.org/v1/laps{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.laps({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

location

GET openf1.v1.location

GET https://api.openf1.org/v1/location{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.location({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

meetings

GET openf1.v1.meetings

GET https://api.openf1.org/v1/meetings{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.meetings({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

overtakes

GET openf1.v1.overtakes

GET https://api.openf1.org/v1/overtakes{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.overtakes({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

pit

GET openf1.v1.pit

GET https://api.openf1.org/v1/pit{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.pit({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

position

GET openf1.v1.position

GET https://api.openf1.org/v1/position{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.position({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

raceControl

GET openf1.v1.raceControl

GET https://api.openf1.org/v1/race_control{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.raceControl({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

sessionResult

GET openf1.v1.sessionResult

GET https://api.openf1.org/v1/session_result{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.sessionResult({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

sessions

GET openf1.v1.sessions

GET https://api.openf1.org/v1/sessions{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.sessions({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

startingGrid

GET openf1.v1.startingGrid

GET https://api.openf1.org/v1/starting_grid{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.startingGrid({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

stints

GET openf1.v1.stints

GET https://api.openf1.org/v1/stints{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.stints({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

teamRadio

GET openf1.v1.teamRadio

GET https://api.openf1.org/v1/team_radio{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.teamRadio({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

token

POST openf1.token

POST https://api.openf1.org/token

Cost tier: cheap

Upstream docs ↗

const token = await openf1.token({
  username: "[email protected]",
  password: "placeholder-password",
});

Source: packages/provider/openf1/src/openf1.ts

weather

GET openf1.v1.weather

GET https://api.openf1.org/v1/weather{query}

Cost tier: cheap

Upstream docs ↗

const res = await openf1.v1.weather({ /* ... */ });

Source: packages/provider/openf1/src/openf1.ts

Part of the apicity monorepo.

License

MIT — see LICENSE.

版本与发布记录

@apicity/openf1 共发布 60 个版本,首次发布于 2026/06/24;过去 12 个月发布了 60 个版本。

版本发布日期距今
0.27.0latest2026/11/06今天
0.26.02026/11/051 天前
0.25.02026/11/033 天前
0.24.12026/11/024 天前
0.24.02026/11/014 天前
0.23.12026/11/015 天前

关于 @apicity/openf1 的常见问题

@apicity/openf1 是什么?

OpenF1 API provider for Formula 1 historical and authenticated live REST data.

如何安装 @apicity/openf1?

在项目目录运行 npm install @apicity/openf1,或使用 pnpm add / yarn add / bun add。

@apicity/openf1 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@apicity/openf1 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@apicity/openf1 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@apicity/openf1 可以商用吗?

@apicity/openf1 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@apicity/openf1 的下载量有多少?

根据 npm 官方下载统计,@apicity/openf1 在 2026/10/06 – 2026/11/04 这 30 天内被下载 3,491 次,日均约 116 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@apicity/openf1 还在维护吗?

最新版本 0.27.0 发布于 2026/11/06(今天);至今共发布 60 个版本,其中过去 12 个月发布了 60 个;首次发布于 2026/06/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。