MCPcopy
hub / github.com/msgbyte/tianji / getAIRouterProtocolForPath

Function getAIRouterProtocolForPath

src/server/model/aiRouter.ts:76–93  ·  view source on GitHub ↗
(
  provider: string,
  endpoint: string
)

Source from the content-addressed store, hash-verified

74}
75
76export function getAIRouterProtocolForPath(
77 provider: string,
78 endpoint: string
79): AIRouterProtocol | null {
80 if (endpoint === 'chat/completions' && openAIChatProviders.has(provider)) {
81 return AI_ROUTER_PROTOCOLS.OPENAI_CHAT;
82 }
83
84 if (endpoint === 'responses' && openAIResponsesProviders.has(provider)) {
85 return AI_ROUTER_PROTOCOLS.OPENAI_RESPONSES;
86 }
87
88 if (endpoint === 'messages' && anthropicMessagesProviders.has(provider)) {
89 return AI_ROUTER_PROTOCOLS.ANTHROPIC_MESSAGES;
90 }
91
92 return null;
93}
94
95export function applyAIRouterModelOverride<T extends { model?: unknown }>(
96 payload: T,

Callers 1

aiRouter.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected