Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(models): image models, prices and default picker on the Tools image card (#2646)
Call White5a6f9b81d602
diff --git a/core/handlers/model_hub/hosted_tools.py b/core/handlers/model_hub/hosted_tools.pyindex 42fee6acb..c4e1bc82d 100644--- a/core/handlers/model_hub/hosted_tools.py+++ b/core/handlers/model_hub/hosted_tools.py@@ -37,6 +37,7 @@ from config.v2_config import (from vibe.backend_model_catalog import (HostedToolSpec,ImageModelSpec,+ bundled_provider_vendors,provider_executor_model,provider_image_models,)@@ -455,12 +456,14 @@ def hosted_tools_status("source_id": choice.source_id,"model_id": choice.model_id,"description": choice.description,+ "billing": sources[choice.source_id].billing,"price": image_price(sources[choice.source_id], choice.spec),}for choice in choices.models]+ # A catalog fact, not the user's Sources: the vendors a key could add an image model from.entry["image_offered_by"] = sorted(- {source.vendor for source in config.sources if provider_image_models(source.vendor)}+ vendor for vendor in bundled_provider_vendors() if provider_image_models(vendor))tools.append(entry)return {"tools": tools}diff --git a/docs/plans/model-hub-contracts/hosted-tools-status.schema.json b/docs/plans/model-hub-contracts/hosted-tools-status.schema.jsonindex c326a9bc2..236c1db8c 100644--- a/docs/plans/model-hub-contracts/hosted-tools-status.schema.json+++ b/docs/plans/model-hub-contracts/hosted-tools-status.schema.json@@ -170,12 +170,13 @@"description": "Exactly the image_generate enum's candidate pairs, the default first; a refused pair is left out.","items": {"type": "object",- "required": ["source_id", "model_id", "description", "price"],+ "required": ["source_id", "model_id", "description", "billing", "price"],"additionalProperties": false,"properties": {"source_id": { "$ref": "#/definitions/SourceId" },"model_id": { "type": "string", "minLength": 1 },"description": { "type": "string", "minLength": 1, "maxLength": 80 },+ "billing": { "enum": ["monthly", "metered"], "description": "The serving Source's billing, as executor candidates carry it: a monthly Source's images are included in its subscription, whatever the list price." },"price": {"description": "One image: the vendor's list price, or an estimate from the image's tokens at the model's output rate; null when neither is known (shown as no unit price), never zero.","oneOf": [@@ -191,7 +192,7 @@}}},- "image_offered_by": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "The vendors of the user's Sources whose overlay lists image models, for the empty state." }+ "image_offered_by": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "A catalog fact, independent of configuration: the vendors whose bundled overlay lists image models, sorted. With no model available and no current refusal, the card names them as the keys that would add one." }}}}diff --git a/docs/plans/vibey-hosted-tools.md b/docs/plans/vibey-hosted-tools.mdindex 8a3593ce4..27c71f0cd 100644--- a/docs/plans/vibey-hosted-tools.md+++ b/docs/plans/vibey-hosted-tools.md@@ -238,11 +238,14 @@ The evidence store, its record and its owner are the capability model's §3. v2- `image_generate`: `default_model` (saved, null when default; a saved model no longer available, or whose pairis refused, stays saved, flagged `available: false`); `effective_default` (the saved default if available,else the same `model_id` on another Source that serves it, since the user picked a model, not a relay, else- the first available model in catalog order); `models: [{source_id, model_id, description, price}]`, where- `price` is `{usd, basis: "list" | "estimated"}` per image or null ("暂无单价"), exactly+ the first available model in catalog order); `models: [{source_id, model_id, description, billing, price}]`,+ where `billing` is the serving Source's (`monthly` | `metered`, as executor candidates carry it, so the card+ prices a subscription's images as included without another read) and `price` is+ `{usd, basis: "list" | "estimated"}` per image or null ("暂无单价"), exactlythe enum's candidate pairs, so a refused pair leaves it and the card's refusal line says why (clearing therefusal brings the pair back, and a saved default with it, with no write); and `image_offered_by: [vendor]`,- the vendors whose overlay lists image models, for the empty state.+ a catalog fact independent of configuration: the vendors whose bundled overlay lists image models, sorted,+ which the empty state names as the keys that would add one.- `PUT /api/models/hosted-tools/<tool>` is per field: an absent field is unchanged, and an explicit `null` resets`executor_order` to automatic or `default_model` to the default. `enabled` is a boolean. It answers the sameread.@@ -681,10 +684,17 @@ Unchanged from v1 §7.3 (owner decision, 2026-10-13 19:14), with the producer nopricing, marked "≈", where the image's tokens are known: the pricing module values the overlay's`tokens_per_image` at the model's output token rate (Nano Banana "≈$0.067"); "暂无单价" / "no unit price" whereneither is (gpt-image-2, which OpenAI prices per image token at a varying count). It has a default-model picker over `default_model` / `effective_default`; a saved default that is no longer available- shows as itself, "(unavailable)". Image-endpoint refusals (§3.2) show and clear like search refusals; the image card+ shows as itself, "(unavailable)", with a note naming the model in use (`effective_default`), and stays visible and+ resettable even when no model is offered. The picker's "Automatic" option saves `null`; it names the model in use+ while nothing is saved, and otherwise says how automatic picks (the first available in catalog order), since the+ read does not say which model that would be. A model on a subscription Source (`billing: monthly`) shows "订阅内含". Each shipped model+ has its own description in every locale (UI copy keyed by model id, guarded by a test over the bundled overlay);+ the overlay's `description`, which is model-facing, shows only for a model without copy. Image-endpoint refusals (§3.2) show and clear like search refusals; the image cardgets an Advanced section only when its clears move there (two or more Sources refused), holding only those; any other- failed image call shows only on its tool card in chat, since passive evidence keeps no other image failures. With no image model available, the card names the vendors from- `image_offered_by` ("Add an OpenAI or Google API key").+ failed image call shows only on its tool card in chat, since passive evidence keeps no other image failures. With no image model available,+ the card says why from the read: with a current image refusal, a neutral line ("No image model is available+ now; clear a refusal to try it again"), the refusal lines and their clears saying the rest; otherwise the vendors+ from `image_offered_by` as the keys that would add one ("图片生成需要 OpenAI、Google 其中一家的 API Key").- **Removed:** check and check-all, the confirm and result dialogs, Re-verify, the probe estimate, the executorpicker, and "engine upgraded" headers (§11).diff --git a/tests/scenarios/INDEX.yaml b/tests/scenarios/INDEX.yamlindex 6ad4a29c9..18abd95bf 100644--- a/tests/scenarios/INDEX.yaml+++ b/tests/scenarios/INDEX.yaml@@ -119,6 +119,7 @@ capabilities:- ui/src/components/settings/models/AgentCard.test.tsx- ui/src/components/workbench/HostedToolRow.test.tsx- ui/src/components/settings/models/ToolsTab.test.tsx+ - ui/src/components/settings/models/imageModelCopy.test.ts- ui/src/components/settings/models/hostedTools.test.ts- ui/src/components/settings/models/useHostedTools.test.tsx- ui/src/components/settings/models/SourceDetailPanel.test.tsxdiff --git a/tests/scenarios/model_hub/catalog.yaml b/tests/scenarios/model_hub/catalog.yamlindex 944bc7222..23e9cfc73 100644--- a/tests/scenarios/model_hub/catalog.yaml+++ b/tests/scenarios/model_hub/catalog.yaml@@ -65,6 +65,7 @@ capability:- ui/src/components/settings/models/AgentCard.test.tsx# Hosted tools: the Tools tab, its evidence projection, and the Source chips.- ui/src/components/settings/models/ToolsTab.test.tsx+ - ui/src/components/settings/models/imageModelCopy.test.ts- ui/src/components/settings/models/hostedTools.test.ts- ui/src/components/settings/models/useHostedTools.test.tsx- ui/src/components/settings/models/SourceDetailPanel.test.tsx@@ -515,6 +516,21 @@ scenarios:- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-021: a customized order offers Reset, which saves automatic'- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-021: announces a move and moves focus only once the server order shows it, and drops one that did not land'- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-021: keeps focus on the moved row once the answer lands, on its other arrow at an end'+ - id: MH-HOSTED-UI-022+ name: The image card lists each offered image model with its localized description, Source and per-image price (included on a subscription), marks the default in use, saves a default pick or automatic, keeps an unavailable saved default visible and resettable, and names the vendors to add when none is offered+ status: covered+ kind: contract+ layer: unit+ test:+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-022: lists each offered model with its Source and per-image price, and marks the default in use'+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-022: the default picker names what automatic uses, and saves a pick or automatic'+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-022: shows a saved default that is no longer offered as itself, and names the one in use'+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-022: shows an image model on a subscription Source as included, whatever its list price'+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-022: says how automatic picks, not which model, once a model is saved'+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-022: keeps an unavailable saved default visible and resettable when no model is offered'+ - 'ui/src/components/settings/models/imageModelCopy.test.ts::MH-HOSTED-UI-022: every bundled image model has a description in each locale'+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-022: with every offered model refused, points at the clears rather than asking for a key'+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-022: with no image model offered, names the vendors whose key would add one'- id: MH-VIBEY-007name: Vibey starts once with the user's Sources and built-in Agent models, seeded when its first Source existsstatus: covereddiff --git a/tests/test_model_hub_hosted_tools_resolution.py b/tests/test_model_hub_hosted_tools_resolution.pyindex 0a7e95750..7972c1354 100644--- a/tests/test_model_hub_hosted_tools_resolution.py+++ b/tests/test_model_hub_hosted_tools_resolution.py@@ -79,6 +79,8 @@ IMAGE_MODELS = {def _overlay(monkeypatch):monkeypatch.setattr(hosted_tools_module, "provider_executor_model", EXECUTOR_MODELS.get)monkeypatch.setattr(hosted_tools_module, "provider_image_models", lambda vendor: IMAGE_MODELS.get(vendor, ()))+ # The bundled overlay's vendors; which of them list image models is `IMAGE_MODELS`.+ monkeypatch.setattr(hosted_tools_module, "bundled_provider_vendors", lambda: dict.fromkeys(("anthropic", "openai", "xai")))def _spec_for(vendor, protocol, model_id, tool):@@ -244,7 +246,17 @@ def test_the_tools_read_states_saved_and_effective_values_and_what_real_use_show]image = by_name["image_generate"]assert (image["default_model"], image["effective_default"]["model_id"]) == (None, "grok-imagine-image")+ # Each model carries its serving Source's billing, as the executor rows do.+ assert [(m["source_id"], m["billing"]) for m in image["models"]] == [("src_xai00001", "metered"), ("src_oai00001", "metered")]assert image["image_offered_by"] == ["openai", "xai"]+ # Which vendors offer image models is a catalog fact: with no image vendor configured, the read still names+ # the vendors a key could add one from.+ bare = hosted_tools_status(+ _config(sources=[CLAUDE_SUB]), evidence=_evidence(tmp_path / "bare"), spec_for=_spec_for,+ image_price=lambda _source, _spec: None,+ )+ bare_image = next(tool for tool in bare["tools"] if tool["name"] == "image_generate")+ assert (bare_image["models"], bare_image["image_offered_by"]) == ([], ["openai", "xai"])# The same Source id under a new credential is another Source: what the old one showed is not claimed for it.rotated = replace(XAI, credential_ref="cred_rotated")diff --git a/ui/src/components/settings/models/ToolsTab.test.tsx b/ui/src/components/settings/models/ToolsTab.test.tsxindex 30087b6bb..0ddd4da57 100644--- a/ui/src/components/settings/models/ToolsTab.test.tsx+++ b/ui/src/components/settings/models/ToolsTab.test.tsx@@ -16,6 +16,7 @@ import { readyRegion } from './regionRead';import { ToolsTab } from './ToolsTab';import type {HostedExecutorCandidate,+ HostedImageModel,HostedImageToolStatus,HostedRefusal,HostedSearchToolStatus,@@ -88,7 +89,7 @@ const image = (over: Partial<HostedImageToolStatus> = {}): HostedImageToolStatusdefault_model: null,effective_default: null,models: [],- image_offered_by: ['openai', 'google'],+ image_offered_by: ['openai', 'gemini'],...over,});@@ -418,3 +419,108 @@ describe('ToolsTab executor order', () => {expect(subscription.textContent).toContain('订阅内含不另计费');});});++describe('ToolsTab image card', () => {+ const GOOGLE = source('src_google01', 'Google AI Studio', { vendor: 'gemini', protocol: 'google' });+ const models = [+ { source_id: RELAY.id, model_id: 'gpt-image-2', description: 'GPT Image 2: precise prompts, legible text, edits', billing: 'metered', price: null },+ { source_id: GROK.id, model_id: 'grok-imagine-image', description: 'Grok Imagine: fast drafts', billing: 'metered', price: { usd: 0.02, basis: 'list' } },+ { source_id: GOOGLE.id, model_id: 'gemini-2.5-flash-image', description: 'Nano Banana: fast generation', billing: 'metered', price: { usd: 0.067, basis: 'estimated' } },+ ] satisfies HostedImageModel[];+ const renderImage = (over: Partial<HostedImageToolStatus>, lng: 'en' | 'zh' = 'en', sources: readonly Source[] = [...SOURCES, GOOGLE]) => {+ const onSave = vi.fn();+ render(+ <I18nextProvider i18n={translator(lng)}>+ <ToolsTab read={readyRegion({ tools: [image(over)] })} sources={sources} pending={new Set()} onSave={onSave} onClear={() => {}} onRetry={() => {}} />+ </I18nextProvider>,+ );+ return onSave;+ };++ it('MH-HOSTED-UI-022: lists each offered model with its Source and per-image price, and marks the default in use', () => {+ renderImage({ models, effective_default: { source_id: RELAY.id, model_id: 'gpt-image-2' } }, 'zh');+ const [gpt, grok, banana] = within(card('图片生成')).getAllByRole('listitem');+ // A shipped model's description is the locale's copy; one without copy shows the overlay's line.+ expect(gpt.textContent).toBe('gpt-image-2默认写实照片、图中文字准确,支持按参考图编辑relay-gptAPI Key暂无单价');+ expect(grok.textContent).toContain('Grok Imagine: fast drafts');+ expect(grok.textContent).toContain('$0.02 / 张API 标价');+ expect(banana.textContent).toContain('≈ $0.067 / 张API 标价');+ expect(within(grok).queryByText('默认')).toBeNull();+ });++ it('MH-HOSTED-UI-022: the default picker names what automatic uses, and saves a pick or automatic', async () => {+ const user = userEvent.setup();+ const onSave = renderImage({ models, effective_default: { source_id: RELAY.id, model_id: 'gpt-image-2' } });+ const picker = within(card('Image generation')).getByRole('combobox', { name: 'Default image model' }) as HTMLSelectElement;+ expect(picker.selectedOptions[0].textContent).toBe('Automatic (gpt-image-2 · relay-gpt)');++ await user.selectOptions(picker, 'grok-imagine-image · Grok');+ expect(onSave).toHaveBeenLastCalledWith('image_generate', { default_model: { source_id: GROK.id, model_id: 'grok-imagine-image' } });+ await user.selectOptions(picker, 'Automatic (gpt-image-2 · relay-gpt)');+ expect(onSave).toHaveBeenLastCalledWith('image_generate', { default_model: null });+ });++ it('MH-HOSTED-UI-022: shows an image model on a subscription Source as included, whatever its list price', () => {+ // The billing is the read's own, so it holds while the Sources read has not landed.+ renderImage({ models: [{ ...models[1], source_id: SUBSCRIPTION.id, billing: 'monthly' }] }, 'zh', []);+ const [row] = within(card('图片生成')).getAllByRole('listitem');+ expect(row.textContent).toContain('订阅内含不另计费');+ expect(row.textContent).not.toContain('$0.02');+ });++ it('MH-HOSTED-UI-022: says how automatic picks, not which model, once a model is saved', () => {+ renderImage({+ models,+ default_model: { source_id: GROK.id, model_id: 'grok-imagine-image', available: true },+ effective_default: { source_id: GROK.id, model_id: 'grok-imagine-image' },+ });+ const picker = within(card('Image generation')).getByRole('combobox', { name: 'Default image model' }) as HTMLSelectElement;+ expect(picker.selectedOptions[0].textContent).toBe('grok-imagine-image · Grok');+ expect([...picker.options].map((option) => option.textContent)[0]).toBe('Automatic (first available in catalog order)');+ });++ it('MH-HOSTED-UI-022: keeps an unavailable saved default visible and resettable when no model is offered', async () => {+ const user = userEvent.setup();+ const onSave = renderImage({ models: [], default_model: { source_id: RELAY.id, model_id: 'gpt-image-2', available: false }, effective_default: null });+ const imageCard = card('Image generation');+ expect(within(imageCard).getByText('Image generation needs an API key from one of OpenAI, Google.')).toBeTruthy();+ const picker = within(imageCard).getByRole('combobox', { name: 'Default image model' }) as HTMLSelectElement;+ expect(picker.selectedOptions[0].textContent).toBe('gpt-image-2 · relay-gpt (unavailable)');+ expect(within(imageCard).getByText('The saved default isn\'t available now.')).toBeTruthy();+ await user.selectOptions(picker, 'Automatic (first available in catalog order)');+ expect(onSave).toHaveBeenLastCalledWith('image_generate', { default_model: null });+ });++ it('MH-HOSTED-UI-022: shows a saved default that is no longer offered as itself, and names the one in use', () => {+ renderImage({+ models: models.slice(1),+ default_model: { source_id: RELAY.id, model_id: 'gpt-image-2', available: false },+ effective_default: { source_id: GROK.id, model_id: 'grok-imagine-image' },+ });+ const picker = within(card('Image generation')).getByRole('combobox', { name: 'Default image model' }) as HTMLSelectElement;+ expect(picker.selectedOptions[0].textContent).toBe('gpt-image-2 · relay-gpt (unavailable)');+ expect(within(card('Image generation')).getByText('The saved default isn\'t available now, so grok-imagine-image · Grok is used.')).toBeTruthy();+ });++ it('MH-HOSTED-UI-022: with every offered model refused, points at the clears rather than asking for a key', () => {+ renderImage({ models: [], status: run({ refused: [refusal(RELAY.id, 'gpt-image-2', '2026-10-14T09:00:00Z')] }), image_offered_by: ['openai'] });+ const imageCard = card('Image generation');+ expect(within(imageCard).getByText('No image model is available now. Clear a refusal above to try it again.')).toBeTruthy();+ expect(within(imageCard).queryByText(/API key/)).toBeNull();+ expect(within(imageCard).getByRole('button', { name: 'Clear relay-gpt\'s refusal of image generation' })).toBeTruthy();+ });++ it('MH-HOSTED-UI-022: with no image model offered, names the vendors whose key would add one', () => {+ renderImage({ models: [], image_offered_by: ['openai', 'gemini'] });+ expect(within(card('Image generation')).getByText('Image generation needs an API key from one of OpenAI, Google.')).toBeTruthy();+ expect(within(card('Image generation')).queryByRole('combobox')).toBeNull();+ cleanup();+ // The locale joins the names; no list punctuation runs Latin names into Chinese.+ renderImage({ models: [], image_offered_by: ['openai', 'gemini'] }, 'zh');+ expect(within(card('图片生成')).getByText('图片生成需要 OpenAI、Google 其中一家的 API Key。')).toBeTruthy();+ cleanup();+ renderImage({ models: [], image_offered_by: ['openai'] }, 'zh');+ expect(within(card('图片生成')).getByText('图片生成需要 OpenAI 的 API Key。')).toBeTruthy();+ });+});+diff --git a/ui/src/components/settings/models/ToolsTab.tsx b/ui/src/components/settings/models/ToolsTab.tsxindex 87699474e..3d603d5f6 100644--- a/ui/src/components/settings/models/ToolsTab.tsx+++ b/ui/src/components/settings/models/ToolsTab.tsx@@ -10,14 +10,19 @@ import { useTranslation } from 'react-i18next';import { AlertCircle, ArrowDown, ArrowUp, AtSign, CheckCircle2, ChevronRight, Eraser, Globe, Image as ImageIcon, Info, RotateCcw } from 'lucide-react';import { Button } from '@/components/ui/button';+import { Select } from '@/components/ui/select';import { cn } from '@/lib/utils';import { ToggleSwitch } from '../SettingsPrimitives';import { formatMonthDay, formatNameList, formatSmallUsd } from './format';-import { executorOrderAfterMove, pairEvidence, refusalSummary, type PairEvidence, type RefusalSummary } from './hostedTools';+import { executorOrderAfterMove, imageModelCopyKey, pairEvidence, refusalSummary, type PairEvidence, type RefusalSummary } from './hostedTools';import { foldRegionRead, regionFailed, type RegionRead } from './regionRead';import { ACCENT_ICON, ACCENT_PILL, ACCENT_TILE, sourceVisual } from './vendorMeta';import type {HostedExecutorCandidate,+ HostedImageModel,+ HostedImagePrice,+ HostedImageToolStatus,+ HostedModelRef,HostedSearchToolStatus,HostedToolClear,HostedToolName,@@ -377,6 +382,127 @@ const Advanced: React.FC<{ tool: HostedToolStatus; summary: RefusalSummary; look);};+/** One image's price: the vendor's list price, an estimate from token pricing (≈), or none known. */+/**+ * One image's price: included on a subscription Source, else the vendor's list+ * price, an estimate from token pricing (≈), or none known; unknown is never zero.+ */+const ImagePrice: React.FC<{ price: HostedImagePrice | null; billing: HostedImageModel['billing'] }> = ({ price, billing }) => {+ const { t } = useTranslation();+ if (billing === 'monthly') {+ return <span className="flex flex-col"><span className="font-semibold text-foreground">{t('settings.models.tools.cost.included')}</span><span className="model-hub-tool-cost-note">{t('settings.models.tools.cost.includedNote')}</span></span>;+ }+ if (!price) return <span className="model-hub-tool-cost-note">{t('settings.models.tools.image.noUnitPrice')}</span>;+ const usd = formatSmallUsd(price.usd);+ return (+ <span className="flex flex-col">+ <span className="font-semibold text-foreground">{t(price.basis === 'list' ? 'settings.models.tools.image.perImage' : 'settings.models.tools.image.perImageEstimated', { usd })}</span>+ <span className="model-hub-tool-cost-note">{t('settings.models.tools.cost.listNote')}</span>+ </span>+ );+};++const pairValue = (pair: HostedModelRef) => JSON.stringify([pair.source_id, pair.model_id]);+const samePair = (left: HostedModelRef | null, right: HostedModelRef | null) =>+ left !== null && right !== null && left.source_id === right.source_id && left.model_id === right.model_id;+const AUTOMATIC = '';++/**+ * The image models `image_generate` offers now, with the default Vibey names when+ * it does not pick one. The saved default is shown as saved, even when it is no+ * longer offered, and can always be reset; the default in use is the server's+ * `effective_default`. Automatic is named only while it is what is in use: with a+ * model saved, the read does not say what automatic would pick, so the option+ * says how it picks instead.+ */+const ImageModels: React.FC<{ tool: HostedImageToolStatus; lookup: SourceLookup; pending: boolean; onSave: Save }> = ({ tool, lookup, pending, onSave }) => {+ const { t, i18n } = useTranslation();+ const pairLabel = (pair: HostedModelRef) => t('settings.models.tools.image.pair', { model: pair.model_id, source: lookup.name(pair.source_id) }) as string;+ const saved = tool.default_model;+ const inUse = tool.effective_default;+ const vendors = tool.image_offered_by.map((vendor) => t(`settings.models.tools.image.vendor.${vendor}`, { defaultValue: vendor }) as string);+ // With a current refusal, the list is empty because of it, and the refusal lines with their clears say so; a key+ // is the remedy only when nothing was refused.+ const refused = tool.status.refused.length > 0;+ return (+ <div className="model-hub-tool-image flex flex-col gap-3 border-t border-border">+ {tool.models.length === 0+ ? (+ <p className="flex items-start gap-2 text-muted">+ <Info className="mt-0.5 size-[14px] shrink-0" aria-hidden />+ <span>{refused+ ? t('settings.models.tools.image.emptyRefused')+ : vendors.length === 0+ ? t('settings.models.tools.image.emptyNoVendor')+ : vendors.length === 1+ ? t('settings.models.tools.image.emptyOne', { vendor: vendors[0] })+ : t('settings.models.tools.image.emptyMany', { vendors: formatNameList(vendors, i18n.language) })}</span>+ </p>+ )+ : (+ <div className="flex flex-col gap-1.5">+ <h4 className="font-semibold text-foreground">{t('settings.models.tools.image.title')}</h4>+ <ul className="flex flex-col gap-1.5">+ {tool.models.map((model) => {+ const source = lookup.source(model.source_id);+ const name = lookup.name(model.source_id);+ return (+ <li key={pairValue(model)} className="model-hub-tool-image-row grid items-center rounded-lg border border-border bg-background" data-image-model={`${model.source_id}:${model.model_id}`}>+ <span className="flex min-w-0 flex-col gap-0.5">+ <span className="flex min-w-0 flex-wrap items-center gap-2">+ <span className="truncate font-mono font-semibold text-foreground" title={model.model_id}>{model.model_id}</span>+ {samePair(model, inUse) && <span className="model-hub-pill model-hub-status-mint border">{t('settings.models.tools.image.defaultBadge')}</span>}+ </span>+ {/* A shipped model has its own copy in each locale; one without (a user's own) shows the overlay's line. */}+ <span className="model-hub-tool-note">{t(`settings.models.tools.image.description.${imageModelCopyKey(model.model_id)}`, { defaultValue: model.description })}</span>+ </span>+ <span className="flex min-w-0 items-center gap-2">+ <SourceGlyph source={source} />+ <span className="truncate font-semibold text-foreground" title={name}>{name}</span>+ {source && <span className={cn('model-hub-pill border', ACCENT_PILL[source.kind === 'api_key' ? 'cyan' : sourceVisual(source).accent])}>{t(`settings.models.upstream.kind.${source.kind === 'subscription' ? 'subscription' : 'apiKey'}`)}</span>}+ </span>+ <ImagePrice price={model.price} billing={model.billing} />+ </li>+ );+ })}+ </ul>+ </div>+ )}+ {(tool.models.length > 0 || saved !== null) && (+ <div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">+ <span className="shrink-0 font-semibold text-foreground">{t('settings.models.tools.image.defaultLabel')}</span>+ <Select+ wrapperClassName="sm:w-[300px] shrink-0"+ className="h-8 text-[12px]"+ aria-label={t('settings.models.tools.image.defaultPick') as string}+ disabled={pending}+ value={saved ? pairValue(saved) : AUTOMATIC}+ onChange={(event) => {+ const picked = tool.models.find((model) => pairValue(model) === event.target.value);+ onSave(tool.name, { default_model: picked ? { source_id: picked.source_id, model_id: picked.model_id } : null });+ }}+ >+ <option value={AUTOMATIC}>{saved+ ? t('settings.models.tools.image.automaticRule')+ : inUse+ ? t('settings.models.tools.image.automaticNamed', { pair: pairLabel(inUse) })+ : t('settings.models.tools.image.automatic')}</option>+ {saved && !saved.available && <option value={pairValue(saved)}>{t('settings.models.tools.image.unavailable', { pair: pairLabel(saved) })}</option>}+ {tool.models.map((model) => <option key={pairValue(model)} value={pairValue(model)}>{pairLabel(model)}</option>)}+ </Select>+ <span className="model-hub-tool-note">+ {saved && !saved.available+ ? inUse+ ? t('settings.models.tools.image.unavailableNote', { pair: pairLabel(inUse) })+ : t('settings.models.tools.image.unavailableNoteNone')+ : t('settings.models.tools.image.defaultNote')}+ </span>+ </div>+ )}+ </div>+ );+};+const ToolCard: React.FC<{ tool: HostedToolStatus; lookup: SourceLookup; pending: boolean; onSave: Save; onClear: Clear }> = ({ tool, lookup, pending, onSave, onClear }) => {const { t } = useTranslation();const Icon = TOOL_ICON[tool.name];@@ -404,6 +530,7 @@ const ToolCard: React.FC<{ tool: HostedToolStatus; lookup: SourceLookup; pending</span></header><StatusLines tool={tool} summary={summary} lookup={lookup} pending={pending} onClear={onClear} />+ {tool.name === 'image_generate' && <ImageModels tool={tool} lookup={lookup} pending={pending} onSave={onSave} />}<Advanced tool={tool} summary={summary} lookup={lookup} pending={pending} onSave={onSave} onClear={onClear} /></section>);diff --git a/ui/src/components/settings/models/hostedTools.ts b/ui/src/components/settings/models/hostedTools.tsindex 3e17af4cc..34a014000 100644--- a/ui/src/components/settings/models/hostedTools.ts+++ b/ui/src/components/settings/models/hostedTools.ts@@ -112,3 +112,9 @@ export const executorOrderAfterMove = (return [...merged, ...next];};+/**+ * The copy key under `settings.models.tools.image.description` for an image model+ * id. A dot separates i18n key segments, so the id's dots become underscores.+ */+export const imageModelCopyKey = (modelId: string): string => modelId.replaceAll('.', '_');+diff --git a/ui/src/components/settings/models/imageModelCopy.test.ts b/ui/src/components/settings/models/imageModelCopy.test.tsnew file mode 100644index 000000000..2b141bbe2--- /dev/null+++ b/ui/src/components/settings/models/imageModelCopy.test.ts@@ -0,0 +1,23 @@+// Every image model the bundled overlay ships has its own description in each+// locale (`vibey-hosted-tools.md` §8.1): the overlay's line is model-facing+// English, kept only as the fallback for a model Avibe does not ship.+import { readFile } from 'node:fs/promises';+import { describe, expect, it } from 'vitest';++import en from '../../../i18n/en.json';+import { imageModelCopyKey } from './hostedTools';+import zh from '../../../i18n/zh.json';++describe('image model copy', () => {+ it('MH-HOSTED-UI-022: every bundled image model has a description in each locale', async () => {+ const overlay = JSON.parse(await readFile('../vibe/data/backend_models.json', 'utf8')) as {+ providers: Record<string, { image_models?: { id: string }[] }>;+ };+ expect(overlay.providers).toBeTypeOf('object');+ const shipped = Object.values(overlay.providers).flatMap((vendor) => (vendor.image_models ?? []).map((model) => model.id));+ for (const [lng, copy] of [['en', en], ['zh', zh]] as const) {+ const descriptions = copy.settings.models.tools.image.description as Record<string, string>;+ expect(shipped.filter((id) => !descriptions[imageModelCopyKey(id)]?.trim()), lng).toEqual([]);+ }+ });+});diff --git a/ui/src/components/settings/models/modelHubSurface.css b/ui/src/components/settings/models/modelHubSurface.cssindex 70382fbdd..5a6398b4a 100644--- a/ui/src/components/settings/models/modelHubSurface.css+++ b/ui/src/components/settings/models/modelHubSurface.css@@ -2154,6 +2154,20 @@font-size: var(--model-hub-usage-cell-size);line-height: 18px;}+.model-hub-tool-image {+ padding: 12px var(--model-hub-tool-pad-x) 14px;+ font-size: var(--model-hub-usage-cell-size);+}+.model-hub-tool-image-row {+ grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(96px, auto);+ column-gap: var(--model-hub-usage-gutter);+ row-gap: 6px;+ padding: var(--model-hub-tool-row-pad-y) var(--model-hub-tool-row-pad-x);+}+@media (max-width: 767px) {+ .model-hub-tool-image-row { grid-template-columns: minmax(0, 1fr) auto; }+ .model-hub-tool-image-row > :first-child { grid-column: 1 / -1; }+}.model-hub-tool-advanced-body {padding: 2px var(--model-hub-tool-pad-x) 16px;font-size: var(--model-hub-usage-cell-size);diff --git a/ui/src/components/settings/models/types.ts b/ui/src/components/settings/models/types.tsindex 8fa868247..dcae8f9f7 100644--- a/ui/src/components/settings/models/types.ts+++ b/ui/src/components/settings/models/types.ts@@ -1080,7 +1080,8 @@ export type HostedModelRef = { source_id: string; model_id: string };/** One image's price: the vendor's list price, or an estimate from token pricing. */export type HostedImagePrice = { usd: number; basis: 'list' | 'estimated' };-export type HostedImageModel = HostedModelRef & { description: string; price: HostedImagePrice | null };+/** An image model `image_generate` offers now, with its serving Source's billing (a subscription's images are included). */+export type HostedImageModel = HostedModelRef & { description: string; billing: 'monthly' | 'metered'; price: HostedImagePrice | null };type HostedToolBase = { enabled: boolean; status: HostedToolRunStatus };@@ -1101,7 +1102,7 @@ export type HostedImageToolStatus = HostedToolBase & {effective_default: HostedModelRef | null;/** Exactly the pairs `image_generate` offers now. */models: HostedImageModel[];- /** Vendors whose overlay lists image models, for the empty state. */+ /** A catalog fact, not the user's Sources: the vendors whose bundled overlay lists image models. */image_offered_by: string[];};diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex b54cbd0b0..17708ea6a 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -2422,6 +2422,37 @@"refused": "Not supported · {{date}}","replay": "No replay · {{date}}"},+ "image": {+ "title": "Available image models",+ "noUnitPrice": "No unit price",+ "perImage": "${{usd}} / image",+ "perImageEstimated": "≈ ${{usd}} / image",+ "pair": "{{model}} · {{source}}",+ "defaultBadge": "Default",+ "defaultLabel": "Default model",+ "defaultPick": "Default image model",+ "automatic": "Automatic",+ "automaticNamed": "Automatic ({{pair}})",+ "automaticRule": "Automatic (first available in catalog order)",+ "unavailable": "{{pair}} (unavailable)",+ "defaultNote": "Used when Vibey doesn't name a model. Vibey can also pick another model from the list when it needs to.",+ "unavailableNote": "The saved default isn't available now, so {{pair}} is used.",+ "unavailableNoteNone": "The saved default isn't available now.",+ "emptyOne": "Image generation needs an API key from {{vendor}}.",+ "emptyMany": "Image generation needs an API key from one of {{vendors}}.",+ "emptyRefused": "No image model is available now. Clear a refusal above to try it again.",+ "emptyNoVendor": "No image model is available.",+ "description": {+ "gpt-image-2": "Photorealistic images and legible text in them; edits from reference images.",+ "gemini-2_5-flash-image": "Fast generation and edits, keeping characters and style consistent.",+ "gemini-3-pro-image-preview": "High-fidelity images with accurate text rendering."+ },+ "vendor": {+ "openai": "OpenAI",+ "gemini": "Google",+ "xai": "xAI"+ }+ },"cost": {"included": "Included in subscription","includedNote": "No extra charge",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 93700cfaf..378761eed 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -2422,6 +2422,37 @@"refused": "不支持 · {{date}}","replay": "不支持回放 · {{date}}"},+ "image": {+ "title": "可用的图片模型",+ "noUnitPrice": "暂无单价",+ "perImage": "${{usd}} / 张",+ "perImageEstimated": "≈ ${{usd}} / 张",+ "pair": "{{model}} · {{source}}",+ "defaultBadge": "默认",+ "defaultLabel": "默认模型",+ "defaultPick": "默认图片模型",+ "automatic": "自动",+ "automaticNamed": "自动({{pair}})",+ "automaticRule": "自动(按目录顺序的第一个可用模型)",+ "unavailable": "{{pair}}(不可用)",+ "defaultNote": "Vibey 没有指定模型时使用。Vibey 也可以按需改用列表里的其他模型。",+ "unavailableNote": "已保存的默认模型暂不可用,当前使用 {{pair}}。",+ "unavailableNoteNone": "已保存的默认模型暂不可用。",+ "emptyOne": "图片生成需要 {{vendor}} 的 API Key。",+ "emptyMany": "图片生成需要 {{vendors}} 其中一家的 API Key。",+ "emptyRefused": "目前没有可用的图片模型。清除上面的拒绝记录后会再试。",+ "emptyNoVendor": "目前没有可用的图片模型。",+ "description": {+ "gpt-image-2": "写实照片、图中文字准确,支持按参考图编辑",+ "gemini-2_5-flash-image": "出图快,人物和风格前后一致,适合多图合成与局部修改",+ "gemini-3-pro-image-preview": "高保真,图中文字渲染准确"+ },+ "vendor": {+ "openai": "OpenAI",+ "gemini": "Google",+ "xai": "xAI"+ }+ },"cost": {"included": "订阅内含","includedNote": "不另计费",