ai icon indicating copy to clipboard operation
ai copied to clipboard

Error generating images with workers-ai-provider

Open notreux opened this issue 3 months ago • 2 comments

I'm getting an error when using workers-ai-provider, even though the same request works fine when made manually with axios using the same API key and account ID

Environment

  • Runtime: Bun 1.2.21
  • OS: Windows 11 Pro (23H2)

Example:

const { image } = await generateImage({
	model: workersai.image('@cf/black-forest-labs/flux-1-schnell'),
	prompt: 'A futuristic cityscape at sunset',
});

Error:

13419 |   } else if (stream2 && typeof stream2.arrayBuffer === "function") {
13423 |   } else {
13424 |     throw new Error("Unsupported stream type: expected a Web ReadableStream or an async iterable stream");
                  ^
error: Unsupported stream type: expected a Web ReadableStream or an async iterable stream
      at streamToUint8Array (C:\Users\Reux\Documents\Develop\Project\node_modules\workers-ai-provider\dist\index.js:13424:11)      
      at streamToUint8Array (C:\Users\Reux\Documents\Develop\Project\node_modules\workers-ai-provider\dist\index.js:13380:35) 

notreux avatar Sep 06 '25 17:09 notreux