This commit is contained in:
Joseph Perla 2026-11-03 11:35:51 -08:00 • committed by GitHub
commit 1578e93795
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 124 additions and 0 deletions

View file

@ -1083,6 +1083,7 @@ openai_compatible_endpoints: Final[list[str]] = [
"https://api.inference.wandb.ai/v1",
"https://api.clarifai.com/v2/ext/openai/v1",
"https://api.libertai.io/v1",
"https://api.trustedrouter.com/v1",
"https://pinstripes.io/v1",
"https://api.meta.ai/v1",
"https://api.sailresearch.com/v1",
@ -1143,6 +1144,7 @@ openai_compatible_providers: Final[list[str]] = [
"chutes", # Chutes - JSON-configured provider
"parasail", # Parasail - JSON-configured provider
"libertai", # LibertAI - JSON-configured provider
"trustedrouter", # TrustedRouter - JSON-configured provider
"featherless_ai",
"nscale",
"nebius",

View file

@ -302,5 +302,11 @@
"preserve_cache_control": true
},
"supported_endpoints": ["/v1/chat/completions"]
},
"trustedrouter": {
"base_url": "https://api.trustedrouter.com/v1",
"api_key_env": "TRUSTEDROUTER_API_KEY",
"api_base_env": "TRUSTEDROUTER_API_BASE",
"supported_endpoints": ["/v1/chat/completions", "/v1/responses"]
}
}

View file

@ -4452,5 +4452,33 @@
}
],
"default_model_placeholder": "bigmodel/glm-5.3"
},
{
"provider": "Trustedrouter",
"provider_display_name": "TrustedRouter",
"litellm_provider": "trustedrouter",
"credential_fields": [
{
"key": "api_key",
"label": "TrustedRouter API Key",
"placeholder": "Your TrustedRouter API key from trustedrouter.com",
"tooltip": "Get your API key from the TrustedRouter dashboard at trustedrouter.com",
"required": true,
"field_type": "password",
"options": null,
"default_value": null
},
{
"key": "api_base",
"label": "API Base",
"placeholder": "https://api.trustedrouter.com/v1",
"tooltip": "TrustedRouter API base URL (defaults to https://api.trustedrouter.com/v1)",
"required": false,
"field_type": "text",
"options": null,
"default_value": null
}
],
"default_model_placeholder": "trustedrouter/auto"
}
]

View file

@ -4741,6 +4741,7 @@ class LlmProviders(str, Enum):
XIAOMI_MIMO = "xiaomi_mimo"
TENSORMESH = "tensormesh"
LIBERTAI = "libertai"
TRUSTEDROUTER = "trustedrouter"
PINSTRIPES = "pinstripes"
COGNITION = "cognition"
CORALBRICKS = "coralbricks"

View file

@ -5483,6 +5483,23 @@
"a2a": true,
"generateContent": true
}
},
"trustedrouter": {
"display_name": "TrustedRouter (`trustedrouter`)",
"url": "https://docs.litellm.ai/docs/providers/trustedrouter",
"endpoints": {
"chat_completions": true,
"messages": false,
"responses": true,
"embeddings": false,
"image_generations": false,
"audio_transcriptions": false,
"audio_speech": false,
"moderations": false,
"batches": false,
"rerank": false,
"a2a": false
}
}
},
"endpoints": {

View file

@ -0,0 +1,59 @@
import os
from unittest.mock import patch
TRUSTEDROUTER_API_BASE = "https://api.trustedrouter.com/v1"
def test_trustedrouter_json_registry():
import litellm
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
assert litellm.LlmProviders.TRUSTEDROUTER.value == "trustedrouter"
assert litellm.LlmProviders("trustedrouter") == litellm.LlmProviders.TRUSTEDROUTER
assert JSONProviderRegistry.exists("trustedrouter")
config = JSONProviderRegistry.get("trustedrouter")
assert config is not None
assert config.base_url == TRUSTEDROUTER_API_BASE
assert config.api_key_env == "TRUSTEDROUTER_API_KEY"
assert config.api_base_env == "TRUSTEDROUTER_API_BASE"
assert "/v1/chat/completions" in config.supported_endpoints
assert "/v1/responses" in config.supported_endpoints
def test_trustedrouter_listed_in_openai_compatible_providers():
from litellm.constants import (
openai_compatible_endpoints,
openai_compatible_providers,
)
assert "trustedrouter" in openai_compatible_providers
assert TRUSTEDROUTER_API_BASE in openai_compatible_endpoints
def test_trustedrouter_dynamic_config_env_vars():
from litellm.llms.openai_like.dynamic_config import create_config_class
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
config = create_config_class(JSONProviderRegistry.get("trustedrouter"))()
with patch.dict(
os.environ,
{
"TRUSTEDROUTER_API_KEY": "test-key",
"TRUSTEDROUTER_API_BASE": "https://example.com/v1",
},
):
api_base, api_key = config._get_openai_compatible_provider_info(None, None)
assert api_base == "https://example.com/v1"
assert api_key == "test-key"
def test_trustedrouter_provider_detection_by_prefix():
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
model, provider, _, api_base = get_llm_provider("trustedrouter/zdr")
assert model == "zdr"
assert provider == "trustedrouter"
assert api_base == TRUSTEDROUTER_API_BASE

View file

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<path d="M1.4 7.5 H6.5 L11 12" stroke="#1f2328"/>
<path d="M1.4 16.5 H4 L8.5 12" stroke="#1f2328"/>
<path d="M1.4 12 H15.5" stroke="#1f2328"/>
<path d="M17.4 12 H22.6" stroke="#0F9D58"/>
<circle cx="15.5" cy="12" r="1.9" fill="#0F9D58"/>
</svg>

After

Width:  |  Height:  |  Size: 392 B

View file

@ -49,6 +49,7 @@ import nvidiaTritonLogo from "../../public/assets/logos/nvidia_triton.png";
import ollamaLogo from "../../public/assets/logos/ollama.svg";
import openaiSmallLogo from "../../public/assets/logos/openai_small.svg";
import openrouterLogo from "../../public/assets/logos/openrouter.svg";
import trustedrouterLogo from "../../public/assets/logos/trustedrouter.svg";
import oracleLogo from "../../public/assets/logos/oracle.svg";
import parallelAiLogo from "../../public/assets/logos/parallel_ai.png";
import perplexityAiLogo from "../../public/assets/logos/perplexity-ai.svg";
@ -190,6 +191,7 @@ export enum Providers {
TogetherAI = "TogetherAI",
TOPAZ = "Topaz",
Triton = "Triton",
Trustedrouter = "Trustedrouter",
TypeSafe = "TypeSafe",
Nace = "Nace",
PARALLEL_AI = "Parallel AI",
@ -325,6 +327,7 @@ export const provider_map: Record<string, string> = {
TogetherAI: "together_ai",
TOPAZ: "topaz",
Triton: "triton",
Trustedrouter: "trustedrouter",
TypeSafe: "typesafe",
Nace: "nace",
PARALLEL_AI: "parallel_ai",
@ -441,6 +444,7 @@ export const providerLogoMap: Partial<Record<Providers, string>> = {
[Providers.TogetherAI]: togetheraiLogo.src,
[Providers.TOPAZ]: topazLogo.src,
[Providers.Triton]: nvidiaTritonLogo.src,
[Providers.Trustedrouter]: trustedrouterLogo.src,
[Providers.TypeSafe]: typesafeLogo.src,
[Providers.V0]: v0Logo.src,
[Providers.VERCEL_AI_GATEWAY]: vercelLogo.src,