Skip to content

feat(images): support JSON edit requests#222

Merged
Menci merged 24 commits into
mainfrom
codex/provider-images
Jul 15, 2026
Merged

feat(images): support JSON edit requests#222
Menci merged 24 commits into
mainfrom
codex/provider-images

Conversation

@Menci

@Menci Menci commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • accept the official application/json Images Edits request alongside multipart uploads at the public /images/edits routes
  • normalize uploaded files, inline data URLs, and external/file references into single-truth semantic sources before provider dispatch
  • serialize upload-like requests with scalar parameters as multipart, while reference or mixed requests use JSON without downloading remote images
  • mount the same public generation and edit handlers under /azure-api.codex

Rollout order

Merge and deploy this PR before #223. This PR adds the server surface that the generated requires_openai_auth = true configuration activates.

Test plan

  • pnpm run test (352 test files, 4314 tests)
  • pnpm run lint
  • pnpm run typecheck
  • focused Images IR, public/Codex routes, Azure/custom providers, and hosted image-generation integration tests (162 tests)
  • live Azure JSON-reference image edit probe returned HTTP 200 with one generated image

Menci added 8 commits July 15, 2026 03:09
Mount the image generation and edit paths Codex appends to its configured model-provider base. Reuse the public generation handler and translate Codex's JSON multi-image edit request into the shared multipart image-edit execution path.

Preserve original request bytes for dump capture, validate the Codex edit envelope and base64 image URLs, and document the namespaced route surface with pinned Codex sources.
Accept Codex edit inputs from inline or remote image URLs, validate their actual raster format, and reuse the hosted image shim's edit transcoding path. This keeps standalone and hosted image edits aligned while preserving the provider-relative JSON adapter.
Avoid copying complete image buffers in the provider-relative edit adapter and tighten the route contract descriptions.
Canonicalize supported MIME aliases during edit preparation and carry only prepared PNG, JPEG, or WebP sources into multipart construction. Model generation and edit calls as distinct requests so raw image sources cannot reach the edit wire builder.
Keep MIME canonicalization and transcoding-deduplication tests with the shared edit-source module, and keep its MIME helper private to that module.
Menci added 4 commits July 15, 2026 11:40
Treat the current application/json Images Edits request as a first-class public wire shape alongside multipart uploads. Preserve JSON image_url, file_id, and mask references through provider dispatch, and mount the same generation and edit handlers under the Codex provider base.
@Menci Menci changed the title feat(codex): serve provider-relative image requests feat(images): support JSON edit requests Jul 15, 2026
Menci added 12 commits July 15, 2026 13:50
Normalize JSON references and multipart uploads into a homogeneous Images Edits request. Providers now choose JSON for image_url/file_id references and multipart for uploaded files, preserving Codex wire behavior without downloading URLs or base64-encoding binary uploads.
Preserve unknown JSON-reference fields, model upload parameters as scalar values, and type hosted edit sources after MIME preparation. Keep request builders private and verify their observable provider requests through integration tests.
Separate scalar upload parameters from opaque JSON parameters, preserve unknown reference fields and nullable wire values, and keep post-materialization hosted-tool state typed. Serialize single uploads with the canonical image field while retaining image[] for multiple uploads.
Decode base64 data URLs into the upload source variant and keep one semantic truth per image. Providers prefer multipart for upload-only requests, use JSON for references, and encode uploads from bytes only when a mixed request requires JSON.
Represent uploaded files, inline data URLs, and external references as separate single-truth IR variants. The shared OpenAI serializer emits multipart for upload-like scalar requests and JSON for reference or mixed requests, decoding or encoding only at the provider wire boundary.
Choose multipart only after every source and parameter is known to be form-safe. Preserve inline reference extensions through JSON and defer base64 decoding until the complete request qualifies for multipart.
@Menci Menci merged commit 62a5f94 into main Jul 15, 2026
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.

1 participant