Skip to content
Cloudflare Docs
非官方翻译 - 此文档为非官方中文翻译版本,仅供参考。如有疑问请以 英文官方文档 为准。

标头术语表

AI 网关支持各种标头来帮助您配置、自定义和管理您的 API 请求。本页面提供了所有支持的标头的完整列表,以及简短描述。

Term Definition
cf-aig-backoff

Header to customize the backoff type for request retries of a request.

cf-aig-cache-key

The cf-aig-cache-key-aig-cache-key let you override the default cache key in order to precisely set the cacheability setting for any resource.

cf-aig-cache-status

Status indicator for caching, showing if a request was served from cache.

cf-aig-cache-ttl

Specifies the cache time-to-live for responses.

cf-aig-collect-log

The cf-aig-collect-log header allows you to bypass the default log setting for the gateway.

cf-aig-custom-cost

Allows the customization of request cost to reflect user-defined parameters.

cf-aig-event-id

cf-aig-event-id is a unique identifier for an event, used to trace specific events through the system.

cf-aig-log-id

The cf-aig-log-id is a unique identifier for the specific log entry to which you want to add feedback.

cf-aig-max-attempts

Header to customize the number of max attempts for request retries of a request.

cf-aig-metadata

Custom metadataallows you to tag requests with user IDs or other identifiers, enabling better tracking and analysis of your requests.

cf-aig-request-timeout

Header to trigger a fallback provider based on a predetermined response time (measured in milliseconds).

cf-aig-retry-delay

Header to customize the retry delay for request retries of a request.

cf-aig-skip-cache

Header to bypass caching for a specific request.

cf-aig-step

cf-aig-step identifies the processing step in the AI Gateway flow for better tracking and debugging.

cf-cache-ttl

Deprecated: This header is replaced by cf-aig-cache-ttl. It specifies cache time-to-live.

cf-skip-cache

Deprecated: This header is replaced by cf-aig-skip-cache. It bypasses caching for a specific request.

配置层次结构

AI 网关中的设置可以在三个级别配置:提供商请求网关。由于相同的设置可以在多个位置配置,以下层次结构确定应用哪个值:

  1. 提供商级别标头: 仅在使用通用端点时相关,这些标头优先于所有其他配置。
  2. 请求级别标头: 如果未设置提供商级别标头,则应用此级别。
  3. 网关级别设置: 仅在提供商或请求级别未设置标头时作为默认值。

此层次结构确保一致的行为,优先考虑最具体的配置。使用提供商级别和请求级别标头进行更精细的控制,使用网关设置作为通用默认值。