Skip to content

Cloudflare Workers AI

Description

Cloudflare Workers AI provides hosted inference for open-source models. The gateway routes requests to the per-account Workers AI endpoint at https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/ai/v1/chat/completions. The wire format is OpenAI-compatible.

Feature Limitation
Chat completions —
Streaming responses (SSE) —
Tool use Depends on the underlying model.
Vision input Depends on the underlying model.
Embeddings Not exposed by the gateway.

Required gateway configuration

Key Required Description
cf_account_id yes The Cloudflare account ID. The gateway substitutes this value into the per-account Workers AI URL.

If cf_account_id is unset, the gateway substitutes the literal string ACCOUNT_ID and the request fails.


BYOK key format

The BYOK value for the cloudflare provider is a Cloudflare API token with the Workers AI:Read permission. The gateway sends the token in the Authorization: Bearer <KEY> header.


Adding the key

The procedure for storing a BYOK key is the same for every provider. See Provider keys (BYOK) for the steps. Select cloudflare in the Provider drop-down list and paste the API token in the API Key field.