Skip to content

fix: forward Claude image blocks to OpenAI chat and Responses requests - #155

Merged
lich0821 merged 1 commit into
lich0821:masterfrom
pcbeingused333:fix/claude-openai-images
Oct 27, 2026
Merged

lich0821 merged 1 commit into
lich0821:masterfrom
pcbeingused333:fix/claude-openai-images

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Images in a Claude request (the image blocks Claude Code sends when a screenshot is pasted) were dropped silently by the Claude -> OpenAI converters: the chat converter only read text, thinking, tool_use and tool_result blocks, and the Responses converter did the same, so the model answered without seeing the image. The Gemini converter already forwards them.

  • Chat: a user message with images now gets its content as a list of parts, in order: {"type": "text", ...} and {"type": "image_url", "image_url": {"url": ...}}. A base64 source becomes a data:<media_type>;base64,<data> URL and a url source is forwarded as is. Messages without images keep the plain string content they had.
  • Responses: the same blocks become input_image parts ("image_url": <url>) next to the input_text parts.

Image blocks inside tool_result content are not converted, since OpenAI tool messages are text only.

Tests: claude_images_test.go covers base64 and url images in both converters and that image-less messages are unchanged; the image cases fail on master. go vet and go test ./internal/... pass. Not run against a live OpenAI or compatible upstream.

This change was prepared with AI assistance (Claude Code).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@lich0821
lich0821 merged commit 3dad153 into lich0821:master Oct 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants