Repository navigation
Send images to the Gateway models that accept them - #410
Merged
Merged
Conversation
A router configured in the Gateway's models had no context window or output limit in Agent configurations unless the administrator set them on the router, so Agents used their own defaults, which can exceed a tier model's window. The catalog now gives such a router the smallest limits among its tier and default models, as for a Team's router; limits set on the router are kept. Only Agents configured with the router are reconfigured when its limits change.
A complexity router's tier model that failed, such as an Agent's GitHub Copilot model while its proxy was down, failed the request with 503 although the router's other tiers could answer, and the error named the router's internal model group. The guard now gives a router request fallbacks for that request only: the tier's other models, the higher tiers, the default model, then the lower tiers. Fallbacks the administrator, a key, a team or the request names apply instead; refusals and unreadable encrypted reasoning still go to no other model. LiteLLM's router details are kept out of errors, retry fields are dropped from router_settings_override as from the body, and the request log records fallback_from, attempted_fallbacks and fallback_cause.
Hermes showed a Team router by its internal name, cetirun-router-<hash>, and clients that list the key's models saw that name. The operator now keeps a key alias for each granted Team router, the router's name for its internal name, unless the Agent reaches another model by that name, and records it on the router's status. Hermes is configured with the router's name; OpenClaw keeps the internal name its sessions hold. The Gateway lists such a router under its name only. A Policy's per-model limit for a Team router's name is set under the internal name, which the Gateway counts.
…outing docs The smart-routing page and the Gateway README still said that Team routers classify with heuristic or llm only and that a failed decision classifier falls back to the heuristic scorer. Team routers take a decision model since #348, the Gateway shortens a request to fit the decision model, and a jev router sends a request it cannot classify to its default model.
… measurement On the e2e cluster, a router request whose Copilot tier failed was answered after a fallback to the router's Azure tier and a failover within that model, and the request log reported attempted_fallbacks 2 where the response header said 1: LiteLLM counts failovers to another deployment of the same model as well.
OpenClaw and Hermes treated most Gateway models as text-only: Hermes every one, OpenClaw every name its own catalog does not know (routers, Copilot Claude and Gemini, merged names). Hermes had the model describe each image in an extra call; OpenClaw had another model describe it and offered no computer tool. The operator now reads supports_vision from the Gateway's model info and the price table. A shared name accepts images when every deployment does, and the Agent's own Copilot route under the name too; a router when every model it sends requests to answer does. A chart that declares aiGateway.visionModels gets the list: OpenClaw sets input text and image, Hermes supports_vision, for those models only.
…ication With images, OpenClaw passes on the images of a tool result, such as a screenshot of its computer tool, in a user message of their own, labelled "Image(s) from tool result #1 (computer):". A complexity router classifies the newest message a person wrote and took that label for it: measured on LiteLLM 1.105.6, a request for a design that a heuristic router put in the medium tier went to the simple tier after one screenshot. A jev router kept the complex tier. Team routers and the routers of the Gateway chart that set no markers of their own now leave the label out, as they leave out OpenClaw's context. Each Team router is registered again once, as its configuration changes.
Zhupku
marked this pull request as ready for review
November 2, 2026 13:58
This was referenced Nov 2, 2026
…the name A per-model limit that an AgentPolicy sets for a Team router's name was moved to the router's internal name. When one of the Agent's GitHub Copilot models has the same name, the key gets no alias for the router, and the Agent still requests the Copilot model by that name. The Copilot model then had no per-model limit, on every reconcile, also when the router was not granted. The operator now copies the limit to the internal name and keeps it under the router's name. The Gateway counts the router's requests under the internal name, also those sent by the alias. The name's limit applies to the other model when the name is not the router's alias. The copy does not depend on the alias, which the same pass decides later, after the Copilot routes are registered, so no pass leaves either model without its limit. If the policy limits both names, the internal name gets the smaller value. Tests: the existing limit test now expects the name to keep its limit and checks the smaller-value rule in both directions; a new test covers a router named like a Copilot model with RPM and TPM limits, granted and withdrawn.
Brings in #397, #409, #413 and the dependency updates. Conflicts were in the documentation only: the Gateway chart README, models.md and smart-routing.md. The text of main is kept for make deploy, for the Gateway router auto that make deploy requires, for the Team router examples (auto-team) and for the Portal labels. The text of this branch is kept where it describes behaviour that this branch changes: Hermes shows a Team router by its name through the key alias, the operator gives a Gateway router the smallest limits of its tier and default models unless the router sets its own, and a failed tier goes to the router's other models. The jev Team router example of this branch is dropped, because main's example covers it. The CRDs were regenerated with controller-gen v0.21.0 and match the merged types.
…s to the key The README said that LiteLLM uses only the models that the caller's key can use for the fallbacks that the guard adds to a router's request. LiteLLM examines the key for fallback targets only with general_settings.enforce_fallback_model_access, which the chart sets with operatorIntegration. main now says the same for router.fallbacks. A standalone Gateway does not examine the key, but these fallbacks go only to the router's own models, which the router can select for the key anyway.
8 tasks done
…sion Takes #396's review fix and its merge of main (#397, #409, #413). The conflicts were in the docs only. In models.md, both branches added a section after the sources of the Copilot part: the Images section of this branch comes first, then main's "When the budget runs out". In smart-routing.md, the Agent page paragraph of #396 is kept, and the sentence about images follows as its own paragraph. It now names every model that the router sends requests to, because a Gateway router's default model also counts. The CRDs regenerate with no difference.
Member
|
Zhupku the PR needs rebase |
main has #396 as one squashed commit (8ae128c), whose tree is the same as the head of #396 that this branch already contains (ca86800), and #408 (Go module updates). Git reported conflicts in six files only because the squashed changes overlap the changes of this branch. main changed nothing else in these files, so this branch's version is kept for them. The result is this branch's tree with the go.mod and go.sum files of #408.
Zhupku
pushed a commit
that referenced
this pull request
Nov 3, 2026
Brings in #410 (squashed as 25bd921). One conflict, in the aiGateway row of crds.md: #410 added the vision fields of the Copilot routes and the routers to the row, and this branch the sentence on copilot.notAllowed. Main's row is kept, with this branch's sentence. #410 also changed agent_types.go, ai_gateway.go, ai_gateway_copilot.go and ai_gateway_copilot_merge.go, which merged without conflicts. In each code and test file, this branch's change is now line for line the same as in a test build of #396, #410 and this branch that ran on a test cluster. The CRDs and the deepcopy code regenerate with no difference.
8 tasks done
7 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenClaw and Hermes treated most AI Gateway models as text-only, so an image that a user attached did not reach the model:
auto,auto-decision, Team routers), the GitHub Copilot models of other vendors (Claude, Gemini, Grok) and merged names such asenterprise-sol. Another model, the first one configured that accepts images, described the image through tool calls, and thecomputertool was not offered.Measured on a test cluster with one synthetic image and the same question: OpenClaw on
gpt-6-sol, a name in its catalog, answered in one call of 12,400 input tokens; onenterprise-solit made 6 main calls, about 80,000 input tokens; onauto, 3 calls, about 36,000. Hermes ongpt-6-solmade 2 main calls, about 26,000 input tokens, plus the description call.This change:
supports_visionin/model/info, from its price table or from the deployment'smodel_info. A shared model name accepts images when every deployment of the name does, and the Agent's own GitHub Copilot route under the name too: a Copilot route takes the value of the price-table entry that it is billed as, recorded instatus.aiGateway.copilot.routes[].vision. A router accepts images when every model that it sends requests to answer does: a Team router's tiers; a Gateway router's tiers, default model and context compaction model. LiteLLM's routers do not look at images when they select a model (modality_routingis off by default), so one text-only model turns images off for the whole router. Granted routers report it instatus.aiGateway.modelRouters[].vision.aiGateway.visionModels, lists the models that accept images. OpenClaw getsinput: ["text", "image"]and Hermessupports_vision: truefor those models only. The other models are left unmarked: OpenClaw keeps the value of its own catalog, and Hermes still asks the model to describe an image. The operator sets the value only for a chart that declares it.computertool, in a user message labelledImage(s) from tool result #1 (computer):. A complexity router classifies the newest message that a person wrote, and it took this label for that message. A heuristic router then moved a request for a design from the medium tier to the simple tier after one screenshot. Team routers, and the Gateway chart's routers that set noreminder_markersof their own, now skip the label as they skip OpenClaw's context.Not in this change: the reasoning settings (
/thinklevels,reasoning_effort) of names that OpenClaw does not know.Related issue
Follow-up of #396, which is merged (8ae128c). The base is now
main. No separate issue.Changes
internal/aigateway/client.go:Deployment.Vision;PriceTable(prices and image support) replacesPricedModels.ai_gateway_catalog.go: image support of each shared name,fillRouterVision, published catalogsharedModels[].vision, kept in a seeded catalog.ai_gateway_copilot.go,ai_gateway_copilot_merge.go: route image support from the price table; entries take the AND of a merged name and the Agent's route;aiGatewayRouterVisionFolds.ai_gateway_routers.go,ai_gateway_shared_routers.go:modelRouterVisionfor Team routers; the statuses of Gateway routers are computed again after the Copilot registration of the same pass, for their limits (Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396) and image support; the new reminder marker.ai_gateway.go,agent_controller.go:applyAIGatewayVisionModels; the configuration revision counts image support.internal/agents,internal/helm/agent.go: the native renderer passesaiGateway.visionModelsto the chart's template.AIGatewayCopilotRoute.vision,AIGatewayModelRouterStatus.vision,AIGatewayCatalogModel.vision; CRDs regenerated with controller-gen v0.21.0.aiGateway.visionModelsinvalues.yamland the schema; the OpenClaw and Hermes configuration templates; README table.reminder_markersgain the label's pair; READMEImagessection and a paragraph inServing CetiRun Agents; values comment; render test.models.md(Images),smart-routing.md,crds.md.Validation
Offline:
go test ./internal/aigateway/ ./internal/agents/... ./internal/helm/passed, andgo test ./internal/controller/ -run 'Router|Vision|Images|Copilot|Catalog|Shared|AIGateway'passed.validate.py go-testandgo-lintfor every module passed; the operator CI stepsmake verify-generated,make test-envtestandgovulncheck(operator and Portal) passed;make -C site check,python-check,shell-check,workflow-check,bicep-checkandpython-testpassed.ci-testran 856 tests with the one failure that Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396 also has in that image:PublicTLSPreflightTests.test_ingress_hostname_mismatch_is_rejected, from the OpenSSL CLI of the Azure Linux image.scripts/cetirun-ai-gateway-helm-test.sh(Linux): passed.Live, on a test AKS cluster (Kubernetes 1.37) with main d4ad950, #396 and this branch, LiteLLM 1.105.6, and synthetic content only:
Before the change,
/model/inforeportedsupports_vision: truefor every chat deployment, Azure OpenAI and each Copilot route, and nothing for the routers and the decision model.After the operator upgrade, with the earlier agent chart: no configuration changed. After the four Agents moved to the new chart: OpenClaw 24 of 24 and 5 of 5 models with
inputimage; Hermes 24 of 24 and 5 of 5 withsupports_vision, includingauto,auto-decisionand the Team routers. The granted routers reportvision: true.An image sent in a chat request with an Agent's key was answered by Azure OpenAI
gpt-5.4-nano, Copilotclaude-haiku-4.5, and Copilotgpt-5.6-luna, which Copilot serves only through the Responses API (the Agent's proxy bridges the request).The label: a synthetic tool loop with a
computerscreenshot. Before:auto(heuristic) MEDIUM without the image message and SIMPLE with it;auto-decision(jev) COMPLEX in both. After: MEDIUM and COMPLEX in both. Each Team router was registered again within one second.Regression: 51 of the 54 checks of Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396 passed. Two failures were outdated expectations of the check itself (a Policy rate limit for a router, added during the test of Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396). The third, a response without a reasoning item, passed 4 of 4 times when run again.
The UIs, with the same synthetic image and question in new sessions (the numbers before the change are in the Summary):
enterprise-solauto(medium tier)gpt-5.4-nanoauto(simple tier)Every answer named all the details of the image. OpenClaw offered 14 tools on both names, the 12 of before plus
computerandview_image.Compatibility and operational impact
aiGateway.visionModels, their configuration does not change (from source; not measured on its own).aiGateway.visionModelsrestarts it, as any chart upgrade does. Afterwards, a change in which of its models accept images restarts it once, as a change of their limits does.reminder_markersof its own.Update 2026-11-03
Merged the new head of Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396 (its review fix and its merge of main with Align the docs with make deploy, and catch wrong AKS Istio names before it writes #397, Fix make deploy for a first installation, and fill the AI Gateway documentation gaps #409 and Say that the AI Gateway's spend log keeps prompts and responses by default #413) into this branch: 0aaca63. The conflicts were in the docs only.
models.mdnow has the Images section of this change, followed by main's "When the budget runs out". Insmart-routing.md, the image sentence is its own paragraph after Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396's Agent page paragraph, and names every model that the router sends requests to, because a Gateway router's default model also counts. The CRDs regenerate with no difference.Checks on 0aaca63 in ACR Tasks (Linux, as in CI):
validate.py go-testfor every module andgo-lint, the operator CI steps (make verify-generated,make test-envtest,govulncheckfor the operator and the Portal), the Portal web tests andmake -C site checkpassed;ci-testhas only the known OpenSSL failure of that image (PublicTLSPreflightTests.test_ingress_hostname_mismatch_is_rejected).After Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396 was squash-merged, main (with Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396 as 8ae128c and build(deps): bump the go-modules group across 3 directories with 19 updates #408) was merged into this branch: a60830c. The tree of 8ae128c is the same as the head of Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396 that this branch already had, so the files that Git reported as conflicts keep this branch's version, and main brings only the Go module updates of build(deps): bump the go-modules group across 3 directories with 19 updates #408. The diff against main is the same change as before (same patch ID as the diff from Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396's head to 0aaca63). On the merged tree:
go vetand the operator's controller, helm, agents and aigateway tests passed (Windows); the CRDs and deepcopy code regenerate with no difference. The commit list of this PR also shows the commits of Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396, because main holds Smart routing follow-ups: Gateway router limits, tier fallbacks, Team router names #396 as one squashed commit.Checklist