Skip to content

feat: add TrustedRouter as a built-in OpenAI-compatible provider - #4824

Open
jperla wants to merge 1 commit into
docker:mainfrom
jperla:add-trustedrouter-provider
Open

jperla wants to merge 1 commit into
docker:mainfrom
jperla:add-trustedrouter-provider

Conversation

@jperla

@jperla jperla commented Nov 8, 2026

Copy link
Copy Markdown

Summary

Adds TrustedRouter as a built-in OpenAI-compatible catalog provider, following the CloudGPU / OrcaRouter pattern:

  • trustedrouter entry in pkg/model/provider/catalog/providers.json: https://api.trustedrouter.com/v1, TRUSTEDROUTER_API_KEY, default model trustedrouter/auto, consecutive-message merging like the other gateways.
  • TrustedRouter is already in the embedded models.dev snapshot (trustedrouter/auto, /cheap, /fast, …), so it needs no modelsDevAbsentProviders / catalog exemptions and gets pricing/context metadata from the catalog.
  • Docs page, nav, overview table, provider lists in the schema/model docs, and examples/trustedrouter.yaml.
  • Tests: credential auto-selection, default model, required-credentials check, system-message merge gating, and the hermetic alias end-to-end request.

Usage

agents:
  root:
    model: trustedrouter/trustedrouter/auto
    description: Assistant using TrustedRouter
    instruction: You are a helpful assistant.

The first trustedrouter/ selects the provider; TrustedRouter model IDs are always vendor-prefixed (e.g. trustedrouter/anthropic/claude-sonnet-4.5).

Verification

  • go test -count=1 ./pkg/config/ ./pkg/model/provider/ ./pkg/model/provider/openai/ ./pkg/model/provider/catalog/ ./cmd/root/ — pass (TestProviderIDsMatchEmbeddedCatalog/trustedrouter, TestOpenAIAliasProvider_EndToEndRequest/trustedrouter included; the live subtest skips without opt-in).
  • go test ./pkg/model/provider/... ./pkg/modelsdev/... — pass. go vet on touched packages — clean. markdownlint on the new page — 0 issues.
  • task lint / golangci-lint not run locally (not installed). Not live-tested against the API.

Disclosure: I work on TrustedRouter.

@jperla
jperla requested a review from a team as a code owner November 8, 2026 15:45
@aheritier aheritier added area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) area/testing Test infrastructure, CI/CD, test runners, evaluation kind/feat PR adds a new feature (maps to feat:). Use on PRs only. status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key labels Nov 9, 2026
@aheritier

Copy link
Copy Markdown
Collaborator

👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push.

Commits that are not verified: c39a8ef

See GitHub's guide on signing commits for setup instructions. I've added status/needs-signed-commits; it will be removed automatically once every commit in this PR carries a valid GitHub-verified signature.

@aheritier

Copy link
Copy Markdown
Collaborator

👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push.

Commits that are not verified: c39a8ef

See GitHub’s guide on signing commits for setup instructions. I’ve added status/needs-signed-commits; it will be removed automatically once every commit in this PR carries a valid GitHub-verified signature.

@aheritier aheritier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Open and non-draft; head unchanged from the previous review. No blocking implementation findings. See inline comment.

CI: gate passed for this head; no failing or running checks. Separately, the commit is unsigned and status/needs-signed-commits remains set.

Prior threads: none; no published reviews or inline threads.

Comment thread docs/providers/trustedrouter/index.md Outdated

Requests use OpenAI-compatible Chat Completions at
`https://api.trustedrouter.com/v1` with `TRUSTEDROUTER_API_KEY`. Model metadata
(context limits, pricing, capabilities) comes from the embedded models.dev

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[should-fix] High confidence: the embedded catalog does not provide TrustedRouter pricing. At this head, all seven TrustedRouter entries in pkg/modelsdev/embedded/snapshot.json, including trustedrouter/auto, omit cost. Context limits and capabilities are available, but this setup cannot obtain pricing from that snapshot. Remove pricing from this claim and explain that explicit cost configuration is needed when catalog rates are unavailable.

@aheritier
aheritier marked this pull request as draft November 9, 2026 20:54
@aheritier

Copy link
Copy Markdown
Collaborator

👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push.

