Skip to content

fix(media): support configured image providers#1503

Closed
qdivan wants to merge 1 commit into
EKKOLearnAI:mainfrom
qdivan:fix/apikey-image-custom-provider
Closed

fix(media): support configured image providers#1503
qdivan wants to merge 1 commit into
EKKOLearnAI:mainfrom
qdivan:fix/apikey-image-custom-provider

Conversation

@qdivan

@qdivan qdivan commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Allows /api/hermes/media/apikey-image-generate to use a requested configured custom_providers entry instead of only the hardcoded fun-codex provider. The default remains fun-codex for backward compatibility, but callers can now send provider, provider_name, or custom_provider to route image generation through another configured OpenAI-compatible image provider.

Fixes #1483

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • packages/server/src/controllers/hermes/media.ts: resolves the requested API-key image provider from custom_providers, supports custom: prefixes, and reads api_key_env/key_env in addition to direct api_key.
  • tests/server/media-controller.test.ts: adds a regression that routes image generation through a non-fun-codex provider and verifies the /v1/images/generations request.

How to Test

  1. PATH=/Users/shangyifan/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH npm exec vitest -- run tests/server/media-controller.test.ts
  2. git diff --check
  3. PATH=/Users/shangyifan/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH npm run harness:check
  4. PATH=/Users/shangyifan/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH npm run test:coverage
  5. PATH=/Users/shangyifan/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH npm run build

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run the focused server test and build gates listed above
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS with Node v24.14.0 Codex runtime

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — N/A, no public config shape changed
  • I've updated cli-config.yaml.example if I added/changed config keys — N/A, existing custom_providers fields are used
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — N/A, server controller path only
  • I've updated tool descriptions/schemas if I changed tool behavior — N/A

Screenshots / Logs

No screenshot required; this is a local server media API routing fix covered by controller tests.

Duplicate search: checked active PRs for fun-codex, apikey-image-generate, missing_fun_codex_provider, images/generations, and custom-provider image/video routing. Adjacent PRs #904, #950, #1261, #1071, #1314, and #1407 do not cover this endpoint.

@qdivan qdivan marked this pull request as ready for review June 11, 2026 16:12
@EKKOLearnAI

Copy link
Copy Markdown
Owner

skill 需同步改动

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.

[Bug]: 选用自定义 OpenAI 兼容服务商下的 image / video 模型时,全部 404

2 participants