File size: 4,469 Bytes
60faa09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
export const MODEL_CATALOG = [
  // OpenAI
  { id: "openai:gpt-4o", label: "GPT-4o", provider: "openai", cost: 10, supportsVision: true, supportsStreaming: true, contextWindow: 128_000 },
  { id: "openai:gpt-4o-mini", label: "GPT-4o mini", provider: "openai", cost: 2, supportsVision: true, supportsStreaming: true, contextWindow: 128_000 },
  { id: "openai:gpt-4-turbo", label: "GPT-4 Turbo", provider: "openai", cost: 8, supportsVision: true, supportsStreaming: true, contextWindow: 128_000 },
  { id: "openai:o1-mini", label: "o1-mini (reasoning)", provider: "openai", cost: 12, supportsVision: false, supportsStreaming: false, reasoning: true, contextWindow: 128_000 },

  // Anthropic
  { id: "anthropic:claude-3-5-sonnet-latest", label: "Claude 3.5 Sonnet", provider: "anthropic", cost: 10, supportsVision: true, supportsStreaming: true, contextWindow: 200_000 },
  { id: "anthropic:claude-3-5-haiku-latest", label: "Claude 3.5 Haiku", provider: "anthropic", cost: 2, supportsVision: true, supportsStreaming: true, contextWindow: 200_000 },
  { id: "anthropic:claude-3-opus-latest", label: "Claude 3 Opus", provider: "anthropic", cost: 15, supportsVision: true, supportsStreaming: true, contextWindow: 200_000 },

  // HuggingFace Inference
  { id: "hf:meta-llama/Llama-3.3-70B-Instruct", label: "Llama 3.3 70B Instruct", provider: "huggingface", cost: 1, supportsVision: false, supportsStreaming: true, contextWindow: 128_000 },
  { id: "hf:meta-llama/Meta-Llama-3.1-8B-Instruct", label: "Llama 3.1 8B Instruct", provider: "huggingface", cost: 1, supportsVision: false, supportsStreaming: true, contextWindow: 32_000 },
  { id: "hf:Qwen/Qwen2.5-72B-Instruct", label: "Qwen 2.5 72B Instruct", provider: "huggingface", cost: 2, supportsVision: false, supportsStreaming: true, contextWindow: 32_000 },
  { id: "hf:mistralai/Mistral-7B-Instruct-v0.3", label: "Mistral 7B Instruct v0.3", provider: "huggingface", cost: 1, supportsVision: false, supportsStreaming: true, contextWindow: 32_000 },

  // Groq
  { id: "groq:llama-3.3-70b-versatile", label: "Llama 3.3 70B (Groq)", provider: "groq", cost: 2, supportsVision: false, supportsStreaming: true, contextWindow: 128_000 },
  { id: "groq:llama-3.1-8b-instant", label: "Llama 3.1 8B Instant (Groq)", provider: "groq", cost: 1, supportsVision: false, supportsStreaming: true, contextWindow: 128_000 },
  { id: "groq:deepseek-r1-distill-llama-70b", label: "DeepSeek R1 Distill 70B (Groq)", provider: "groq", cost: 4, supportsVision: false, supportsStreaming: true, reasoning: true, contextWindow: 128_000 },

  // MuAPI (legacy)
  { id: "muapi:google/gemini-2.5-flash", label: "Gemini 2.5 Flash (via MuAPI)", provider: "muapi", cost: 1, supportsVision: true, supportsStreaming: false, contextWindow: 1_000_000 },
  { id: "muapi:openai/gpt-4o", label: "GPT-4o (via MuAPI)", provider: "muapi", cost: 10, supportsVision: true, supportsStreaming: false, contextWindow: 128_000 },
  { id: "muapi:deepseek/deepseek-r1", label: "DeepSeek R1 (via MuAPI)", provider: "muapi", cost: 10, supportsVision: false, supportsStreaming: false, reasoning: true, contextWindow: 128_000 },
];

export const MODELS_BY_PROVIDER = MODEL_CATALOG.reduce((acc, m) => {
  if (!acc[m.provider]) acc[m.provider] = [];
  acc[m.provider].push(m);
  return acc;
}, {});

export const PROVIDER_META = {
  openai: { label: "OpenAI", color: "emerald", requiresKey: "OPENAI_API_KEY" },
  anthropic: { label: "Anthropic", color: "amber", requiresKey: "ANTHROPIC_API_KEY" },
  huggingface: { label: "HuggingFace", color: "yellow", requiresKey: "HF_TOKEN" },
  groq: { label: "Groq", color: "orange", requiresKey: "GROQ_API_KEY" },
  muapi: { label: "MuAPI", color: "indigo", requiresKey: "MU_API_KEY" },
  gradio: { label: "Gradio Server", color: "rose", requiresKey: null },
};

export function getModelMeta(modelId) {
  if (!modelId) return null;
  const direct = MODEL_CATALOG.find((m) => m.id === modelId);
  if (direct) return direct;
  if (modelId.includes("/") && !modelId.startsWith("gradio:")) {
    const legacy = MODEL_CATALOG.find((m) => m.id === `muapi:${modelId}`);
    if (legacy) return legacy;
  }
  if (modelId.startsWith("gradio:")) {
    return {
      id: modelId,
      label: modelId.replace("gradio:", "").slice(0, 40),
      provider: "gradio",
      cost: 0,
      supportsVision: false,
      supportsStreaming: false,
      contextWindow: 32_000,
    };
  }
  return null;
}

export const DEFAULT_MODEL = "openai:gpt-4o-mini";