AI Gateway Error: PDF file content not supported

We’re using @ai-sdkai-sdk/openai-compatible with Vercel AI Gateway “https://ai-gateway.vercel.sh/v1”

Error when sending PDF file part to any LLMs that support PDF: AI_UnsupportedFunctionalityError: ‘File content parts in user messages’ functionality not supported.
For references, with the same code, we have no issues when making requests via OpenRouter.

Our file part is being sent as array buffer. We tried to convert to base 64, it would suppress the error but then the LLM respond that it can’t read the file.
mapped_content.push({
type: “file”,
mimeType: “application/pdf”,
filename: filename,
data: await blob.arrayBuffer()
})

We hope this issue can be resolved because we prefer AI Gateway over OpenRouter. Thanks.

1 Like

Same issue. Works fine when we hit openai directly, but we get this error when we send it through the AI gateway.