Skip to content

Add TrustedRouter to the desktop model provider screen - #1901

Open
jperla wants to merge 4 commits into
CopilotKit:mainfrom
jperla:add-trustedrouter
Open

jperla wants to merge 4 commits into
CopilotKit:mainfrom
jperla:add-trustedrouter

Conversation

@jperla

@jperla jperla commented Nov 19, 2026

Copy link
Copy Markdown

What this changes

Adds TrustedRouter as a named row on OpenBot Desktop's Connect your AI screen and in Settings where the AI connection is changed, between Unbiased AI and "Any OpenAI-compatible endpoint".

TrustedRouter is an OpenAI-compatible gateway in front of many providers. It has no OAuth sign-in, so the row offers only the API key tab (logins: ["endpoint"]), like the key half of the xAI and Unbiased AI rows. The person pastes a key; OpenBot fills in the rest:

Base URL https://api.trustedrouter.com/v1
Model (editable) anthropic/claude-sonnet-5.5
Key link "Get a TrustedRouter API key" → https://trustedrouter.com/console/api-keys
Summary "Use a TrustedRouter API key for models from many providers."

From there the key travels exactly as a typed Unbiased AI key does: as a compatible-endpoint credential. Nothing after the screen changes. The model list reads the gateway's public GET /v1/models, which the catalogue already does for any compatible endpoint (the "Any other OPENAI_BASE_URL" row in docs/configuration.md).

This follows the Unbiased AI row's endpoint path file for file, and leaves out its sign-in (no provider_oauth.rs or PROVIDER_OAUTH.md changes):

  • desktop/src-tauri/src/provider.rs: the catalogue row, plus the endpoint-row and row-order tests. A small test says the row asks only for a key.
  • desktop/src/ProviderPicker.tsx and app/src/lib/ai-connection/providers.ts: the endpoint preset and key link in both apps, and the Settings row. ai-connection-providers.test.ts keeps the two in step.
  • desktop/src-tauri/src/ai_connection.rs and app/src/lib/desktop/ai-connection.ts: api.trustedrouter.com names the connection trustedrouter for the server, and "TrustedRouter" in Settings. trustedrouter/endpoint maps to the compatible-endpoint intent, and trustedrouter/oauth maps to nothing. Both are tested.
  • api/openapi/model-connections.yaml: trustedrouter in AiConnectionProvider and in the two descriptions that list which provider takes which way in. api/openapi.yaml and the generated client come from bun run api:generate and are not edited by hand.
  • scripts/model-compat.ts (NOT_CHECKED) and docs/releasing.md: the model check leaves TrustedRouter open, as it does Unbiased AI, because a gateway is not a provider's own listing.
  • shared/marks/trustedrouter.svg and its README line: TrustedRouter's own monochrome mark from its public media kit (https://trustedrouter.com/static/media-kit/trustedrouter-mono.svg). Verbatim apart from a <title> and 1em sizing, and already drawn in currentColor in a 24-unit box like the lobehub marks.
  • Tests listing the rows (ProviderPicker.test.tsx, setupLayout.browser.test.ts, ai-connection-dialog.test.tsx) and CHANGELOG.md.

Why anthropic/claude-sonnet-5.5. The endpoint form needs a model name, and every preset names one (gemini-3.8-flash, grok-4.7, pareto). In the spirit of "the middle of the provider's current line" (Claude Sonnet among the examples), this is the newest Sonnet in TrustedRouter's live /v1/models, and it lists tools in supported_parameters. It also runs over Chat Completions, so the default doesn't depend on the Responses API. It stays editable, and once connected the model picker lists everything the gateway serves. I left out the router alias trustedrouter/auto so the default is one explicit model.

Responses API. TrustedRouter's docs (https://trustedrouter.com/docs) list POST /v1/responses beside /v1/chat/completions on the inference host. So a person who picks openai/gpt-5.6-* or later, which OpenBot's built-in Bots call through /responses, should be served. I have not run a Bot against it from this branch. The default above does not depend on it either way.

One thing outside this repository. Settings saves the connection through PUT /api/v2/organizations/{organizationId}/ai-connection, and the server that answers it is not in this repo. If that server keeps its own list of providers, it needs trustedrouter added there the way unbiased is. Desktop's setup window doesn't depend on it, because it sends a named endpoint as openai-compatible.

Where it runs

  • New state that outlives a request? None. This is a provider-catalogue row and preset constants compiled into the app and the desktop. The key is kept where any compatible-endpoint key already is.
  • What happens on the second replica? The same thing as on the first. The row and preset are constants in every process, and the provider id is one more enum value.
  • Anything serialised? No.
  • Anything fanned out to a browser? No.
  • New listener, port, or schedule? No. The gateway's /models is read by the existing model-list refresh (start-up, then every six hours), as for any compatible endpoint.

Boundary and audit

  • Every acting call still goes through the gateway: no new call path. The connection switch is the existing one, with one more provider value.
  • New refusals and new failures each write a row: there are none. A pair the server doesn't take is refused by the existing rule.
  • Nothing new is trusted from the client that the server can resolve itself: the provider id is an enum value the server validates, and the key is write-only as before.

Changelog

  • A line in CHANGELOG.md under Unreleased, in OpenBot Desktop.

Proof

