Mistra embeds images when remote URLs are supported
According to Grok's documentation, it supports remote image urls as input. Mastra keeps embedding it as Base64 though.
In my opinion this behavior should be changeable as it unnecessarily fills memory with megabytes of data.
I use the latest v1.0.0 version.
Grok Docs: https://docs.x.ai/docs/guides/image-understanding#constructing-the-message-body---difference-from-chat
Image Understanding | xAI
Guide on using image understanding with vision models
7 Replies
Hey @Nic ! Which model provider package are you using?
Are you using Mastra's model provider like this? Or another provider?
I believe the
@ai-sdk/xai provider supports images passed as urls π€I am using Grok through OpenRouter:
openrouter("x-ai/grok-4-fast")
According to their documentation, they also support image URLs https://openrouter.ai/docs/guides/overview/multimodal/images#using-image-urlsπ Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10858
π If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly.
π Thank you for helping us improve Mastra!
The thing to check is if open router aisdk provider supportsImageUrls
I donβt think it does
Confirmed with open router that they do not support this flag yet
I let their team know
They made a release
https://github.com/OpenRouterTeam/ai-sdk-provider/pull/274
GitHub
feat: add supportsImageUrls property by yogasanas Β· Pull Request #...
Description
Adds supportsImageUrls = true property to both OpenRouterChatLanguageModel and OpenRouterCompletionLanguageModel classes,
Changes:
Added readonly supportsImageUrls = true to both model...
1.4.0
That was quick. Works perfectly now π