Commits that are not verified: c39a8ef

See GitHub's guide on signing commits for setup instructions. I've added status/needs-signed-commits; it will be removed automatically once every commit in this PR carries a valid GitHub-verified signature.

@aheritier aheritier added the status/needs-rebase PR has merge conflicts or is out of date with main label Nov 9, 2026
@aheritier

Copy link
Copy Markdown
Collaborator

👋 This PR has merge conflicts with the base branch. Please rebase or merge the latest base branch and resolve them. I've moved it to draft and added ; it'll be picked back up automatically once the conflicts are cleared.

@aheritier

Copy link
Copy Markdown
Collaborator

👋 This PR has merge conflicts with the base branch. Please rebase or merge the latest base branch and resolve them. I've moved it to draft and added status/needs-rebase; it'll be picked back up automatically once the conflicts are cleared.

@jperla
jperla force-pushed the add-trustedrouter-provider branch 2 times, most recently from 69eacdd to 183360f Compare November 10, 2026 00:31
@aheritier aheritier removed status/needs-rebase PR has merge conflicts or is out of date with main status/needs-signed-commits Some commits in the PR are signed with a valid SSH/GPG key labels Nov 10, 2026
@aheritier
aheritier marked this pull request as ready for review November 11, 2026 21:57
Copilot AI balanced review requested due to automatic review settings November 11, 2026 21:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The TrustedRouter live-test entry lacks an explicit opt-in gate, allowing ordinary package tests to send potentially billable inference requests whenever TRUSTEDROUTER_API_KEY is set.

1 open issue
What changed in this PR

Adds TrustedRouter as a built-in OpenAI-compatible provider using the existing catalog-driven provider infrastructure.

Changes:

  • Registers the endpoint, API-key environment variable, default model, and consecutive-message merging.
  • Adds credential, automatic-selection, message-merging, and request tests.
  • Documents configuration and adds a runnable example.
File Description
pkg/​model/​provider/​openai/​system_message_merge_test.go Tests TrustedRouter message-merge gating.
pkg/​model/​provider/​openai_alias_providers_test.go Adds TrustedRouter to shared alias-provider tests.
pkg/​model/​provider/​catalog/​providers.json Registers TrustedRouter settings and credentials.
pkg/​config/​trustedrouter_test.go Tests required credential validation.
pkg/​config/​auto_test.go Tests automatic selection and default model.
examples/​trustedrouter.yaml Adds a named-model agent example.
examples/​README.md Lists the TrustedRouter example.
docs/​providers/​trustedrouter/​index.md Documents setup, model syntax, pricing, and gateway behavior.
docs/​providers/​overview/​index.md Lists TrustedRouter and its authentication variable.
docs/​data/​nav.yml Adds provider navigation.
docs/​configuration/​models/​index.md Adds TrustedRouter to documented provider lists.
agent-schema.json Adds TrustedRouter to the provider description.

Review effort: Balanced

@aheritier aheritier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please address the blocking live-test safety feedback and mark the PR ready for review after addressing it.

Prior threads:

  • 4515128707: addressed; the provider docs explain that catalog pricing is unavailable and recommend explicit cost configuration.
  • 4543681848: still open — [blocking] High confidence: the TrustedRouter entry omits liveOptInEnvVar, so exporting TRUSTEDROUTER_API_KEY enables real, potentially billable inference during ordinary package tests. Add liveOptInEnvVar: "DOCKER_AGENT_RUN_TRUSTEDROUTER_LIVE_TEST"; this also includes TrustedRouter in the explicit-opt-in regression test.

@aheritier
aheritier marked this pull request as draft November 11, 2026 23:03
Register trustedrouter in the embedded provider catalog at
https://api.trustedrouter.com/v1, discover TRUSTEDROUTER_API_KEY, and
default to trustedrouter/auto. TrustedRouter is already in the
embedded models.dev snapshot, so no catalog exemptions are needed.

Signed-off-by: Joseph Perla <claude@jperla.com>
@jperla
jperla force-pushed the add-trustedrouter-provider branch from 183360f to 1d587dd Compare November 14, 2026 16:05
@jperla
jperla marked this pull request as ready for review November 14, 2026 16:06

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

area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) area/testing Test infrastructure, CI/CD, test runners, evaluation kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants