# Vercel Marketplace (/zh/quickstarts/vercel-marketplace)

<!-- agent-signals: reading_time_min: 5 · est_tokens: 2324 · updated: 2026-07-30 -->
Related: [Node.js](/zh/quickstarts/nodejs.md), [Next.js](/zh/quickstarts/nextjs.md), [Express](/zh/quickstarts/express.md), [NestJS](/zh/quickstarts/nestjs.md), [Fastify](/zh/quickstarts/fastify.md), [Hono](/zh/quickstarts/hono.md)

Firecrawl 提供原生的 [Vercel Marketplace 集成](https://vercel.com/marketplace/firecrawl)。安装后，它会为你的 Vercel 项目配置 Firecrawl，并自动将 `FIRECRAWL_API_KEY` 添加到项目环境变量中。

如果你希望通过 Vercel 完成 Firecrawl 的计费、API 密钥设置和项目配置，请参考本指南。

<div id="what-the-integration-does">
  ## 集成的作用 [#集成的作用]
</div>

当你通过 Vercel Marketplace 安装 Firecrawl 时，Vercel 会将 Firecrawl 连接到所选项目，并将 API 密钥作为环境变量提供给你。

* 通过 Marketplace 流程创建 Firecrawl 账户并提供 API 密钥
* 将 `FIRECRAWL_API_KEY` 添加到你的 Vercel 项目环境变量中
* 将 Firecrawl 的计费保留在你的 Vercel 账单中
* 集成连接后，你可以直接从 Vercel 打开 Firecrawl

<Note>
  如果你已经有 Firecrawl API 密钥，并且想手动配置 Vercel，请改用 [Vercel Functions 快速入门](/zh/quickstarts/vercel-functions)。
</Note>

<div id="install-from-vercel">
  ## 从 Vercel 安装 [#从-vercel-安装]
</div>

1. 打开 [Vercel Marketplace 上的 Firecrawl 页面](https://vercel.com/marketplace/firecrawl)。
2. 点击 **连接账户**。
3. 选择你想使用的 Firecrawl 套餐。
4. 选择要接收该环境变量的 Vercel 项目。
5. 完成安装流程。

安装完成后，重新部署你的项目，以便 Vercel Functions 和框架的服务器端代码能够读取新的环境变量。

<div id="install-the-sdk">
  ## 安装 SDK [#安装-sdk]
</div>

在你的 Vercel 项目中安装 Firecrawl Node SDK：

```bash
npm install firecrawl
```

无需将 API 密钥粘贴到代码中。请在服务端读取 `process.env.FIRECRAWL_API_KEY`。

<div id="scrape-a-page">
  ## 抓取网页 [#抓取网页]
</div>

在 `app/api/scrape/route.ts` 中创建一个路由处理程序：

```typescript
import { NextResponse } from "next/server";
import { Firecrawl } from "firecrawl";

const firecrawl = new Firecrawl({
  apiKey: process.env.FIRECRAWL_API_KEY,
});

export async function POST(request: Request) {
  const { url } = await request.json();
  const result = await firecrawl.scrape(url, {
    formats: ["markdown"],
  });

  return NextResponse.json(result);
}
```

部署完成后，测试该路由：

```bash
curl -X POST https://your-project.vercel.app/api/scrape \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.firecrawl.dev"}'
```

<div id="search-the-web">
  ## 进行网页搜索 [#进行网页搜索]
</div>

当你的应用需要最新的网页搜索结果以及页面内容时，使用 `search`：

```typescript
import { NextResponse } from "next/server";
import { Firecrawl } from "firecrawl";

const firecrawl = new Firecrawl({
  apiKey: process.env.FIRECRAWL_API_KEY,
});

export async function POST(request: Request) {
  const { query } = await request.json();
  const results = await firecrawl.search(query, {
    limit: 5,
    scrapeOptions: {
      formats: ["markdown"],
    },
  });

  return NextResponse.json(results);
}
```

<div id="interact-with-dynamic-pages">
  ## 与动态页面交互 [#与动态页面交互]
</div>

当应用需要在提取内容前先点击、滚动或填写表单时，请使用 `interact`。

```typescript
import { NextResponse } from "next/server";
import { Firecrawl } from "firecrawl";

const firecrawl = new Firecrawl({
  apiKey: process.env.FIRECRAWL_API_KEY,
});

export async function POST() {
  const result = await firecrawl.scrape("https://news.ycombinator.com", {
    formats: ["markdown"],
  });
  const scrapeId = result.metadata?.scrapeId;

  if (!scrapeId) {
    return NextResponse.json(
      { error: "No interactive scrape session was created" },
      { status: 500 }
    );
  }

  const response = await firecrawl.interact(scrapeId, {
    prompt: "Open the first story and summarize the page.",
  });

  await firecrawl.stopInteraction(scrapeId);

  return NextResponse.json({ output: response.output });
}
```

<Note>
  较长时间的交互可能会超过较短的无服务器超时时限。对于在生产环境中可能耗时更久的工作流，请将这类工作放到后台任务中运行，或使用 Firecrawl 的异步 API 并配合 Webhook。
</Note>

<div id="use-firecrawl-with-the-vercel-ai-sdk">
  ## 将 Firecrawl 与 Vercel AI SDK 结合使用 [#将-firecrawl-与-vercel-ai-sdk-结合使用]
</div>

如果你在使用 [Vercel AI SDK](/zh/developer-guides/llm-sdks-and-frameworks/vercel-ai-sdk) 构建代理，请安装 Firecrawl AI SDK 工具：

```bash
npm install firecrawl-aisdk ai
```

然后将 Firecrawl 工具传给你的模型。通过 Marketplace 安装的 `FIRECRAWL_API_KEY` 会从环境变量中读取。

<Note>
  以下示例使用 Vercel AI Gateway 的模型字符串格式。请分别配置你的 AI SDK 模型提供商或 AI Gateway 凭证。
</Note>

```typescript
import { generateText, stepCountIs } from "ai";
import { FirecrawlTools } from "firecrawl-aisdk";

const { text } = await generateText({
  model: "anthropic/claude-sonnet-4-5",
  tools: FirecrawlTools(),
  stopWhen: stepCountIs(20),
  prompt: "Search for recent Vercel AI SDK examples, scrape the best sources, and summarize them.",
});

console.log(text);
```

<div id="next-steps">
  ## 后续步骤 [#后续步骤]
</div>

<CardGroup cols="2">
  <Card title="Vercel Functions 快速入门" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M21 13.9563V10.0437C21 8.33384 21 7.47888 20.5856 6.77939C20.1712 6.0799 19.4188 5.6647 17.9139 4.83429L14.9139 3.1789C13.4895 2.39297 12.7774 2 12 2C11.2226 2 10.5105 2.39297 9.08614 3.1789L6.08614 4.83429C4.58123 5.6647 3.82877 6.0799 3.41439 6.77939C3 7.47888 3 8.33384 3 10.0437V13.9563C3 15.6662 3 16.5211 3.41439 17.2206C3.82877 17.9201 4.58123 18.3353 6.08614 19.1657L9.08614 20.8211C10.5105 21.607 11.2226 22 12 22C12.7774 22 13.4895 21.607 14.9139 20.8211L17.9139 19.1657C19.4188 18.3353 20.1712 17.9201 20.5856 17.2206C21 16.5211 21 15.6662 21 13.9563Z&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M12 16C14.2091 16 16 14.2091 16 12C16 9.79086 14.2091 8 12 8C9.79086 8 8 9.79086 8 12C8 14.2091 9.79086 16 12 16Z&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/quickstarts/vercel-functions">
    在 Vercel Functions 中手动配置环境并使用 Firecrawl
  </Card>

  <Card title="Vercel AI SDK 指南" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M12.828 6.00096C12.9388 5.68791 12.999 5.35099 12.999 5C12.999 3.34315 11.6559 2 9.99904 2C8.34219 2 6.99904 3.34315 6.99904 5C6.99904 5.35099 7.05932 5.68791 7.17008 6.00096C4.88532 6.0093 3.66601 6.09039 2.87772 6.87868C2.08951 7.66689 2.00836 8.88603 2 11.1704C2.31251 11.06 2.64876 11 2.99904 11C4.6559 11 5.99904 12.3431 5.99904 14C5.99904 15.6569 4.6559 17 2.99904 17C2.64876 17 2.31251 16.94 2 16.8296C2.00836 19.114 2.08951 20.3331 2.87772 21.1213C3.66593 21.9095 4.88508 21.9907 7.16941 21.999C7.05908 21.6865 6.99904 21.3503 6.99904 21C6.99904 19.3431 8.34219 18 9.99904 18C11.6559 18 12.999 19.3431 12.999 21C12.999 21.3503 12.939 21.6865 12.8287 21.999C15.113 21.9907 16.3322 21.9095 17.1204 21.1213C17.9086 20.333 17.9897 19.1137 17.9981 16.829C18.3111 16.9397 18.648 17 18.999 17C20.6559 17 21.999 15.6569 21.999 14C21.999 12.3431 20.6559 11 18.999 11C18.648 11 18.3111 11.0603 17.9981 11.171C17.9897 8.88627 17.9086 7.66697 17.1204 6.87868C16.3321 6.09039 15.1128 6.0093 12.828 6.00096Z&#x22; stroke=&#x22;currentColor&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/developer-guides/llm-sdks-and-frameworks/vercel-ai-sdk">
    为 Vercel AI SDK 代理添加 Firecrawl 工具
  </Card>

  <Card title="Scrape 文档" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M8 7L16 7&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M8 11L12 11&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M13 21.5V21C13 18.1716 13 16.7574 13.8787 15.8787C14.7574 15 16.1716 15 19 15H19.5M20 13.3431V10C20 6.22876 20 4.34315 18.8284 3.17157C17.6569 2 15.7712 2 12 2C8.22877 2 6.34315 2 5.17157 3.17157C4 4.34314 4 6.22876 4 10L4 14.5442C4 17.7892 4 19.4117 4.88607 20.5107C5.06508 20.7327 5.26731 20.9349 5.48933 21.1139C6.58831 22 8.21082 22 11.4558 22C12.1614 22 12.5141 22 12.8372 21.886C12.9044 21.8623 12.9702 21.835 13.0345 21.8043C13.3436 21.6564 13.593 21.407 14.0919 20.9081L18.8284 16.1716C19.4065 15.5935 19.6955 15.3045 19.8478 14.9369C20 14.5694 20 14.1606 20 13.3431Z&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/features/scrape">
    将网页转换为 Markdown、JSON、截图等格式
  </Card>

  <Card title="Search 文档" icon="<svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22;><path d=&#x22;M8 7L16 7&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M8 11L12 11&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/><path d=&#x22;M13 21.5V21C13 18.1716 13 16.7574 13.8787 15.8787C14.7574 15 16.1716 15 19 15H19.5M20 13.3431V10C20 6.22876 20 4.34315 18.8284 3.17157C17.6569 2 15.7712 2 12 2C8.22877 2 6.34315 2 5.17157 3.17157C4 4.34314 4 6.22876 4 10L4 14.5442C4 17.7892 4 19.4117 4.88607 20.5107C5.06508 20.7327 5.26731 20.9349 5.48933 21.1139C6.58831 22 8.21082 22 11.4558 22C12.1614 22 12.5141 22 12.8372 21.886C12.9044 21.8623 12.9702 21.835 13.0345 21.8043C13.3436 21.6564 13.593 21.407 14.0919 20.9081L18.8284 16.1716C19.4065 15.5935 19.6955 15.3045 19.8478 14.9369C20 14.5694 20 14.1606 20 13.3431Z&#x22; stroke=&#x22;currentColor&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; stroke-width=&#x22;1.5&#x22;/></svg>" href="/zh/features/search">
    进行网页搜索，并从结果中获取页面内容
  </Card>
</CardGroup>
