Description
When connecting cloudflare-workers-ai or cloudflare-ai-gateway via /connect and entering an API key, but without CLOUDFLARE_ACCOUNT_ID set as an environment variable, sending a message crashes with:
sdk.languageModel is not a function. (In 'sdk.languageModel(model.api.id)', 'sdk.languageModel' is undefined)
The custom loaders return { autoload: false } without a getModel when the env var is missing. Since the provider already exists in the providers map from /connect auth, the result is still processed but no model loader is registered. The fallback sdk.languageModel() runs and crashes.
Same issue affects cloudflare-ai-gateway when CLOUDFLARE_GATEWAY_ID is missing.
Plugins
None
OpenCode version
dev (latest)
Steps to reproduce
- Run
/connect, select Cloudflare Workers AI, enter an API key
- Do NOT set
CLOUDFLARE_ACCOUNT_ID environment variable
- Select a model and send a message
- See
sdk.languageModel is not a function error
Screenshot and/or share link
No response
Operating System
All
Terminal
All
Description
When connecting
cloudflare-workers-aiorcloudflare-ai-gatewayvia/connectand entering an API key, but withoutCLOUDFLARE_ACCOUNT_IDset as an environment variable, sending a message crashes with:The custom loaders return
{ autoload: false }without agetModelwhen the env var is missing. Since the provider already exists in the providers map from/connectauth, the result is still processed but no model loader is registered. The fallbacksdk.languageModel()runs and crashes.Same issue affects
cloudflare-ai-gatewaywhenCLOUDFLARE_GATEWAY_IDis missing.Plugins
None
OpenCode version
dev (latest)
Steps to reproduce
/connect, select Cloudflare Workers AI, enter an API keyCLOUDFLARE_ACCOUNT_IDenvironment variablesdk.languageModel is not a functionerrorScreenshot and/or share link
No response
Operating System
All
Terminal
All