Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a compatibility issue where the Anthropic Messages API endpoint (RequestType.ChatMessages) does not support HTTP(S) image URL attachments, only base64 data URLs. The fix excludes the Messages API from the image URL upload code path, ensuring images are sent as base64 data URLs instead.
Changes:
- Modified image upload logic to exclude Messages API from URL-based image uploads
- Renamed variable from
isChatRequesttoisCopilotRequest(though the naming could be clearer) - Added comment explaining the exclusion of Messages API
Comments suppressed due to low confidence (3)
src/extension/prompts/node/panel/image.tsx:99
- The function
modelCanUseImageURL(chatModelCapabilities.ts:181) always returnstrue, but this is misleading given that the Messages API endpoint doesn't support HTTP(S) image URLs. Consider either:
- Renaming it to clarify it checks model capabilities, not endpoint capabilities (e.g.,
modelSupportsVisionImages) - Extending it to accept an optional endpoint parameter to check both model and endpoint compatibility
- Creating a separate function like
endpointSupportsImageURLsthat checks the RequestType
This would make the code more maintainable and reduce the need for manual endpoint checking in multiple places.
This issue also appears in the following locations of the same file:
- line 97
- line 96
if (isCopilotRequest && enabled && modelCanUseImageURL(this.promptEndpoint)) {
src/extension/prompts/node/panel/image.tsx:97
- The variable name
isCopilotRequestis misleading. RequestType.ChatCompletions and RequestType.ChatResponses are also "Copilot requests" in the same way that RequestType.ChatMessages is. This variable now represents "requests that support image URL uploads", not generic "Copilot requests". Consider renaming to something more descriptive likesupportsImageURLUploadorisChatCompletionsOrResponsesto accurately reflect what it checks.
const isCopilotRequest = typeof this.promptEndpoint.urlOrRequestMetadata !== 'string' && (this.promptEndpoint.urlOrRequestMetadata.type === RequestType.ChatCompletions || this.promptEndpoint.urlOrRequestMetadata.type === RequestType.ChatResponses);
src/extension/prompts/node/panel/image.tsx:96
- The comment "exclude messages API for now since it causes issues" is too vague and doesn't explain the root cause. The actual issue is that the Anthropic Messages API only accepts base64-encoded images (data URLs), not HTTP(S) URLs for images. The messagesApi.ts conversion function (rawContentToAnthropicContent) only handles data URLs by extracting base64 content from them. Consider updating the comment to: "Exclude Messages API - it only supports base64 data URLs, not HTTP(S) URLs for images (see messagesApi.ts rawContentToAnthropicContent)".
// exclude messages API for now since it causes issues
dmitrivMS
approved these changes
Feb 24, 2026
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.
there is an issue where messages API does not suppoort image url attachments for some reason.
pending disucssion with capi/anthropic. DO NOT MERGE YETTTTT