feat: recover from image rejections and add Files API image upload - #101
Merged
Merged
Conversation
When a provider rejects an image (e.g. DeepSeek's 'This model does not support image' 400), the session is no longer frozen: the rejected image is stripped from all later requests, across turns and session reloads. Remote http(s) media is now capability-gated, the non-standard image_url id is dropped, and a config-declared image_file_api capability sends images via the provider's Files API in addition to inline base64 and URLs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Not tied to an upstream issue — fork-internal change requested by the maintainer.
Problem
When a provider (e.g. DeepSeek) rejects an image with a 400, the session is permanently frozen: the offending image stays in the conversation history and is re-sent on every subsequent prompt, so every turn fails until the user starts a new session. There is also no way to send an image via the provider's Files API — only inline base64 and passthrough URLs — so large images or images over the 48 MiB body limit cannot be processed.
What changed
idfield on the OpenAIimage_urlwire part.image_file_apicapability that sends images via the provider's Files API (filecontent part withfile_id), alongside inline base64 and URL passthrough.Checklist
gen-changesetsskill.gen-docsskill, or this PR needs no doc update.