Skip to content

feat(api): add ZenMux image generation support - #15670

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.52from
JeanRGW:feat/zenmux-image-generation
Oct 7, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.52from
JeanRGW:feat/zenmux-image-generation

Conversation

@JeanRGW

@JeanRGW JeanRGW commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add zenmux/ and zm/ routing to /v1/images/generations, reusing the existing ZenMux API-key connection.
  • Send OpenAI-publisher image models to ZenMux's OpenAI Images API; translate other publishers to Vertex AI :predict (instances / parameters) and normalize predictions into OpenAI image responses.
  • Include Ming Design, GLM Image, Grok Imagine 2.0, Muse Image, and GPT Image models in the image catalog. Preserve publisher-qualified upstream model names.
  • Enforce Ming Design's text-only, model-selected dimensions contract: reject explicit size/aspect-ratio/resolution settings without contacting upstream. Support output-format selection without injecting default dimensions.
  • Validate requests/responses with Zod, sanitize errors, preserve upstream error status, propagate cancellation, and use the existing public-only/DNS-pinned image download policy without forwarding credentials.
  • Document per-protocol options and dimension semantics. This is generation-only, not reference-image editing.

Related Issues

Validation

  • Change type: provider / routing
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base (release/v3.8.52, 2d6d630f); focused checks rerun afterward
  • Production-code changes include a new automated test

Passed locally:

node --import tsx/esm --test --experimental-test-coverage --test-coverage-include='**/imageGeneration/providers/zenmux.ts' tests/unit/zenmux-image-generation.test.ts tests/unit/image-generation-handler.test.ts
npm run typecheck:core
npm run lint
npm run check:provider-consistency
npm run check:provider-assets
npm run check:docs-all
  • 79 tests passed (29 ZenMux tests plus 50 existing image-handler tests).
  • TDD: before implementation, 12 tests failed, including canonical/alias resolution and successful endpoint dispatch; the completed regression suite passes.
  • Documentation checks passed using Git Bash as ComSpec on Windows (the env-doc scanner invokes POSIX shell commands).
  • npm run gen:provider-reference was checked: it does not consume the image registry and produced only unrelated pre-existing documentation drift; that generated drift is not included.
  • provider-translate-path-golden.test.ts: 2 passed / 1 failed locally. The only differences are the existing GitHub/GHE Copilot user-agent values containing (win32) instead of the committed (linux) snapshot; its sources and snapshot are unchanged. No golden regeneration is included.
  • Full unit/Vitest suites, repository-wide coverage gate, and production build are left to CI, as described by the PR template. No live generation requests or paid API calls were made for this change.

Tests Added Or Updated

  • tests/unit/zenmux-image-generation.test.ts: provider/alias/catalog resolution, both endpoint protocols, dimensions and output settings, Ming restrictions, invalid requests, malformed/empty/filtered responses, sanitized HTTP/network errors, timeout, cancellation, and safe URL-to-base64 conversion without credential forwarding. Tests drain pending call logs and close temporary DB handles.

Coverage Notes

  • New ZenMux handler: 99.23% lines, 97.03% branches, 81.82% functions in the focused Node coverage run.
  • Existing image-handler tests also cover the new dispatcher branch. No quality baseline or global coverage threshold was changed; full repository coverage remains a CI check.

Reviewer Notes

  • Protocol sources: Vertex predict, OpenAI Images API.
  • Vertex pixel size is translated to its exact aspect ratio only; image_size supplies an explicit resolution tier. Actual dimensions, allowed ratios, counts, and model availability remain upstream/model-specific.
  • Ming Design never receives implicit dimensions. response_format: "url" can return a base64 data URL when upstream returns only image bytes.
  • No new dependencies, credentials, DB migrations, API routes, or changes to chat execution.

@JeanRGW
JeanRGW marked this pull request as ready for review October 6, 2026 16:56
@JeanRGW
JeanRGW requested a review from diegosouzapw as a code owner October 6, 2026 16:56
@diegosouzapw
diegosouzapw merged commit d7b59c3 into cheaper-inference:release/v3.8.52 Oct 7, 2026
3 checks passed
diegosouzapw added a commit that referenced this pull request Oct 7, 2026
Records the Onda A quality drift on the post-squash tip. Product squashes do not carry the baseline.

File-size ceilings inside `frozen`, measured with `split("\n").length`:

- `EditConnectionModal.tsx` 1631 → 1634 (#14907)
- `open-sse/executors/default.ts` 1209 → 1213 (#15576)
- `open-sse/handlers/imageGeneration.ts` 3334 → 3346 (#15670)
- `open-sse/services/claudeCodeCompatible.ts` new freeze 1245 (#15457)
- `open-sse/services/combo/executeTargetAttempt.ts` 1273 → 1280 (#15594)
- `open-sse/services/combo/roundRobinCombo.ts` 1285 → 1288 (#15594)

Narrow i18n adopt, hashes only, for the five docs this wave edited: `docs/DEVIN_CLAUDE_BRIDGE.md`, `docs/architecture/RESILIENCE_GUIDE.md`, `docs/guides/SETUP_GUIDE.md`, `docs/guides/TROUBLESHOOTING.md`, `docs/reference/API_REFERENCE.md`.

`node scripts/check/check-file-size.mjs` passed. `node scripts/i18n/check-translation-drift.mjs` passed after the adopt. The legacy string map was not edited.

⚠️ base-red inherited: #15306
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