Skip to content

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

Open
philchacko wants to merge 1 commit into
docker:mainfrom
philchacko:feat/trustedrouter-provider
Open

philchacko wants to merge 1 commit into
docker:mainfrom
philchacko:feat/trustedrouter-provider

Conversation

@philchacko

Copy link
Copy Markdown

Requested by Phil · project thread

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).
  • Live smoke: DOCKER_AGENT_RUN_TRUSTEDROUTER_LIVE_TEST=1 go test -run TestOpenAIAliasProvider_LiveAPI/trustedrouter ./pkg/model/provider passes (reply pong).

Message-merging probe

Recorded per the message-merging guide, as asked on #4824. Every case was accepted with markers intact (HTTP 200, markers_ok=true), so TrustedRouter accepts both preserved boundaries and the existing merge:

Date Commit Provider/model Endpoint Scenario Preserve Merge Notes
2026-12-04 2fbabc5 trustedrouter/trustedrouter/auto /chat/completions control accepted accepted
2026-12-04 2fbabc5 trustedrouter/trustedrouter/auto /chat/completions multi_system accepted accepted
2026-12-04 2fbabc5 trustedrouter/trustedrouter/auto /chat/completions consecutive_user accepted accepted
2026-12-04 2fbabc5 trustedrouter/trustedrouter/auto /chat/completions late_system accepted accepted diagnostic
2026-12-04 2fbabc5 trustedrouter/anthropic/claude-haiku-5.5 /chat/completions control accepted accepted
2026-12-04 2fbabc5 trustedrouter/anthropic/claude-haiku-5.5 /chat/completions multi_system accepted accepted
2026-12-04 2fbabc5 trustedrouter/anthropic/claude-haiku-5.5 /chat/completions consecutive_user accepted accepted
2026-12-04 2fbabc5 trustedrouter/anthropic/claude-haiku-5.5 /chat/completions late_system accepted accepted diagnostic

Two acceptances don't prove semantic equivalence, so the catalog keeps merge_consecutive_messages: true like the other gateways; there is no evidence the merge is required.

Disclosure: I'm on the founding team at TrustedRouter.

This supersedes #4824, reopened from my account as one signed, DCO-signed-off commit on current main so I can keep it moving. Joe Perla is credited as co-author.

🤖 Generated with Claude Code

https://claude.ai/code/session_01T5JC3xkrEs7BaWPaRCamWX

Add TrustedRouter to the provider catalog (https://api.trustedrouter.com/v1,
TRUSTEDROUTER_API_KEY, default model trustedrouter/auto), with docs, an
example and tests, following the CloudGPU and OrcaRouter pattern.

Supersedes docker#4824.

Co-authored-by: Joseph Perla <jperla@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T5JC3xkrEs7BaWPaRCamWX
Signed-off-by: Phil Chacko <phil@nytex.com>
@philchacko
philchacko requested a review from a team as a code owner December 4, 2026 20:29
Copilot AI balanced review requested due to automatic review settings December 4, 2026 20:29
@aheritier aheritier added area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/models LLM model integrations and model providers area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) area/providers/openai For features/issues/fixes related to the usage of OpenAI models kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Dec 4, 2026

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.

🟢 Approval recommended

No active review issues were identified for the TrustedRouter provider addition.

No open issues 🎉

What changed in this PR

Adds TrustedRouter as a built-in OpenAI-compatible provider using Docker Agent’s existing provider catalog and alias infrastructure.

Changes:

  • Registers the endpoint, API-key variable, default model, and message-merging behavior.
  • Adds credential, automatic-selection, and request tests.
  • Documents configuration and provides a runnable example.
File Description
pkg/​model/​provider/​openai/​system_message_merge_test.go Tests TrustedRouter message-merging selection.
pkg/​model/​provider/​openai_alias_providers_test.go Adds request and opt-in live test cases.
pkg/​model/​provider/​catalog/​providers.json Registers TrustedRouter provider defaults.
pkg/​config/​trustedrouter_test.go Tests required credentials.
pkg/​config/​auto_test.go Tests automatic selection and default model.
examples/​trustedrouter.yaml Adds a named-model example.
examples/​README.md Lists the new example.
docs/​providers/​trustedrouter/​index.md Documents setup, usage, pricing, and gateway behavior.
docs/​providers/​overview/​index.md Lists TrustedRouter authentication.
docs/​data/​nav.yml Adds provider navigation.
docs/​configuration/​models/​index.md Updates documented provider lists.
agent-schema.json Adds TrustedRouter to the provider description.

Review effort: Balanced

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/models LLM model integrations and model providers area/providers/openai For features/issues/fixes related to the usage of OpenAI models area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) 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