Build1 distinct publisher3 min readPublished
A dev.to practitioner report on routing image and video jobs leaves the LLM proposing and gives server code the veto, because capability, aspect ratio, duration, price and access tier are the fields that break the call.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
The naive router breaks at the moment a model name crosses from prose into a billing call. That is why the pipeline puts server-side capability and cost validation after the LLM proposal instead of trusting the proposal [1]. Everything upstream exists to shrink the set of names the planner is allowed to produce, and the stated rule is that the planner must not rely on training data to remember model constraints [12].
Classification is the first cut. `modelKindFor` takes media type, reference count and mode, then returns `video` for any video request, `image-fusion` when the mode is fusion or the reference count is two or more, `image-i2i` when the mode is edit or there is exactly one reference, and `image-t2i` otherwise [5]. Reference count is doing real work there: one reference means a local edit or a reinterpretation, several imply fusion with consistency constraints [6]. No model has been named yet.
The media-type classifier is where I would spend review time. It tests image-to-video patterns first, then image signals, then video signals, and returns null when nothing matches [9]. Precedence is the mechanism. "Create a cinematic 3x3 photo grid" and "Animate this photo into a short cinematic video" both carry image and cinematic language, and only the second is a video job [10]. Reverse the order and you charge someone for a video they did not ask for. The author reserves the LLM classifier for genuinely ambiguous briefs and records whether each decision came from rules, llm or fallback so misroutes can be traced [11].
Then the catalog. `ModelSpec` carries kinds, minimumTier, baseCredits, resolutions, aspectRatios and formats, and `catalogForTier` hands the planner only the models whose kinds include the task and whose minimumTier ranks at or below the caller's tier [13][14]. Four generation kinds against three tiers gives twelve filtered views that function has to get right, which is a small enough matrix to enumerate as fixtures [19]. The claim for doing it this way is that it is cheaper and safer than passing a long list of unusable models [15]. The cheap part is tokens. The safe part is that a model absent from the prompt cannot come back in the answer.
The client-side detail matters more than its two sentences suggest: browser components need capability metadata but must not import provider SDKs, so the design keeps a client-safe projection with no server clients or environment-dependent imports, generated from the authoritative registry and tested for drift [16]. Drift there presents as a picker offering a model the server will refuse.
This transfers on one condition, which the piece states plainly. The product spans text-to-image, image editing, multi-reference fusion and video, each with different aspect ratios, durations, pricing rules and access tiers [2]. With one model and one tier, the catalog and the validator are overhead you maintain for nothing. The evidence is also one practitioner's account with no error rates or misroute counts, and the excerpt breaks off mid-list before the JSON repair strategy [20]. The failure list is still the right test suite: truncated JSON, unknown or deprecated model IDs, unsupported resolutions, a model from the wrong tier, and prose that disagrees with the structured values it sits beside [18].
Ranked by verification strength, evidence, and original report placement.
The described pipeline runs: user brief, deterministic intent signals, task kind plus input capability, tier-filtered model catalog, LLM proposal, server-side capability and cost validation, executable generation plan.
The author's stated production lesson is to treat the LLM as a planner, not as the final authority.
The GenerationKind type has four values: image-t2i, image-i2i, image-fusion and video.
modelKindFor(mediaType, referenceCount, mode) returns "video" if mediaType is video, "image-fusion" if mode is fusion or referenceCount >= 2, "image-i2i" if mode is edit or referenceCount === 1, and "image-t2i" otherwise.
Reference count is treated as routing input, not metadata: zero references usually means text-to-image, one may mean a local edit or reinterpretation, multiple imply fusion and consistency constraints, and a video request needs duration, motion and sometimes audio capabilities.
The author holds that a pure keyword router is too brittle and a pure LLM router too nondeterministic, so a hybrid router works better.
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 31, 2026
Follow any of these and your For You feed starts watching them — no settings page required.
build
Queueing the OpenAI call turns model latency into a polling problem1 distinct publisher
build
Allow-list the closed set, block-list the open one: 193 thin geo pages, one gate1 distinct publisher
build
A GAN beauty filter is a device budget allocation, not a feature toggle1 distinct publisher
build
Agent memory rots by accumulation, and the missing primitive is a supersession key1 distinct publisher
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Legible code, zero measurements
What is checkable here is genuinely checkable: the routing function, the ordered media-type classifier, the ModelSpec catalog and the plan interface are printed in full, and their logic survives a careful read. What is absent is any number at all — no misroute rate, no credit spend, no latency for the escalation to an LLM classifier, not even a catalog size to make 'dramatically reduces' concrete. And the text stops mid-sentence during the output-parameter rules, so the author's own account of the validation half is incomplete.
No deployment anyone can point to
'The production lesson was straightforward' is as close as this reporting gets to saying the design shipped. There is no product name, no user or request volume, no provider bill, no repository — nothing that would let us treat this as a deployment rather than a described architecture. Assigning an adoption figure would mean inventing the footprint.
Modest framing, unpriced payoffs
The headline concedes the LLM only suggests, and the author explicitly warns against letting deterministic rules override subjective creative choices — that restraint keeps the gap small. It opens anyway on the two sentences doing the persuading. 'Dramatically reduces the number of models' and 'cheaper and safer' are the reasons a reader would adopt this, and both arrive without a single figure, next to a naive approach declared unreliable on assertion alone.
No stake we can see
We cannot read a motive here, and will not invent one. The author names no employer, no product of their own and no model provider; the free, premium and ultimate tiers in the code belong to an unnamed system, and no provider is praised or criticised anywhere in the text. There is no promotional pitch to weigh and no vendor relationship to disclose or hide.
Trust the design, not the verdict
Two different things are being asked of this reporting and they deserve different answers. As a description of one router's structure it is internally consistent and specific enough that we would repeat it without hedging. As proof that the structure beats the prompt-straight-to-model shortcut, it is one unverified voice with nothing measured and the closing argument cut off. Borrow the pattern as a hypothesis; do not cite it as a result.