You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Upload - SDK - Zod invalid_union error before it ever reaches the OpenRouter API #83
Problem
When using @openrouter/sdk to send a chat request with a file content item (as shown in the official documentation for PDF processing), the SDK rejects the request with a SDKValidationError / Zod invalid_union error before it ever reaches the OpenRouter API.
The corresponding Zod schema used internally by chat.send enforces this union at runtime. As a result, any content item with type: "file" is considered invalid, even if it matches the structure shown in the official docs.
In short: the SDK’s validation layer and type definitions lag behind the documented feature (PDF/file support via type: 'file' + file: { filename, fileData }), so all such requests are rejected client‑side by the SDK before reaching OpenRouter.
Activity
stayingcool commentedon Nov 15, 2025
I'm using:
mattapperson commentedon Nov 15, 2025
Thanks for the report and I apologize for the inconvenience. I’ll get a new build out with a fix asap
Add file content type support for PDF and document uploads
z3ugma commentedon Jan 27, 2026
I am also running into this, what is the status on the PR #121 getting merged?