Skip to content

fix: send OpenAI chat image data as data URLs - #16655

Merged
gr2m merged 2 commits into
mainfrom
bug-16654-1
Jul 5, 2026
Merged

fix: send OpenAI chat image data as data URLs#16655
gr2m merged 2 commits into
mainfrom
bug-16654-1

Conversation

@gr2m

@gr2m gr2m commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Background

OpenAI chat image parts with inline binary data were sent as bare base64 strings, which are not valid image URLs.

Summary

Encode inline image file parts as data:<media-type>;base64,... URLs when converting messages for OpenAI chat requests.

Manual Verification

Covered by the updated OpenAI chat message conversion tests.

Checklist

  • All commits are signed (PRs with unsigned commits cannot be merged)
  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Related Issues

Fixes #16654

@gr2m gr2m changed the title reproduction: Reproduces #16654 fix: send OpenAI chat image data as data URLs Jul 3, 2026
@gr2m
gr2m marked this pull request as ready for review July 5, 2026 19:27
@gr2m gr2m added the backport Admins only: add this label to a pull request in order to backport it to the prior version label Jul 5, 2026
@gr2m
gr2m merged commit b51ed36 into main Jul 5, 2026
51 checks passed
@gr2m
gr2m deleted the bug-16654-1 branch July 5, 2026 19:28
github-actions Bot added a commit that referenced this pull request Jul 5, 2026
@github-actions github-actions Bot removed the backport Admins only: add this label to a pull request in order to backport it to the prior version label Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

⚠️ Backport to release-v6.0 created but has conflicts: #16699

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
@ai-sdk/amazon-bedrock 5.0.12 github npm
@ai-sdk/azure 4.0.8 github npm
@ai-sdk/openai 4.0.8 github npm

gr2m added a commit that referenced this pull request Jul 6, 2026
v6 already encodes inline image data as data URLs with its own data model,
so the incoming changes were redundant/incompatible. Kept the v6 implementation
and existing v6 tests; dropped the main-only Uint8Array test and the
top-level-only media type resolution describe block (both rely on the
resolveFullMediaType helper and {type:'data'} data model absent in v6).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat converter sends images as bare base64 instead of a data URL

2 participants