Skip to content

[Enhancement]: Allow PDF > 4.5MB when using 'Upload to provider' on bedrock with claude/nova models #12459

Description

@btribonde

What features would you like to see added?

Hello,

LibreChat currently rejects Bedrock document uploads above 4.5 MB with an error like:

Document validation failed: File size (8.6MB) exceeds the 4.5MB limit for Bedrock

However, AWS Bedrock documentation now describes model-specific exceptions to the 4.5 MB document limit:

  • For Claude 4 and subsequent versions, the 4.5 MB document size restriction does not apply to PDF
  • For Nova models, the 4.5 MB document size restriction does not apply to PDF and DOCX

Relevant AWS docs:

Current LibreChat behavior

The current Bedrock validation path appears to enforce a hard 4.5 MB limit for all Bedrock documents, including PDFs:

  • packages/api/src/files/validation.ts
  • validatePdf(...) routes Bedrock PDFs to validateBedrockDocument(...)
  • validateBedrockDocument(...) sets providerLimit = mbToBytes(4.5) and returns:
    • File size (...) exceeds the ... limit for Bedrock

LibreChat docs also currently state:

  • "AWS Bedrock Document Upload Limits"
  • "Maximum file size per document: 4.5 MB"

So both the implementation and docs seem to reflect the older / more conservative Bedrock rule rather than the newer model-specific exceptions.

Why this is a problem

This prevents valid Bedrock uploads for models that now support larger media documents through the API.

Examples:

  • Claude 4 / 4.5 on Bedrock should be able to accept PDFs above 4.5 MB
  • Nova should be able to accept PDF/DOCX media documents above 4.5 MB

This means LibreChat may reject files client/server-side that Bedrock would otherwise accept.

Reproduction

  1. Configure an AWS Bedrock endpoint in LibreChat
  2. Select a Claude 4+ model (for example Claude Sonnet 4 / 4.5) or a Nova model
  3. Choose Upload to Provider
  4. Attach:
    • a PDF > 4.5 MB for Claude 4+
    • or a PDF / DOCX > 4.5 MB for Nova
  5. Send the message

Actual behavior

LibreChat rejects the upload before the request is sent to Bedrock, with an error such as:

Document validation failed: File size (8.6MB) exceeds the 4.5MB limit for Bedrock

Expected behavior

Bedrock validation should be model-aware instead of applying a blanket 4.5 MB rule to all documents.

Suggested behavior:

For Anthropic Claude on Bedrock

  • If model is Claude 4 or later and file type is PDF:
    • do not enforce the 4.5 MB per-document validator
    • still enforce other applicable constraints (for example request-size / page-count / encryption checks where relevant)

For Amazon Nova on Bedrock

  • If model is Nova and file type is PDF or DOCX:
    • do not enforce the 4.5 MB per-document validator
    • instead validate against Nova’s media-document rules

For other Bedrock models / document types

  • keep the existing 4.5 MB validation where appropriate

Important note about AWS docs inconsistency

  • The Bedrock User Guide says Claude 4+ PDFs and Nova PDF/DOCX are exceptions to the 4.5 MB limit
  • But the Bedrock API Reference still says each document must be no more than 4.5 MB

Relevant API reference:

Additional Claude PDF note: visual PDF support on Bedrock

Anthropic’s Bedrock PDF documentation says that on Bedrock Converse API there are two PDF modes:

  • without citations: basic text extraction only
  • with citations enabled: full visual PDF understanding (charts, images, layout)

Relevant docs:

So there may be a second improvement area here:

Optional enhancement

Support Bedrock Claude PDF uploads in a way that can expose or enable the citations path for "visual PDF" understanding.

Maybe could be a path for a new OCR endpoint using bedrock Claude visual understanding for PDF.

Thanks!

More details

NA

Which components are impacted by your request?

Endpoints

Pictures

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions