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
ai.provider().fetch() requires the provider key as a Worker secret, so it can't use AI Gateway stored keys or Unified Billing #845
providerFetch always calls resolveProviderKey() and sends the key itself. If the secret is missing, for example GOOGLE_API_KEY for google-ai-studio, it answers 400 with ai: Missing GOOGLE_API_KEY secret. apiKeyEnv only changes which secret it reads. So an app can't let AI Gateway authenticate with a key stored in the gateway, or pay through Unified Billing.
The same path also drops init.signal: it passes only method, headers and body to fetch(), so a request can't be timed out. A Gemini call on Google's Flex tier can take up to 15 minutes, which is a queue consumer's whole time limit.
Ask:
An option for ai.provider().fetch() to send no provider key and let AI Gateway authenticate, as the Workers AI binding's gateway(id).run() does.
Pass init.signal through to fetch().
Workaround today: the app calls the binding's env.AI.gateway(id).run() directly, with inference.bindings.ai set in void.config.ts, and adds its own AbortSignal. That skips void/ai entirely.
Activity
Fix AI provider request cancellation, refs #845.