Skip to content

Send images to the Gateway models that accept them - #410

Merged
Pengfei Ni (feiskyer) merged 12 commits into
mainfrom
feat/ai-gateway-model-vision
Nov 3, 2026
Merged

Pengfei Ni (feiskyer) merged 12 commits into
mainfrom
feat/ai-gateway-model-vision

Conversation

@Zhupku

@Zhupku Zhupku commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

OpenClaw and Hermes treated most AI Gateway models as text-only, so an image that a user attached did not reach the model:

  • Hermes, every Gateway model: it sent the image to the same model in an extra call for a description, and then made a second main call with that description.
  • OpenClaw, every name that its own model catalog does not know: the routers (auto, auto-decision, Team routers), the GitHub Copilot models of other vendors (Claude, Gemini, Grok) and merged names such as enterprise-sol. Another model, the first one configured that accepts images, described the image through tool calls, and the computer tool 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; on enterprise-sol it made 6 main calls, about 80,000 input tokens; on auto, 3 calls, about 36,000. Hermes on gpt-6-sol made 2 main calls, about 26,000 input tokens, plus the description call.

This change:

  • The operator reads which models accept images. LiteLLM reports supports_vision in /model/info, from its price table or from the deployment's model_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 in status.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_routing is off by default), so one text-only model turns images off for the whole router. Granted routers report it in status.aiGateway.modelRouters[].vision.
  • The agent chart takes the list. A new value, aiGateway.visionModels, lists the models that accept images. OpenClaw gets input: ["text", "image"] and Hermes supports_vision: true for 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.
  • Routers skip the label of OpenClaw's tool-result images. With images on, OpenClaw sends the images of a tool result, for example a screenshot of its computer tool, in a user message labelled Image(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 no reminder_markers of their own, now skip the label as they skip OpenClaw's context.

Not in this change: the reasoning settings (/think levels, 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

  • Operator:
    • internal/aigateway/client.go: Deployment.Vision; PriceTable (prices and image support) replaces PricedModels.
    • ai_gateway_catalog.go: image support of each shared name, fillRouterVision, published catalog sharedModels[].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: modelRouterVision for 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 passes aiGateway.visionModels to the chart's template.
    • API: AIGatewayCopilotRoute.vision, AIGatewayModelRouterStatus.vision, AIGatewayCatalogModel.vision; CRDs regenerated with controller-gen v0.21.0.
  • Agent chart: aiGateway.visionModels in values.yaml and the schema; the OpenClaw and Hermes configuration templates; README table.
  • Gateway chart: the default reminder_markers gain the label's pair; README Images section and a paragraph in Serving CetiRun Agents; values comment; render test.
  • Docs: models.md (Images), smart-routing.md, crds.md.

Validation

Offline:

  • Windows: go test ./internal/aigateway/ ./internal/agents/... ./internal/helm/ passed, and go test ./internal/controller/ -run 'Router|Vision|Images|Copilot|Catalog|Shared|AIGateway' passed.
  • ACR Tasks on cad6807 (Linux, Go 1.27.3, non-root, as in CI): validate.py go-test and go-lint for every module passed; the operator CI steps make verify-generated, make test-envtest and govulncheck (operator and Portal) passed; make -C site check, python-check, shell-check, workflow-check, bicep-check and python-test passed. ci-test ran 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.
  • Mutation checks: 36 rules were broken one at a time. 35 made a test fail. The 36th was dead code, and it was removed.

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/info reported supports_vision: true for 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 input image; Hermes 24 of 24 and 5 of 5 with supports_vision, including auto, auto-decision and the Team routers. The granted routers report vision: true.

  • An image sent in a chat request with an Agent's key was answered by Azure OpenAI gpt-5.4-nano, Copilot claude-haiku-4.5, and Copilot gpt-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 computer screenshot. 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):

    Agent and model Main calls Input tokens Image in the main request Description call
    OpenClaw, enterprise-sol 1 13,047 yes none
    OpenClaw, auto (medium tier) 1 13,005 yes none
    Hermes, gpt-5.4-nano 1 13,677 yes none
    Hermes, auto (simple tier) 1 12,711 yes none

    Every answer named all the details of the image. OpenClaw offered 14 tools on both names, the 12 of before plus computer and view_image.

Compatibility and operational impact

  • Upgrading the operator registers each Team router again once, because its configuration gains a reminder marker. Its name stays, and Agents are not reconfigured for it. Agents with shared models take a full reconcile once (the configuration revision counts image support). With an agent chart that does not declare aiGateway.visionModels, their configuration does not change (from source; not measured on its own).
  • Moving an Agent to an agent chart with aiGateway.visionModels restarts 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.
  • Images now go to the model with the request. The request pays for the image tokens; the extra calls that described images stop. OpenClaw sends the images of its last three turns again with each request; Hermes sends them until it compacts the conversation.
  • Upgrading the Gateway chart rolls its pods when its configuration includes a router without reminder_markers of its own.

Update 2026-11-03

Checklist

  • The change is focused and preserves unrelated work.
  • Tests cover the changed behavior.
  • Documentation and examples match the public behavior changes.
  • Generated artifacts were updated from source (controller-gen v0.21.0).
  • No dependency changes.
  • The diff contains no credentials, private endpoints, customer data, conversations, or internal documents.
  • CLA: covered by the repository's CLA check.
  • Checks that need a live environment are identified above.

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.
…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.
…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.
Base automatically changed from feat/ai-gateway-router-follow-ups to main November 3, 2026 05:17
@feiskyer

Copy link
Copy Markdown
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.

@feiskyer Pengfei Ni (feiskyer) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@feiskyer
Pengfei Ni (feiskyer) merged commit 25bd921 into main Nov 3, 2026
36 checks passed
@feiskyer
Pengfei Ni (feiskyer) deleted the feat/ai-gateway-model-vision branch November 3, 2026 08:01
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.
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.

3 participants