Workers AI - Reject busy synchronous inference requests
Added rejectIfBusy option for Workers AI inference requests, allowing applications to fail immediately instead of waiting in the capacity queue when resources are unavailable. This option can be passed to both the Workers AI binding and the REST API.
The rejectIfBusy option lets synchronous Workers AI inference requests fail when capacity is unavailable. Use it when your application should not wait in a capacity queue.
Pass the option as the third argument to the Workers AI binding:
const response = await env.AI.run(
"@cf/google/gemma-4-26b-a4b-it",
{
messages: [{ role: "user", content: "Explain capacity queues." }],
},
{ rejectIfBusy: true },
);const response = await env.AI.run(
"@cf/google/gemma-4-26b-a4b-it",
{
messages: [{ role: "user", content: "Explain capacity queues." }],
},
{ rejectIfBusy: true },
);
For the native REST API, add the option to the request body:
curl --request POST \
--url "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai/run/@cf/google/gemma-4-26b-a4b-it" \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"messages": [{ "role": "user", "content": "Explain capacity queues." }],
"options": { "rejectIfBusy": true }
}'
Refer to Reject busy requests for OpenAI-compatible usage and error behavior.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for Windows hotfix - trusted certificate chains
A new GA release for Windows Cloudflare One Client is available, addressing an issue with building trusted certificate chains.
Cloudflare One Client for macOS - Trusted Certificate Chain Fix
A new GA release of the macOS Cloudflare One Client is available. This hotfix addresses an issue with building trusted certificate chains.
Cloudflare One Client for Linux
A new GA release of Cloudflare One Client for Linux is now available. This hotfix addresses an issue with building trusted certificate chains.