@tonyclaw/llm-inspector 1.14.4 → 1.14.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,11 +37,41 @@ function getEnvValue(envObj: unknown, key: string): string | undefined {
37
37
  return typeof val === "string" ? val.trim() : undefined;
38
38
  }
39
39
 
40
+ // Map of well-known API hostnames to their proper brand names.
41
+ // The key is the domain (second-level domain extracted from the hostname),
42
+ // matched case-insensitively.
43
+ const KNOWN_PROVIDER_NAMES: Record<string, string> = {
44
+ deepseek: "DeepSeek",
45
+ minimaxi: "MiniMax",
46
+ openai: "OpenAI",
47
+ anthropic: "Anthropic",
48
+ openrouter: "OpenRouter",
49
+ groq: "Groq",
50
+ together: "Together",
51
+ fireworks: "Fireworks",
52
+ bedrock: "Bedrock",
53
+ vertexai: "Vertex AI",
54
+ azure: "Azure",
55
+ moonshot: "Moonshot",
56
+ zhipu: "ZhipuAI",
57
+ qwen: "Qwen",
58
+ baichuan: "Baichuan",
59
+ iflytek: "iFlytek",
60
+ doubao: "Doubao",
61
+ lingyiwanwu: "LingyiWanwu",
62
+ stepfun: "StepFun",
63
+ };
64
+
40
65
  function deriveNameFromUrl(url: string): string {
41
66
  try {
42
67
  const hostname = new URL(url).hostname;
43
68
  const parts = hostname.split(".");
44
69
  const domain = parts.length >= 2 ? (parts[parts.length - 2] ?? hostname) : hostname;
70
+ const domainLower = domain.toLowerCase();
71
+ // Check known providers first
72
+ if (KNOWN_PROVIDER_NAMES[domainLower] !== undefined) {
73
+ return KNOWN_PROVIDER_NAMES[domainLower];
74
+ }
45
75
  return domain.charAt(0).toUpperCase() + domain.slice(1);
46
76
  } catch {
47
77
  return "Imported Provider";
@@ -161,8 +191,8 @@ function detectOpenCodeProviders(): ExternalProvider[] {
161
191
  if (typeof modelDef === "string") {
162
192
  modelSet.add(modelDef);
163
193
  } else if (isRecord(modelDef)) {
164
- const name: unknown = modelDef["name"];
165
- modelSet.add(typeof name === "string" && name !== "" ? name : modelId);
194
+ // modelId is the actual model identifier sent to the remote API
195
+ modelSet.add(modelId);
166
196
  } else {
167
197
  modelSet.add(modelId);
168
198
  }