Add TrustedRouter as an OpenAI-compatible native provider - #7396
Open
jperla wants to merge 3 commits into
Open
Conversation
- register trustedrouter in OPENAI_COMPATIBLE_PROVIDERS (base_url, TRUSTEDROUTER_API_KEY/TRUSTEDROUTER_BASE_URL) - wire provider prefix routing and model validation in llm.py - registry test + edge docs accordion
Every TrustedRouter model id is namespaced, so the prefix strip that is correct for OpenRouter was wrong for the router's own aliases: "trustedrouter/auto" reached the API as "auto", which it rejects. "trustedrouter/moonshotai/kimi-k3" still resolves to the upstream id, so the split is on whether a remainder is left bare. Adds behavior-level coverage for provider construction, the missing-key error, TRUSTEDROUTER_BASE_URL resolution, and all three aliases, and ports the TrustedRouter section to the ar, ko, and pt-BR LLM guides.
The provider config reads TRUSTEDROUTER_BASE_URL as a custom endpoint override, but no guide listed it. Added to all four locales using the same "# Optional" block the OpenAI section uses. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughChangesTrustedRouter integration
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant LLM
participant OpenAICompatibleCompletion
participant TrustedRouterAPI
LLM->>OpenAICompatibleCompletion: Create trustedrouter model
OpenAICompatibleCompletion->>TrustedRouterAPI: Send request with configured base URL
TrustedRouterAPI-->>OpenAICompatibleCompletion: Return completion
OpenAICompatibleCompletion-->>LLM: Return completion result
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to TrustedRouter configuration and routing are implemented consistently with the documented usage, including alias and namespaced-model handling. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Closes #7395.
Adds TrustedRouter (attested OpenAI-compatible router) as a native provider, following the same shape as the existing
openrouterentry:OPENAI_COMPATIBLE_PROVIDERS["trustedrouter"]withhttps://api.trustedrouter.com/v1,TRUSTEDROUTER_API_KEY, andTRUSTEDROUTER_BASE_URLoverridellm.pytests/llms/openai_compatible/test_openai_compatible.pydocs/edge/en/concepts/llms.mdx(native usage — no LiteLLM dependency needed)Verified locally: 36/36 openai_compatible tests and 19/19 provider/prefix tests in
test_llm.pypass.This reworks the earlier docs-only version of this PR into a code integration.
Localized guides (
ar,ko,pt-BR) carry the same accordion, and the optionalTRUSTEDROUTER_BASE_URLentry is present in all four.Reopened as a new PR because #6143 was auto-closed for not referencing an issue and the reopen was refused; the branch is unchanged apart from a rebase onto current
main.