Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions apps/dokploy/server/api/routers/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,80 @@ export const aiRouter = createTRPCRouter({
owned_by: "perplexity",
},
] as Model[];
case "zai":
// Z.AI doesn't have a /models endpoint, return hardcoded list
return [
{
id: "glm-4-plus",
object: "model",
created: Date.now(),
owned_by: "zai",
},
{
id: "glm-4-flash",
object: "model",
created: Date.now(),
owned_by: "zai",
},
{
id: "glm-4",
object: "model",
created: Date.now(),
owned_by: "zai",
},
{
id: "glm-4-air",
object: "model",
created: Date.now(),
owned_by: "zai",
},
{
id: "glm-4-air-long",
object: "model",
created: Date.now(),
owned_by: "zai",
},
{
id: "glm-3-turbo",
object: "model",
created: Date.now(),
owned_by: "zai",
},
] as Model[];
case "minimax":
// MiniMax doesn't have a /models endpoint, return hardcoded list
return [
{
id: "MiniMax-M2.5",
object: "model",
created: Date.now(),
owned_by: "minimax",
},
{
id: "MiniMax-M2.5-highspeed",
object: "model",
created: Date.now(),
owned_by: "minimax",
},
{
id: "MiniMax-M2.1",
object: "model",
created: Date.now(),
owned_by: "minimax",
},
{
id: "MiniMax-M2.1-highspeed",
object: "model",
created: Date.now(),
owned_by: "minimax",
},
{
id: "MiniMax-M2",
object: "model",
created: Date.now(),
owned_by: "minimax",
},
] as Model[];
default:
if (!input.apiKey)
throw new TRPCError({
Expand Down
18 changes: 18 additions & 0 deletions packages/server/src/utils/ai/select-ai-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export function getProviderName(apiUrl: string) {
if (apiUrl.includes(":11434") || apiUrl.includes("ollama")) return "ollama";
if (apiUrl.includes("api.deepinfra.com")) return "deepinfra";
if (apiUrl.includes("generativelanguage.googleapis.com")) return "gemini";
if (apiUrl.includes("api.z.ai")) return "zai";
if (apiUrl.includes("api.minimax.io")) return "minimax";
return "custom";
}

Expand Down Expand Up @@ -75,6 +77,22 @@ export function selectAIProvider(config: { apiUrl: string; apiKey: string }) {
Authorization: `Bearer ${config.apiKey}`,
},
});
case "zai":
return createOpenAICompatible({
name: "zai",
baseURL: config.apiUrl,
headers: {
Authorization: `Bearer ${config.apiKey}`,
},
});
case "minimax":
return createOpenAICompatible({
name: "minimax",
baseURL: config.apiUrl,
headers: {
Authorization: `Bearer ${config.apiKey}`,
},
});
case "custom":
return createOpenAICompatible({
name: "custom",
Expand Down