Run on macOS (arm64) with HTTP_PROXY=http://127.0.0.1:9 HTTPS_PROXY=http://127.0.0.1:9 NO_PROXY=127.0.0.1,localhost set, so nothing reached the network. The test runs below used Bun 1.4.3 (the repo's packageManager) and passed under Bun 1.3.14 too, except where a single version is named. Biome and tsc come from the lockfile.

  • bun run api:generate (Bun 1.3.14): the generated diff is only the new enum value and the three descriptions in api/openapi.yaml, aiConnectionProvider.ts, aiConnectionInput.ts, aiConnectionLogin.ts and models.zod.ts. bun run api:lint is valid, and a second bun run api:bundle leaves the tree clean.
  • bunx biome lint --error-on-warnings <touched files> and bunx biome format <touched files>: no fixes.
  • cd app && bunx tsc --noEmit and cd desktop && bunx tsc --noEmit: exit 0.
  • bun test app/tests/ai-connection-providers.test.ts app/tests/settings-ai-connection-desktop.test.tsx app/tests/harness-mark.test.tsx app/tests/admin-providers.test.tsx scripts/model-compat.test.ts scripts/model-lock.test.ts api/openapi-ai-connection.test.ts shared/marks.test.ts shared/harnesses.test.ts shared/model-providers.test.ts tests/no-intelligence-in-user-copy.test.ts tests/plain-setup-words.test.ts tests/no-reload-the-page-in-user-copy.test.ts tests/no-composio-in-user-copy.test.ts: 117 pass, 0 fail.
  • cd desktop && bun test src/ProviderPicker.test.tsx: 60 pass, 0 fail, including the TrustedRouter cases from the preset loop shared with Google, xAI and Unbiased AI. The key link opens externally without sending the typed key, and the preset fills the official address and an editable model. cd desktop && bun test src/ (bun 1.3.14): 499 pass, 68 skip (the opt-in browser file), 0 fail.
  • cd desktop && OPENBOT_APP_BROWSER=1 bun test src/setupLayout.browser.test.ts (bun 1.3.14, real Chromium, seven rows on Connect your AI): 67 pass, 1 fail. The failure is "with scrollbars that take room, as Windows draws them > at 1000x800, the background row holds still…" (listing.scrollbar false), and it fails the same way on a clean checkout of main on this Mac.
  • cd desktop/src-tauri && cargo fmt --check: clean. cargo test --lib -- provider:: ai_connection::: 18 passed, 2 ignored (need Docker), including trustedrouter_asks_only_for_a_key, six_named_providers_and_one_custom_endpoint, each_way_in_the_setup_window_offers_is_one_connection and the_server_is_told_the_connection_and_never_its_key.
  • cargo clippy --all-targets -- -D warnings with local Rust 1.94.1 stops on two nonminimal_bool lints in src/stack.rs, which this change doesn't touch. With that one lint allowed (-A clippy::nonminimal_bool) it finishes clean, so nothing in the touched files trips clippy.
  • OPENBOT_APP_BROWSER=1 bun test app/tests/ai-connection-dialog.test.tsx (Bun 1.4.3; under 1.3.14 its fixture does not bundle) could not reach the provider-list assertion locally. It stops earlier, at line 421 (the Change button's click is intercepted by an inert overlay), and does so identically on clean main here. CI's browser job is the real check for that one line.
  • Read-only checks against TrustedRouter: GET https://api.trustedrouter.com/v1/models (public, no key) lists anthropic/claude-sonnet-5.5 with tools in supported_parameters. https://trustedrouter.com/console/api-keys answers a signed-out visitor with a 302 to sign in. No completion endpoint was called.

Disclosure: I work on TrustedRouter.

A TrustedRouter row on Connect your AI and in Settings, between Unbiased
AI and the custom endpoint. TrustedRouter is an OpenAI-compatible gateway
in front of many providers and has no sign-in, so the row offers only the
API key tab: OpenBot fills in https://api.trustedrouter.com/v1 and the
model anthropic/claude-sonnet-5.5, and the person pastes a key. The key
travels as a compatible-endpoint key, exactly as a typed Unbiased AI key
does, so nothing after the screen changes. The model list reads the
gateway's public /models, which the catalogue already does for any
compatible endpoint.

The row follows the Unbiased AI endpoint path file for file: the
catalogue and its tests, the endpoint preset and key link in both apps,
the host that names the connection for the server and for Settings, the
AiConnectionProvider enum (client regenerated with bun run api:generate),
the model check's list of gateways it leaves open, the vendored mark from
TrustedRouter's media kit, and the changelog.
davidmckayv and others added 3 commits November 20, 2026 07:25
…ed app

Adding trustedrouter to AiConnectionProvider put a value in GET and PUT
/ai-connection answers that a client built against 1.1.1 has never seen,
and oasdiff failed it. The answers now use AiConnectionProviderAnswer,
an x-extensible-enum copy with the same values (api/README.md, Enums that
grow), as PersonRoleAnswer is for PersonRole. A request still names one
of the closed AiConnectionProvider list, so a switch to a provider the
server doesn't take is still refused with 400.

The four changes oasdiff reports are listed in accepted-breaking-changes.md.
The app shows a provider it has no row for by its id, and passes it to
Desktop as it came. The new spec test parses an answer naming an unknown
provider and refuses a switch to one.

This branch has not been deployed

No deployments
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