Repository navigation
feat(chat): let Admins choose Chat's model providers, and keep OpenRouter calls off data collection (W4-34, 00469) - #2036
Merged
Conversation
…uter calls off data collection (W4-34, 00469) - Settings › Chat gets Model providers: Anthropic (always on, Auto runs on it), OpenAI, Google and DeepSeek (off by default), each on or off for an Admin, logged in the Activity log. chat_settings.model_providers (00469) keeps the choices; a provider not chosen takes its default in the web. - A provider that is off has no model in the model menu, and the engine runs Auto in place of one of its models, for chats, agents and scheduled runs, with "Ran on Auto · Your Admin turned off this model's provider". - Chat's and the Agent's OpenRouter calls ask for providers that keep no data (provider.data_collection: "deny"); a DeepSeek model runs only on US or EU hosts, with no fallback. The API server's analysis calls are unchanged. - Help: help/settings/chat-rules.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… OpenRouter's list (W4-34) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…4-34) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…chat-model-providers Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Model providers Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # web/src/app/api/chat/models/route.test.ts # web/src/app/api/chat/models/route.ts # web/src/lib/chat/model-menu.ts
…s as off Auto on another provider's own key ran on that key's model even when an Admin turned its maker off in Settings > Chat (DeepSeek through OpenRouter, or OpenAI through an OpenAI or Azure key). resolveChatModels now maps the own key's model to its maker and stops the run with a clear error when that provider is off, rather than send the run there or move to Ansvisor's key by itself. A failed read of the provider choices now turns every provider that can be turned off off, instead of falling back to the defaults.
gkhngyk
previously approved these changes
Nov 3, 2026
This was referenced Nov 3, 2026
This was referenced Nov 3, 2026
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 3, 2026
…odels whose maker an Admin turned off Review on ansvisor#2103: - generate_image no longer says "never refuse": it says don't claim Chat can't make images, and keeps Chat's rules (no real person's likeness, no insulting or misleading imagery of a competitor or anyone, no trademark the brand doesn't own). - The provider switches of Settings › Chat (W4-34) apply to images: the model question offers only models whose maker is on, the precheck and the request refuse one that is off, and with every maker off Chat says it can't make images here. model-providers.ts is ansvisor#2036's, as it is. - A request every provider refused, billing nothing, lets its hold go; picking an image of a set takes its own type and format. Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 of 13 tasks
…roviders # Conflicts: # supabase/schema.sql # web/messages/en.json # web/src/lib/chat/engine.test.ts
cihan-gyk
dismissed
gkhngyk’s stale review
November 4, 2026 17:26
The merge-base changed after approval.
…providers # Conflicts: # supabase/schema.sql # web/src/lib/chat/schema.test.ts
cihan-gyk
dismissed
gkhngyk’s stale review
November 4, 2026 20:43
The merge-base changed after approval.
cihan-gyk
pushed a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 5, 2026
ansvisor#2036 (model providers) changed model-menu.ts's imports; keep both its provider imports and this branch's pickedModelOwnKey. The agent form offers only Anthropic models (Auto, Fast, Best writing), which the provider switches can't turn off, so the key line needs no change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk
pushed a commit
that referenced
this pull request
Nov 5, 2026
… Files (W4-08, 00476, 00477) (#2103) * feat(chat): make images in Chat, pick one from the set and keep it in Files (W4-08, 00476) Chat makes images now instead of refusing (CHAT-15 §E). Before the first image of a chat it asks which image model to use, the options read from the price data: the cheapest first and recommended, each with its multiplier and its share of the monthly AI limit per image ("Your key" on the workspace's own OpenRouter key). Each request makes four images at 1K after a cost card that says how many, on which model, and their share. When the limit left covers only some, the parts check asks first ("Create 1 image now"), with no image made before the answer. The images run on OpenRouter, held and charged through W4-07's metering at the provider's real cost, and are filed as one set in Files. Its card shows every image, the selected one marked; the person picks another in their own chat and downloads it as PNG, converted in the browser. The engine change is thin: the parts check counts images at their model's price, and a deliverable that filed itself is named, not filed again. 00476 lets chat-files take JPEG, which Google's image models send. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): file JPEG image sets, check the AI limit before the card, and round image multipliers (00477) Found in the preview of W4-08: - chat_files' formats check knew PNG and WebP only, so a set of JPEG images (Google's image models) wasn't filed: 00477 adds 'jpg'. - The model may skip the parts check: when the AI limit left covers only some of the images, the request's own check now sends it there before the card, so the person is asked first. - Shares come rounded to two decimals, so Nano Banana 2 read 2.1x: multipliers are whole from 2x, as CHAT-16 item 11 writes them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(chat): keep whose key images run on and each model's cost in images/access.ts The Content Editor's images (W4-09) need the same: the workspace's own OpenRouter key or Ansvisor's, and the image models with their multipliers and shares. They move out of chat-images.ts as they are, with their tests. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(chat): read the saved image by its fields, as Node 20's Blob isn't jsdom's Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep Chat's rules on image requests, and leave out image models whose maker an Admin turned off Review on #2103: - generate_image no longer says "never refuse": it says don't claim Chat can't make images, and keeps Chat's rules (no real person's likeness, no insulting or misleading imagery of a competitor or anyone, no trademark the brand doesn't own). - The provider switches of Settings › Chat (W4-34) apply to images: the model question offers only models whose maker is on, the precheck and the request refuse one that is off, and with every maker off Chat says it can't make images here. model-providers.ts is #2036's, as it is. - A request every provider refused, billing nothing, lets its hold go; picking an image of a set takes its own type and format. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep the image option's words in chatEngine.partial A merge left two "partial" blocks in en.json, and the second, without createImages, replaced the first, so typecheck failed in partial-limit.ts. The duplicate is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMenyNyxsr2Doq4CaQ3 * chore(chat): document image making on main's existing OPENROUTER_API_KEY entry Main already lists OPENROUTER_API_KEY for Chat's model menu (W4-03), so the merge left the key twice in web/.env.example. Chat's images now join that entry's comment instead of a second key line. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMenyNyxsr2Doq4CaQ3 * fix(content-editor): refuse an AI image model whose maker an Admin turned off (W4-34) The editor's image list already hides such a model (imageModelOptions), but POST /api/content/drafts/{id}/images still ran any listed model. It now checks imageModelOn first, as Chat's image precheck does, and refuses before anything is held, charged or sent to the provider: 409 with { ok: false, code: 'provider_off', model }, and the panel says the model's maker is turned off in Settings › Chat. A failed read refuses too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMenyNyxsr2Doq4CaQ3 --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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
Admins choose which model providers Chat may use, and Chat's OpenRouter calls ask for providers that keep no data (Wave 4 plan, EK · W4-34). Owner decision, 2026-11-02 evening: "a US company doing business globally".
Settings › Chat › Model providers:
An Admin turns each on or off; everyone else reads it. Each change goes in the Activity log ("Turned off OpenAI models in Chat").
Data:
chat_settings.model_providers jsonb(00469) keeps the Admin's choices. A provider not chosen takes its default fromlib/chat/model-providers.ts, so a provider added later needs no migration. A provider not on the list is off.Enforced on the server:
/api/chat/models);OpenRouter (
lib/agent/openrouter.ts, used bybuildAgentModel, so Chat's and the Agent's OpenRouter calls):provider.data_collection: "deny";provider.only, no fallbacks): DeepInfra, Together, Fireworks, Parasail, Crusoe, Azure and Nebius. The list was checked against OpenRouter's providers list on 2026-11-03.server/src/lib/ai-provider.js) are not changed. A note on checking their models with deny comes separately.Help: "Model providers" in
help/settings/chat-rules.md(approved: false).Today only Claude models are offered, so no model can be turned off yet. The switch matters once W4-35 adds tested GPT, Gemini or DeepSeek models.
Stacked on #2033. Merged, not rebased.
Related issue
None. Chat Wave 4 plan, EK · W4-34.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd web && yarn vitest run src/lib/chat/model-providers.test.ts src/lib/agent src/lib/chat/model-menu.test.ts src/app/api/chat/models src/lib/actions/chat-settings.test.ts src/components/chat-access src/lib/chat/engine.test.ts -t "provider"Needs migration on prod: 00469, after 00468.
No new environment variables.
Checklist
yarn lintpassesyarn typecheckpassesyarn format:checkpasseshelp/(or no user-visible change)Screens: shown to the owner in a local preview (1024px, light and dark) and approved on 2026-11-03.
CI passed on this branch (82fc1b7), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41528322634): schema is up to date; web
format:check, lint, typecheck, all tests andyarn buildpass; server lint,format:checkand all tests pass.🤖 Generated with Claude Code