Bot commited on
Commit
0582aa1
·
1 Parent(s): 01f3995

Add new NIM models + dynamic (Recommended) model logic

Browse files
openai-compatible.config.ts CHANGED
@@ -6,6 +6,36 @@ const providers: OpenAICompatibleProvider[] = [
6
  "apiKey": process.env.BACKEND_API_KEY as string,
7
  "baseUrl": "https://augment17-claude-code-backend.hf.space/v1",
8
  "models": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  {
10
  "apiName": "meta/llama-3.1-70b-instruct",
11
  "uiName": "Llama 3.1 70B (Agentic)",
 
6
  "apiKey": process.env.BACKEND_API_KEY as string,
7
  "baseUrl": "https://augment17-claude-code-backend.hf.space/v1",
8
  "models": [
9
+ {
10
+ "apiName": "nvidia/nemotron-3-ultra-550b-a55b",
11
+ "uiName": "Nemotron 3 Ultra 550B (Agentic)",
12
+ "supportsTools": true
13
+ },
14
+ {
15
+ "apiName": "z-ai/glm-5.1",
16
+ "uiName": "GLM 5.1 (Agentic)",
17
+ "supportsTools": true
18
+ },
19
+ {
20
+ "apiName": "moonshotai/kimi-k2.6",
21
+ "uiName": "Kimi K2.6 (Agentic)",
22
+ "supportsTools": true
23
+ },
24
+ {
25
+ "apiName": "minimaxai/minimax-m3",
26
+ "uiName": "MiniMax M3 (Agentic)",
27
+ "supportsTools": true
28
+ },
29
+ {
30
+ "apiName": "stepfun-ai/step-3.7-flash",
31
+ "uiName": "Step 3.7 Flash (Agentic)",
32
+ "supportsTools": true
33
+ },
34
+ {
35
+ "apiName": "minimaxai/minimax-m2.7",
36
+ "uiName": "MiniMax M2.7 (Agentic)",
37
+ "supportsTools": true
38
+ },
39
  {
40
  "apiName": "meta/llama-3.1-70b-instruct",
41
  "uiName": "Llama 3.1 70B (Agentic)",
src/app/api/chat/models/route.ts CHANGED
@@ -1,8 +1,57 @@
1
  import { customModelProvider } from "lib/ai/models";
2
 
3
  export const GET = async () => {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  return Response.json(
5
- customModelProvider.modelsInfo.sort((a, b) => {
6
  if (a.hasAPIKey && !b.hasAPIKey) return -1;
7
  if (!a.hasAPIKey && b.hasAPIKey) return 1;
8
  return 0;
 
1
  import { customModelProvider } from "lib/ai/models";
2
 
3
  export const GET = async () => {
4
+ let recommendedModelId = "";
5
+ try {
6
+ const res = await fetch("https://augment17-claude-code-backend.hf.space/health", {
7
+ headers: { "Authorization": `Bearer ${process.env.BACKEND_API_KEY}` },
8
+ next: { revalidate: 60 }
9
+ });
10
+ if (res.ok) {
11
+ const data = await res.json();
12
+ recommendedModelId = data.recommended_model || "";
13
+ }
14
+ } catch (error) {
15
+ console.error("Failed to fetch recommended model from backend:", error);
16
+ }
17
+
18
+ const apiNames: Record<string, string> = {
19
+ "Nemotron 3 Ultra 550B (Agentic)": "nvidia/nemotron-3-ultra-550b-a55b",
20
+ "GLM 5.1 (Agentic)": "z-ai/glm-5.1",
21
+ "Kimi K2.6 (Agentic)": "moonshotai/kimi-k2.6",
22
+ "MiniMax M3 (Agentic)": "minimaxai/minimax-m3",
23
+ "Step 3.7 Flash (Agentic)": "stepfun-ai/step-3.7-flash",
24
+ "MiniMax M2.7 (Agentic)": "minimaxai/minimax-m2.7",
25
+ "Llama 3.1 70B (Agentic)": "meta/llama-3.1-70b-instruct",
26
+ "Llama 3.1 405B (Agentic)": "meta/llama-3.1-405b-instruct",
27
+ "Qwen 2.5 Coder 32B (Agentic)": "qwen/qwen2.5-coder-32b-instruct",
28
+ "Nemotron 70B (Agentic)": "nvidia/llama-3.1-nemotron-70b-instruct",
29
+ "Llama 3.3 70B (Agentic)": "meta/llama-3.3-70b-instruct",
30
+ "DeepSeek R1 (Chat only)": "deepseek-ai/deepseek-r1",
31
+ "Mistral Large 2 (Chat only)": "mistralai/mistral-large-2-instruct",
32
+ };
33
+
34
+ const modelsInfo = customModelProvider.modelsInfo.map(providerInfo => {
35
+ if (providerInfo.provider === "Claude Code") {
36
+ return {
37
+ ...providerInfo,
38
+ models: providerInfo.models.map(model => {
39
+ const apiName = apiNames[model.name];
40
+ if (apiName && apiName === recommendedModelId) {
41
+ return {
42
+ ...model,
43
+ name: `${model.name} (Recommended)`
44
+ };
45
+ }
46
+ return model;
47
+ })
48
+ };
49
+ }
50
+ return providerInfo;
51
+ });
52
+
53
  return Response.json(
54
+ modelsInfo.sort((a, b) => {
55
  if (a.hasAPIKey && !b.hasAPIKey) return -1;
56
  if (!a.hasAPIKey && b.hasAPIKey) return 1;
57
  return 0;