Repository navigation
In progress
In progress
Copy link
Labels
P2Later; accepted but not scheduleddesignDesign decision or contract workenhancementNew feature or request
Description
What are you trying to do? · 你想完成什么?
Run media operations on providers that are not a bundled catalog row with its own vendor entry:
- A provider the user created against an OpenAI-compatible endpoint (its id is a UUID): its image and speech models report
adaptertoday, becausedim-modality-aimuxbinds rows by catalog provider id only (vendor::vendor,crates/dim-modality-aimux/src/vendor.rs; Modality A.2: "A created provider's id is a canonical UUID, which matches no row, so its media operations report theadapterreason"). - Relays whose media models speak another vendor's protocol: the Dim account relay serves
minimax-h3andseedance-*; AiHubMix, New API and Zenmux listdoubao-seedance-*andminimax-h3*. The request still goes to the relay with the relay's credential; only the protocol implementation differs.
The previous product did both. It resolved an adapter provider id per provider record (resolveModalityAdapterProviderId):
- an explicit
metadata.modalityAdapterProviderId; - else the builtin's own id;
- else by driver kind:
gemini→google,new-api-router→new-api,openai-compatible/openai-responses→openai.
Then it looked up (adapter provider id, model id) exactly, falling back to (adapter provider id, *). Relay aliases for specific models were registered under that family, for example openai/minimax-h3 and openai/seedance-2.0.
What should Dim do? · 你希望 Dim 怎么做?
The built-in adapter chooses its row from the provider's family as well as its catalog id:
- A bundled provider with its own row keeps it (today's behavior).
- Otherwise the row comes from the provider's protocol family, read from the resolved connection the adapter already receives (
ModalityConnection.protocol/ driver), for example OpenAI-compatible → theopenaipackage's image and speech models. - A model id can select a different implementation inside a family, so a relay's
minimax-h3uses the vLLM-Omni/videosvideo model ([feat] openai-compatible 视频模型:/videos 异步任务(vLLM-Omni、New API 与中继) aimux#530) andseedance-*uses the Ark video model ([feat] ByteDance Ark(火山方舟)媒体模型:Seedance 视频与 Seedream 图片 aimux#529), while base URL, headers and credential stay the relay's. operationsstays per model, so a family row never claims a model it cannot run: a chat model under the same relay gets no media operation. The snapshot keeps the Modality: Dim account image models are listed as available options but image.generate is unavailable #1887 contract: no available option the operation would refuse.
This changes a stated rule of Modality A.2, so the design must be updated and agreed first (AGENTS.md: the design document is authoritative). Decisions needed:
- where the family comes from: connection protocol, driver kind, or an explicit catalog field like the old
modalityAdapterProviderId; - whether model-id aliases live in the adapter crate or in the catalog entry.
Additional context · 补充信息
- Follows Modality: Dim account image models are listed as available options but image.generate is unavailable #1887 / fix(modality): serve Dim account image models and keep the snapshot consistent #1916, which added an explicit
dimcode-api-oauthrow. - Depends on aimux for the video implementations: [feat] ByteDance Ark(火山方舟)媒体模型:Seedance 视频与 Seedream 图片 aimux#529 (Seedance), [feat] openai-compatible 视频模型:/videos 异步任务(vLLM-Omni、New API 与中继) aimux#530 (openai-compatible
/videos, used by the relay'sminimax-h3), [feat] MiniMax H3 视频与图片模型(官方 /v2/video_generation 与 /v1/images/generations) aimux#528 (MiniMax H3 official API). - Out of scope: realtime sessions, music.
Metadata
Metadata
Assignees
Labels
P2Later; accepted but not scheduleddesignDesign decision or contract workenhancementNew feature or request
Activity
fix(modality-aimux): narrow the compatible-family fallback to served …
fix(modality-aimux): exclude the Seedream word family from the generi…
acecloud123 commentedon Nov 28, 2026
For a hosted image-generation test case in Dim, AceDataCloud’s GPT Image can return images inline on request. Its default is an image link, which the proposed Dim support doesn’t yet read. https://platform.acedata.cloud/documents/openai-images-generations-integration
fix(modality-aimux): ask compatible-family image gateways for inline …
fix(modality): whitelist the compatible fallback and refuse unreadabl…
fix(modality): serve only catalog image entries whose endpoints docum…
yyhhyyyyyy commentedon Nov 29, 2026
Design decision record for the first slice (PR #2266)
This records the architectural decisions #2266 carries, answering the two decision points this issue raises and the reviews on #2266 that asked for the record: what chooses the family, what stays adapter-owned, how recovery answers without a route, and what the later Ark and Seedream routing work must still decide. Three of them, the resolved
ModelProtocolas the family's source, the adapter-owned exclusion rules, and the provisionalNoneanswer at startup recovery, are submitted here for maintainer confirmation as the accepted decisions of this slice. #2266 isRefs #1927andRefs #1928and does not close either issue; the later routing slice will beFixes #1927andFixes #1928together.1. Which fact chooses the family (proposed for confirmation)
The family is the
ModelProtocolthat Provider resolves for each model. Provider derives one route per model id (routes), carries it on the selectable-for-modality snapshot (selectable_modality_models), and hands the connection's protocol to the adapter on everysubmitandwait(startup recovery has no connection and passes none). No catalog field like the oldmodalityAdapterProviderIdis added.Precedence inside the adapter's
binding: a provider whose id names a built-inVENDORSrow resolves to that row whatever the protocol says, and a row never falls back. A rowless provider enters the family fallback only when the whitelist admits it (eligible_for_fallback): a created provider's canonical lowercase UUID, the Dim account relay, or one of the two aggregator gateways this build carries contract tests for (aihubmix,zenmux). Every other rowless bundled id reports theadapterreason rather than answering generic endpoints its vendor never documented, because the vendors behind those ids document neither the endpoints nor the response shapes the compatible packages can consume.In the family fallback, only the OpenAI-compatible family carries media: video generation and the image operations go to the openai-compatible package, and speech synthesis and transcription go to the openai package, the only aimux package serving them for this family. A model whose protocol is another family (for example Anthropic or Gemini) reports
adapterand lists no media operation.2. Who owns the model routing rules (proposed for confirmation)
They live in the adapter crate,
crates/dim-modality-aimux:seedanceordoubao-seedanceas a word in the id, split case-insensitively on.,/,_and-byin_word_family) is refused byoperations,submitandwaitalike, because the Ark video API is a different route from the compatible family's/videos(is_ark_video_model); an image model whose id names the Seedream word family (is_seedream_image_model) is refused by the generic image fallback alone, because a Seedream endpoint answers image URLs by default while the compatible package reads inlineb64_jsonalone. The Dim account relay's image generation is not part of the generic fallback, so it keeps the OpenAI package for these models as for any other.aihubmixorzenmuxis refused unless its endpoint documentation proves the inline shape (catalog_image_verified). The admitted entries are the ids whose tail names the inline-answering prefixes plus the aihubmix entries whose published per-model endpoint schema lists the inline response value; an entry the gateway's own schema service answersmodel_not_foundfor is refused whatever its family documents. The audit of the merged catalog, deprecated entries included, splits the fifty five aihubmix image entries into thirty available (twenty three schema-verified, plus sevengpt-image-*ids whose gateway documentation states base64 by default), six Seedream-family ids, sixteen entries whose documentation verifies no inline shape and three more refused because the schema service answersmodel_not_foundfor them, and the fourteen zenmux entries into six available (allgpt-image-prefixed) and eight unavailable. An entry whose documentation later proves the inline shape is restored one at a time.seedance, orminimaxandh3withoutimage) decide which undeclared entries servevideo.generate, while the router's exclusions decide what the family binding can execute, and the two can disagree, so a recognizedseedancevideo stays refused on the routing side. The only shared piece is the word-family predicate itself, so the two layers cannot disagree about what a word is. The comments inmodality_operationsand provider-management 3.6 state this.openai/minimax-h3) has no counterpart in this slice: no alias is claimed runnable, and the catalog carries no per-model alias field. Where per-model mapping will live is one of the open questions below; this slice only decided that the exclusions above are adapter code.matched_model_idis added to the connection or the snapshot: the adapter reads the model id the job already carries.3. The provisional answer at recovery (proposed for confirmation)
A blocking operation never survives a restart: it carries no handle, so a restart leaves it
interrupted(A.2's statement for an adapter with no handle; see the module comment of the adapter,lib.rs). Video is the operation a restart resumes, and the task record carries no route. The engine deliberately does not re-resolve a connection to answer recovery's serving question; it asks the recorded adapter withNonefor the protocol (record_serves).In this slice, the adapter's
bindingtreatsNoneas the compatible family (the parameter and the match): the family answers as the compatible one would, while vendor rows, the whitelist and the word-family exclusions still apply, since they need no protocol. The consequence surfaces in the resumedwait: it re-resolves the binding with the live connection's real protocol (wait_video), and a route that does not match ends the task with the error the adapter returned, which the engine records under the adapter's own error code (wait_and_settle). The behavior is pinned by the engine testrecovery_resumes_a_video_task_it_never_re_reads_the_route_forincrates/dim-modality/tests/modality_flow.rs. Whether the record should carry enough of the route for recovery to answer exactly is open and listed below.4. What the later Ark and Seedream routing work must decide (open)
operationscurrently returns one uniform schema per operation for every model of the family; the per-model routes need their ownparams_schema(Ark's video API takes a resolution enum, not the pixel dimensions the generic schema declares), and how per-model schemas are produced and surfaced is undecided.b64_jsontoday. The binding now asks its gateway for inline bytes by default, which covers gateways that honorresponse_format; endpoints that ignore the field and answerdata[].urlalone still depend on upstream aimux support for downloading URL image responses.response_formatto non-OpenAI upstreams is undocumented for every non-prefixed row. Two of the eight unavailable zenmux entries,openai/gpt-5.4-proandopenai/gpt-5.5-pro, are conversational models mislabeled asimage-generationupstream, so they restore by their declaration being corrected rather than by any schema verification; the remaining six route to non-OpenAI upstreams and restore one at a time, each once its inline response through the gateway is confirmed, and the aihubmix entries restore one at a time as their schemas document the inline shape.5. The compatible image binding's request shapes (state after this slice)
The compatible fallback's package reads inline
b64_jsonalone, so the binding sendsresponse_format: "b64_json"through the same provider options that carryoutputFormat(image_options). A caller's ownresponse_formaton this binding may only request the inline format itself: any other value,urlabove all, is refused as invalid input insubmitbefore the job is accepted and again inwaitbefore any progress (check_image_response_format), so the refusal sends zero provider requests, on the top-level and theopenaiCompatiblenamespaced spellings alike. A caller that explicitly requests the inline format passes the check on every route; where it is forwarded it reads its image back. The Dim account relay never takes this path: its image binding is the openai package, which asks for inline bytes on its own. A caller'soutputFormatreaches the wire under the spelling the package documents:output_formaton the compatible binding, which forwards its provider options verbatim.One model-id exception exists, and it is where a gateway report on this issue lands. Model ids whose tail after the vendor namespace starts with
gpt-image-orchatgpt-image-send noresponse_formatthrough the compatible fallback (answers_inline_bytes_by_default): the same prefixes the aimux openai package omits the field for, applied to the id tail after the vendor namespace rather than the full id, because the real OpenAI and Azure endpoints rejectresponse_formatfor these models with an HTTP 400, and not asking keeps the inline results that pass-through gateways already return unchanged. The omission is total on these routes: a caller that explicitly requests the inline format, on either spelling, sees the redundant value dropped with the default, because a strict GPT Image endpoint rejects the field's presence and the answer is the same bytes without it; the strict contract is pinned bya_strict_gpt_image_endpoint_never_sees_response_formatincrates/dim-modality-aimux/tests/adapter.rs. The same exception marks where this slice's limit sits. A commenter on this issue reported a hosted gateway whose GPT Image can return images inline on request but whose default is an image link. On the state of this slice that combination still fails: the model id matches the prefix exception, so Dim does not ask for inline bytes, the gateway falls back to its default link shape, and the compatible package reads no image in it. This combination is a settled limitation of this slice, not a solved problem, and there is no caller-side workaround: the explicit inline value is omitted on these routes for the same strict-endpoint reason, so the combination waits on upstream aimux support for downloading URL image responses. The testan_inline_answering_model_id_sends_no_response_format_through_the_familyincrates/dim-modality-aimux/tests/adapter.rspins the current behavior.6. MiniMax H3 on this slice
The
minimax-h3video rows stay available end to end on the whitelisted gateways, exactly as the corrected catalog rows before this slice, and a user-configured compatible relay keeps serving MiniMax H3 video and image models through the family fallback unchanged. The only MiniMax entries this slice refuses are the two cataloged zenmux rowsminimax/minimax-h3-imageandminimax/minimax-h3-image-highspeed, and not for any MiniMax-specific reason: the zenmux image documentation is written as a pass-through of the OpenAI Images API, so whether the gateway forwardsresponse_formatto a non-OpenAI upstream is undocumented for those rows exactly as for every other non-prefixed zenmux row. The upstream MiniMax image API itself documents an inline response value; what is undocumented is only the gateway pass-through.7. Limits of this slice, stated as they are
An endpoint that ignores
response_formatand answersdata[].urlalone is still unreadable and reports no images after HTTP 200 (image_output); downloading such URLs depends on upstream aimux support. Video rows typedchatwith no stated output (the wan, kling, sora and pixverse rows) are not retyped in this slice and stay unrecognized, and rows whose declared kind contradicts their output, such as the six zenmux entries typedimage-generationwith a video output, serve nothing until their declaration is corrected. All verification of this slice ran against mock endpoints and fixture catalog rows; no live relay was exercised.The provider's configured endpoint, headers and credential stay exactly as configured in every family resolution: the binding selects only the aimux package.