#AI SDK v5 TypeValidationError - Models returning "file" annotations when processing base64 PDFs

2 messages · Page 1 of 1 (latest)

polar canyonBOT
#

I'm an AI assistant - my answers may be incorrect and I cannot see screenshots. Please verify information with the OpenRouter docs.

For your situation with Vercel AI SDK v5 and OpenRouter PDF responses:

1. Disabling annotations via config:
There is no documented option to disable annotations (like annotations: false) in the OpenRouter API or plugin config. Annotations are included automatically when PDFs are parsed, as described:
"When you send a PDF to the API, the response may include file annotations in the assistant’s message. These annotations contain structured information about the PDF document that was parsed."
OpenRouter PDF Inputs

2. Filtering out unsupported annotation types:
There is no built-in OpenRouter or SDK parameter to filter or control annotation types in the API response. You'll need to post-process the response to remove or map unsupported annotation types before passing the response to the AI SDK stream.
"The response may include file annotations... By sending these annotations back in subsequent requests, you can avoid re-parsing..."
OpenRouter PDF Inputs

3. Workarounds for PDF inputs:

  • Recommended: If possible, use direct PDF URLs instead of base64, as these may be handled better by some models and middleware, and may reduce annotation issues.
  • If using base64 is required: Intercept and filter out file annotations from OpenRouter responses in your server/app code before passing them to the Vercel SDK, since the SDK only accepts url_citation.
  • If possible, open an issue/feature request with Vercel AI SDK to support file annotations or allow disabling ...

The author you are looking for could not be found.

#

...annotation validation.

Summary:

  • There is no way to disable or configure annotation output from OpenRouter for PDF parsing.
  • Filtering unsupported annotation types must be done in your application.
  • Using direct PDF URLs may reduce issues.
  • Monitor OpenRouter PDF Inputs and Vercel AI SDK Integration for future updates.

If you need more model-specific details or have a use case that can't be solved with the above, please provide:

  • The exact request payload you are sending
  • Any custom plugin configuration used
  • Whether direct PDF URLs work for your workflow

This will help mods or support escalate the issue if needed.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding.