list_models
Discover available AI models on Crazyrouter by filtering categories like chat, image, video, audio, or music to find the right model for your task.
Instructions
List available AI models on Crazyrouter. Filter by category: chat, image, video, audio, or music.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter models by category. Options: chat, image, video, audio, music. Omit to show all categories. |
Implementation Reference
- src/index.ts:188-229 (handler)The registration and handler implementation for the `list_models` tool.
// --- Tool: list_models --- server.tool( "list_models", "List available AI models on Crazyrouter. Filter by category: chat, image, video, audio, or music.", { category: z .enum(["chat", "image", "video", "audio", "music"]) .optional() .describe("Filter models by category. Options: chat, image, video, audio, music. Omit to show all categories."), }, async ({ category }) => { try { let liveModels: string[] = []; try { const result = (await apiRequest("/models")) as { data?: Array<{ id: string; owned_by?: string }> }; if (result.data) liveModels = result.data.map((m) => m.id); } catch { /* fall back to local list */ } let output = ""; if (category) { const models = MODEL_CATEGORIES[category] ?? []; output = `## ${category.charAt(0).toUpperCase() + category.slice(1)} Models\n\n`; output += models.map((m) => `- ${m}`).join("\n"); output += `\n\nTotal: ${models.length} models listed (${liveModels.length > 0 ? liveModels.length + " total available via API" : "627+ total available"})`; } else { output = "## Available Model Categories\n\n"; for (const [cat, models] of Object.entries(MODEL_CATEGORIES)) { const emoji = cat === "chat" ? "π¬" : cat === "image" ? "π¨" : cat === "video" ? "π¬" : cat === "audio" ? "π£οΈ" : "π΅"; output += `### ${emoji} ${cat.charAt(0).toUpperCase() + cat.slice(1)} (${models.length} listed)\n`; output += models.map((m) => `- ${m}`).join("\n"); output += "\n\n"; } output += `---\nπ Total: 627+ models available on Crazyrouter\nπ Full list: https://crazyrouter.com/models`; } return { content: [{ type: "text" as const, text: output }] }; } catch (error) { const message = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true }; } } );