AI Gateway Payload size

What is the correct way to use Vercel’s AI Gateway with images and multimodal content? Currently, when I try to send a slightly large prompt with images, it totals something greater than >4.5mb, as I encode the images to base64 in the payload. What happens is that my payload is blocked by 413 Payload Too Large. How do I avoid this? Other providers normally accept the submission.

Did you try to send image url instead of converting to base64?

I don’t have the image URL, I didn’t upload it.

Also, it would not solve the problem for other types of content, such as audios and files, which can be large. These contents cannot be provided through a URL, only inline base64 data.

Also, I’ve already tried to provide URLs for chat API. However, this is the kinda of issue I get from Vercel:

Request:
    POST https://ai-gateway.vercel.sh/v1/chat/completions
    {"messages":[{"role":"system","content":"User local date is Monday, September 29, 2025 (timezone is America/Sao_Paulo)"},{"role":"user","content":[{"type":"text","text":"o que você vê nessa imagem?"},{"type":"image_url","image_url":{"url":"https://preview-s01.proj.pw/api/v1/public/ext-res/c9700b3649cc2200c125dd6d600a85b5b1ab3fc5","media_type":"image/jpeg"}}]}],"model":"amazon/nova-lite","stream":true,"stream_options":{"include_usage":true}}
InferenceException:
    'File URL data' functionality not supported.
Status:
    400 Bad Request

With some models it works fine, like Gemini 2.0 Flash. I’ve tried with Grok 4, Amazon Nova Lite and Claude 3.5 Haiku, no success at all. Only works when sending images on base64 contents.