You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cloudflare-ai-gateway provider returns 401 for Workers AI models #32051
BYOK models (Anthropic, OpenAI) routed through the same gateway work fine.
Root cause:createUnified() is called without an apiKey, so ai-gateway-provider injects a placeholder CF_TEMP_TOKEN as the authorization header. Before sending the universal endpoint request, the package strips any header containing CF_TEMP_TOKEN (this is by design for unified billing). The result: the Workers AI sub-request arrives at the gateway with no authorization header, causing a 401.
Affected code:
packages/core/src/plugin/provider/cloudflare-ai-gateway.ts line 27
packages/opencode/src/provider/provider.ts line 811
Steps to reproduce:
Set CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_GATEWAY_ID, CLOUDFLARE_API_TOKEN
Add cloudflare-ai-gateway to enabled_providers
Select any cloudflare-ai-gateway/workers-ai/* model
Activity
github-actions commentedon Jun 12, 2026
This issue might be related to an existing issue. Please check:
If your issue is distinct from the above (the root cause here —
CF_TEMP_TOKENbeing stripped — does appear to be a separate bug), no action is needed.