Skip to content

feat(api-server): inline MEDIA: image tags as data URLs for remote frontends (#2696 salvage) - #56959

Merged
teknium1 merged 1 commit into
mainfrom
salvage/2696-api-server-media
Jul 2, 2026
Merged

feat(api-server): inline MEDIA: image tags as data URLs for remote frontends (#2696 salvage)#56959
teknium1 merged 1 commit into
mainfrom
salvage/2696-api-server-media

Conversation

@teknium1

@teknium1 teknium1 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

API-server responses now inline MEDIA:<path> image tags as base64 data URLs, so remote OpenAI-compatible frontends can actually render server-local screenshots and generated images instead of seeing dead file paths.

Salvage of the surviving piece of #2696 by @tarunravi — the PR's other two changes (tool progress streaming, SSE None-sentinel fix) were independently superseded on main by the structured hermes.tool.progress SSE events and the rewritten queue-drain loop.

Changes

  • gateway/platforms/api_server.py: _resolve_media_to_data_urls() — inlines small (≤5MB) local images (png/jpg/jpeg/gif/webp/bmp) as markdown data URLs; non-image, missing, or oversized paths pass through untouched. Wired into all four response surfaces: chat completions (non-streaming), session chat, session chat stream final event, Responses API
  • tests/gateway/test_api_server_media_data_urls.py: 7 tests (inline, backtick-wrapped, missing file, non-image, oversized, multi-tag, passthrough)
  • scripts/release.py: AUTHOR_MAP entry for @tarunravi

Validation

Result
new tests 7/7 pass
tests/gateway/test_api_server_{normalize,multimodal,jobs}.py 81/81 pass
ruff clean

Infographic

infographic

Nous Research

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Jul 2, 2026
…mote frontends

Salvage of the surviving piece of #2696 by @tarunravi. The PR's other two
changes (tool progress streaming, SSE None-sentinel fix) were independently
superseded on main by the structured hermes.tool.progress SSE events and the
rewritten queue-drain loop.

Remote OpenAI-compatible frontends can't read server-local file paths, so
MEDIA:<path> tags (browser screenshots, generated images) were dead text.
_resolve_media_to_data_urls() now inlines small (<=5MB) local images as
markdown data URLs across all four response surfaces: chat completions
(non-streaming), session chat, session chat stream final event, and the
Responses API. Non-image, missing, or oversized paths pass through
untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants