> ## Documentation Index
> Fetch the complete documentation index at: https://firecrawl-docs-remove-capabilities-from-sidebar.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 代理

> 了解代理类型、位置，以及 Firecrawl 如何为你的请求选择代理。

Firecrawl 提供多种代理类型，帮助你抓取复杂程度各异的网站。可通过 `proxy` 参数指定代理类型。

> 默认情况下，Firecrawl 会将所有请求经由代理转发，以提升可靠性与可访问性，即使你未指定代理类型或位置也同样生效。

<div id="location-based-proxy-selection">
  ## 基于位置的代理选择
</div>

Firecrawl 会根据你指定或自动检测到的位置，自动选择最合适的代理，从而优化抓取性能和可靠性。但目前并非所有地区都受支持。当前可用的地区如下：

| 国家代码 | 国家名称 | 基础代理支持 | 增强代理支持 |
| - | - | - | - |
| AE | 阿拉伯联合酋长国 | 是 | 否 |
| AT | 奥地利 | 是 | 否 |
| AU | 澳大利亚 | 是 | 否 |
| BE | 比利时 | 是 | 否 |
| BR | 巴西 | 是 | 否 |
| CA | 加拿大 | 是 | 否 |
| CH | 瑞士 | 是 | 否 |
| CN | 中国 | 是 | 否 |
| DE | 德国 | 是 | 否 |
| DK | 丹麦 | 是 | 否 |
| EG | 埃及 | 是 | 否 |
| ES | 西班牙 | 是 | 否 |
| FR | 法国 | 是 | 否 |
| GB | 英国 | 是 | 否 |
| GR | 希腊 | 是 | 否 |
| IL | 以色列 | 是 | 否 |
| IN | 印度 | 是 | 否 |
| IT | 意大利 | 是 | 否 |
| JP | 日本 | 是 | 否 |
| MX | 墨西哥 | 是 | 否 |
| NL | 荷兰 | 是 | 是 |
| PL | 波兰 | 是 | 否 |
| QA | 卡塔尔 | 是 | 否 |
| SE | 瑞典 | 是 | 否 |
| TR | 土耳其 | 是 | 否 |
| US | 美国 | 是 | 是 |

<Warning>受支持的代理位置列表会随着时间变化。</Warning>

如果你需要上述列表以外地区的代理，请[联系我们](mailto:help@firecrawl.com)并告知你的需求。

如果你未指定代理或位置，Firecrawl 将自动使用美国代理。

<div id="how-to-specify-proxy-location">
  ## 如何指定代理位置
</div>

你可以在请求中通过设置 `location.country` 参数来指定代理位置。例如，要使用德国代理，将 `location.country` 设置为 `DE`。

更多详情请参阅 [`location.country` 的 API 参考](https://docs.firecrawl.dev/api-reference/endpoint/scrape#body-location)。

<CodeGroup>
  ```python Python theme={null}
  from firecrawl import Firecrawl

  firecrawl = Firecrawl(
    # 无需 API 密钥即可开始使用 — 添加一个以获得更高的限流上限：
    # api_key="fc-YOUR-API-KEY",
  )

  doc = firecrawl.scrape('https://example.com',
      formats=['markdown'],
      location={
          'country': 'US',
          'languages': ['en']
      }
  )

  print(doc)
  ```

  ```js Node theme={null}
  import { Firecrawl } from 'firecrawl';

  const firecrawl = new Firecrawl({
    // 无需 API 密钥即可开始使用 — 添加一个以获得更高的限流额度：
    // apiKey: "fc-YOUR-API-KEY",
  });

  const doc = await firecrawl.scrape('https://example.com', {
    formats: ['markdown'],
    location: { country: 'US', languages: ['en'] },
  });

  console.log(doc.metadata);
  ```

  ```bash cURL theme={null}
  # 无需 API 密钥即可开始使用 — 添加 -H "Authorization: Bearer $FIRECRAWL_API_KEY" 可获得更高限流：
  curl -X POST "https://api.firecrawl.dev/v2/scrape" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://example.com",
      "formats": ["markdown"],
      "location": { "country": "US", "languages": ["en"] }
    }'
  ```
</CodeGroup>

<Info>如果你请求的国家没有可用代理，Firecrawl 会使用距离最近的可用区域 (EU 或 US) ，并将浏览器位置设置为你请求的国家。</Info>

<Warning>除非你确定有此需要，否则我们强烈建议不要指定 `location`。</Warning>

<div id="proxy-types">
  ## 代理类型
</div>

<Warning>
  `proxy` 参数已弃用。建议使用默认值 `auto`，让 Firecrawl 为你处理代理选择。
</Warning>

* **basic**：用于抓取大多数网站的代理。
* **enhanced**：用于抓取复杂网站并同时保持隐私的增强型代理。[进一步了解 Enhanced 模式 →](/zh/features/enhanced-mode)
* **auto**：推荐使用。如果 basic 代理抓取失败，Firecrawl 会自动使用 enhanced 代理重试抓取。

> 你是需要 Firecrawl API 密钥的 AI 代理吗？请参阅 [firecrawl.dev/agent-onboarding/SKILL.md](https://www.firecrawl.dev/agent-onboarding/SKILL.md) 了解自动化接入说明。
