{"repo": "chffhc/aigateway", "files": {"internal/db/seed.go": {"2daa4c5cec6eb3b0257c93283688d4aad0187eae": {"t": 1785746072.0810614, "n": 20217, "h": "c6a0523d73e92e6d", "c": "package db\n\nimport (\n\t\"log\"\n)\n\n// ProviderType represents the type of provider/endpoint\nconst (\n\tProviderTypeOpenAI = \"openai\"\n\tProviderTypeAnthropic = \"anthropic\"\n)\n\n// ProviderCategory distinguishes between regular API and coding plan\nconst (\n\tCategoryAPI = \"api\"\n\tCategoryCodingPlan = \"coding_plan\"\n)\n\n// ProviderPreset holds preset configuration for a provider endpoint\ntype ProviderPreset struct {\n\tName string `json:\"name\"`\n\tType string `json:\"type\"` // openai, anthropic\n\tCategory string `json:\"category\"` // api, coding_plan\n\tBaseURL string `json:\"base_url\"`\n\tRemark string `json:\"remark\"`\n\tPriority int `json:\"priority\"`\n}\n\n// GetAllPresets returns all preset provider configurations\nfunc GetAllPresets() []ProviderPreset {\n\treturn []ProviderPreset{\n\t\t// ===== OpenAI =====\n\t\t{\n\t\t\tName: \"openai-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.openai.com\",\n\t\t\tRemark: \"OpenAI 官方 API\", Priority: 100,\n\t\t},\n\n\t\t// ===== Anthropic =====\n\t\t{\n\t\t\tName: \"anthropic-official\", Type: ProviderTypeAnthropic, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.anthropic.com\",\n\t\t\tRemark: \"Anthropic 官方 API\", Priority: 100,\n\t\t},\n\n\t\t// ===== Google Gemini =====\n\t\t{\n\t\t\tName: \"google-gemini\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://generativelanguage.googleapis.com/v1beta/openai\",\n\t\t\tRemark: \"Google Gemini API (OpenAI 兼容)\", Priority: 100,\n\t\t},\n\n\t\t// ===== DeepSeek =====\n\t\t{\n\t\t\tName: \"deepseek-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.deepseek.com\",\n\t\t\tRemark: \"DeepSeek 官方 API(V4/V3.2)\", Priority: 100,\n\t\t},\n\n\t\t// ===== 阿里云百炼 - 通用 API =====\n\t\t{\n\t\t\tName: \"aliyun-dashscope\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n\t\t\tRemark: \"阿里云百炼 DashScope (按量付费)\", Priority: 100,\n\t\t},\n\t\t// ===== 阿里云百炼 - Coding Plan =====\n\t\t{\n\t\t\tName: \"aliyun-coding-openai\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://coding.dashscope.aliyuncs.com/v1\",\n\t\t\tRemark: \"阿里云百炼 Coding Plan (OpenAI 兼容) | Key 以 sk-sp- 开头\", Priority: 100,\n\t\t},\n\t\t{\n\t\t\tName: \"aliyun-coding-anthropic\", Type: ProviderTypeAnthropic, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://coding.dashscope.aliyuncs.com/apps/anthropic/v1\",\n\t\t\tRemark: \"阿里云百炼 Coding Plan (Anthropic 兼容) | Key 以 sk-sp- 开头\", Priority: 100,\n\t\t},\n\t\t// ===== 阿里云百炼 - Coding Plan 国际版 =====\n\t\t{\n\t\t\tName: \"aliyun-coding-intl-openai\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://coding-intl.dashscope.aliyuncs.com/v1\",\n\t\t\tRemark: \"阿里云百炼 Coding Plan 国际版 (OpenAI 兼容)\", Priority: 90,\n\t\t},\n\t\t{\n\t\t\tName: \"aliyun-coding-intl-anthropic\", Type: ProviderTypeAnthropic, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://coding-intl.dashscope.aliyuncs.com/apps/anthropic\",\n\t\t\tRemark: \"阿里云百炼 Coding Plan 国际版 (Anthropic 兼容)\", Priority: 90,\n\t\t},\n\n\t\t// ===== 智谱 AI - 通用 API =====\n\t\t{\n\t\t\tName: \"zhipu-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://open.bigmodel.cn/api/paas/v4\",\n\t\t\tRemark: \"智谱 AI 官方 API (按量付费)\", Priority: 100,\n\t\t},\n\t\t// ===== 智谱 AI - Coding Plan =====\n\t\t{\n\t\t\tName: \"zhipu-coding-openai\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://open.bigmodel.cn/api/coding/paas/v4\",\n\t\t\tRemark: \"智谱 Coding Plan (OpenAI 兼容) | 专属 Coding Key\", Priority: 100,\n\t\t},\n\t\t{\n\t\t\tName: \"zhipu-coding-anthropic\", Type: ProviderTypeAnthropic, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://open.bigmodel.cn/api/anthropic\",\n\t\t\tRemark: \"智谱 Coding Plan (Anthropic 兼容) | 专属 Coding Key\", Priority: 100,\n\t\t},\n\n\t\t// ===== Moonshot/Kimi - 通用 API =====\n\t\t{\n\t\t\tName: \"moonshot-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.moonshot.cn/v1\",\n\t\t\tRemark: \"Moonshot Kimi 官方 API (按量付费)\", Priority: 100,\n\t\t},\n\t\t// ===== Moonshot/Kimi - Coding Plan =====\n\t\t{\n\t\t\tName: \"kimi-coding\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://api.kimi.com/coding/v1\",\n\t\t\tRemark: \"Kimi Coding Plan | 专属 Coding Key\", Priority: 100,\n\t\t},\n\n\t\t// ===== MiniMax - 通用 API =====\n\t\t{\n\t\t\tName: \"minimax-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.minimax.chat/v1\",\n\t\t\tRemark: \"MiniMax 官方 API (按量付费)\", Priority: 100,\n\t\t},\n\t\t// ===== MiniMax - Coding Plan (Token Plan) =====\n\t\t{\n\t\t\tName: \"minimax-coding\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://api.minimax.chat/v1\",\n\t\t\tRemark: \"MiniMax Token Plan (Coding) | 同 Base URL,使用 Token Plan Key\", Priority: 100,\n\t\t},\n\n\t\t// ===== 小米 AI =====\n\t\t{\n\t\t\tName: \"xiaomi-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.xiaomi.com/v1\",\n\t\t\tRemark: \"小米 AI 官方 API\", Priority: 100,\n\t\t},\n\n\t\t// ===== Groq =====\n\t\t{\n\t\t\tName: \"groq-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.groq.com/openai/v1\",\n\t\t\tRemark: \"Groq 高速推理 API\", Priority: 90,\n\t\t},\n\n\t\t// ===== SiliconFlow =====\n\t\t{\n\t\t\tName: \"siliconflow\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.siliconflow.cn/v1\",\n\t\t\tRemark: \"SiliconFlow 聚合平台\", Priority: 90,\n\t\t},\n\n\t\t// ===== Together AI =====\n\t\t{\n\t\t\tName: \"together-ai\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.together.xyz/v1\",\n\t\t\tRemark: \"Together AI 聚合平台\", Priority: 80,\n\t\t},\n\n\t\t// ===== 自定义通用接口 =====\n\t\t{\n\t\t\tName: \"custom-openai\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://your-api.example.com/v1\",\n\t\t\tRemark: \"自定义 OpenAI 兼容接口\", Priority: 50,\n\t\t},\n\t\t{\n\t\t\tName: \"custom-anthropic\", Type: ProviderTypeAnthropic, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://your-api.example.com/v1\",\n\t\t\tRemark: \"自定义 Anthropic 兼容接口\", Priority: 50,\n\t\t},\n\t}\n}\n\n// SeedProviders inserts default provider configurations if none exist\nfunc SeedProviders() {\n\tvar count int64\n\tDB.Model(&ProviderConfig{}).Count(&count)\n\tif count > 0 {\n\t\tlog.Printf(\"Skipping provider seed: %d providers already exist\", count)\n\t\treturn\n\t}\n\n\tenabled := true\n\tpresets := GetAllPresets()\n\n\tfor _, p := range presets {\n\t\tprovider := ProviderConfig{\n\t\t\tName: p.Name,\n\t\t\tType: p.Type,\n\t\t\tCategory: p.Category,\n\t\t\tBaseURL: p.BaseURL,\n\t\t\tAPIKey: \"\",\n\t\t\tIsEnabled: &enabled,\n\t\t\tTimeout: 60,\n\t\t\tPriority: p.Priority,\n\t\t\tWeight: 1,\n\t\t\tRemark: p.Remark,\n\t\t}\n\t\tDB.Create(&provider)\n\t}\n\n\tlog.Printf(\"Seeded %d default providers (%d API, %d Coding Plan, %d Custom)\",\n\t\tlen(presets),\n\t\tcountByCategory(presets, CategoryAPI),\n\t\tcountByCategory(presets, CategoryCodingPlan),\n\t\tcountByCategory(presets, \"\")) // custom counted separately\n}\n\nfunc countByCategory(presets []ProviderPreset, cat string) int {\n\tcount := 0\n\tfor _, p := range presets {\n\t\tif cat == \"\" {\n\t\t\tif p.Priority == 50 {\n\t\t\t\tcount++\n\t\t\t}\n\t\t} else if p.Category == cat {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}\n\n// SeedModels inserts default model mappings if none exist\nfunc SeedModels() {\n\tvar count int64\n\tDB.Model(&ModelMapping{}).Count(&count)\n\tif count > 0 {\n\t\tlog.Printf(\"Skipping model seed: %d models already exist\", count)\n\t\treturn\n\t}\n\n\tenabled := true\n\n\t// Get provider IDs - only seed models for API category providers\n\tvar openaiID, anthropicID, deepseekID, geminiID, aliyunID, moonshotID, zhipuID, minimaxID, xiaomiID uint\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"openai-official\", CategoryAPI).Pluck(\"id\", &openaiID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"anthropic-official\", CategoryAPI).Pluck(\"id\", &anthropicID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"deepseek-official\", CategoryAPI).Pluck(\"id\", &deepseekID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"google-gemini\", CategoryAPI).Pluck(\"id\", &geminiID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"aliyun-dashscope\", CategoryAPI).Pluck(\"id\", &aliyunID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"moonshot-official\", CategoryAPI).Pluck(\"id\", &moonshotID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"zhipu-official\", CategoryAPI).Pluck(\"id\", &zhipuID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"minimax-official\", CategoryAPI).Pluck(\"id\", &minimaxID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"xiaomi-official\", CategoryAPI).Pluck(\"id\", &xiaomiID)\n\n\t// Also get coding plan provider IDs for model mapping\n\tvar aliyunCodingID, zhipuCodingID, kimiCodingID uint\n\tDB.Model(&ProviderConfig{}).Where(\"name = ?\", \"aliyun-coding-openai\").Pluck(\"id\", &aliyunCodingID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ?\", \"zhipu-coding-openai\").Pluck(\"id\", &zhipuCodingID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ?\", \"kimi-coding\").Pluck(\"id\", &kimiCodingID)\n\n\tmodels := []ModelMapping{\n\t\t// ===== OpenAI 模型 =====\n\t\t// GPT-5.5 系列(2026-04-24 最新发布)\n\t\t{Name: \"gpt-5.5\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.5\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.5-pro\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.5-pro\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.5-mini\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.5-mini\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.4\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.4\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.4-mini\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.4-mini\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.2\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.2\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.2-mini\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.2-mini\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"o3\", ProviderConfigID: openaiID, UpstreamModel: \"o3\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"o4-mini\", ProviderConfigID: openaiID, UpstreamModel: \"o4-mini\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-oss-120b\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-oss-120b\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-oss-20b\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-oss-20b\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== Anthropic Claude 模型 =====\n\t\t{Name: \"claude-sonnet-4-6\", ProviderConfigID: anthropicID, UpstreamModel: \"claude-sonnet-4-6\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"claude-opus-4-6\", ProviderConfigID: anthropicID, UpstreamModel: \"claude-opus-4-6\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"claude-opus-4-7\", ProviderConfigID: anthropicID, UpstreamModel: \"claude-opus-4-7\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"claude-haiku-4-5\", ProviderConfigID: anthropicID, UpstreamModel: \"claude-haiku-4-5\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== Google Gemini 模型 =====\n\t\t{Name: \"gemini-3.1-pro\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-3.1-pro-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-3.1-flash\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-3.1-flash-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-3.1-flash-lite\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-3.1-flash-lite-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-3-flash\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-3-flash-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-2.5-pro\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-2.5-pro\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-2.5-flash\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-2.5-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-2.5-flash-lite\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-2.5-flash-lite\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== DeepSeek 模型 =====\n\t\t// V4 系列(2026-04-24 最新发布)\n\t\t{Name: \"deepseek-v4-pro\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v4-pro\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"deepseek-v4-flash\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v4-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t// V3.2 系列(2026-07-24 废弃)\n\t\t{Name: \"deepseek-v3.2\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v3.2\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"deepseek-v3.2-speciale\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v3.2-speciale\", IsEnabled: &enabled, Weight: 1},\n\t\t// 兼容别名(即将废弃,映射到 V4 Flash)\n\t\t{Name: \"deepseek-chat\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v4-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"deepseek-reasoner\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v4-flash\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 阿里云百炼 Qwen 模型 (通用 API) =====\n\t\t{Name: \"qwen3.6-max-preview\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3.6-max-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3.6-plus\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3.6-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3.5-plus\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3.5-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-max\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-max\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-max-thinking\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-max-thinking\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-plus\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-flash\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3.6-flash\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3.6-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-coder\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-coder\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 阿里云百炼 Coding Plan 模型 =====\n\t\t{Name: \"qwen3-max\", ProviderConfigID: aliyunCodingID, UpstreamModel: \"qwen3-max\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3.6-plus\", ProviderConfigID: aliyunCodingID, UpstreamModel: \"qwen3.6-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-coder\", ProviderConfigID: aliyunCodingID, UpstreamModel: \"qwen3-coder\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== Moonshot Kimi 模型 (通用 API) =====\n\t\t{Name: \"kimi-k2\", ProviderConfigID: moonshotID, UpstreamModel: \"kimi-k2\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"kimi-k2-thinking\", ProviderConfigID: moonshotID, UpstreamModel: \"kimi-k2-thinking\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"kimi-k2-6\", ProviderConfigID: moonshotID, UpstreamModel: \"kimi-k2-6\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== Kimi Coding Plan 模型 =====\n\t\t{Name: \"kimi-for-coding\", ProviderConfigID: kimiCodingID, UpstreamModel: \"kimi-for-coding\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"kimi-k2-6\", ProviderConfigID: kimiCodingID, UpstreamModel: \"kimi-k2-6\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 智谱 GLM 模型 (通用 API) =====\n\t\t{Name: \"glm-5\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-5\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-5-flash\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-5-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-4-plus\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-4-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-4-flash\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-4-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-4v\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-4v\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 智谱 Coding Plan 模型 =====\n\t\t{Name: \"glm-5\", ProviderConfigID: zhipuCodingID, UpstreamModel: \"glm-5\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-5-flash\", ProviderConfigID: zhipuCodingID, UpstreamModel: \"glm-5-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-4-plus\", ProviderConfigID: zhipuCodingID, UpstreamModel: \"glm-4-plus\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== MiniMax 模型 =====\n\t\t{Name: \"minimax-m2.7\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2.7\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2.7-highspeed\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2.7-highspeed\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2.5\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2.5\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2.5-highspeed\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2.5-highspeed\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2-her\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2-her\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 小米 AI =====\n\t\t{Name: \"mimo\", ProviderConfigID: xiaomiID, UpstreamModel: \"mimo\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"mimo-v2\", ProviderConfigID: xiaomiID, UpstreamModel: \"mimo-v2\", IsEnabled: &enabled, Weight: 1},\n\t}\n\n\tfor _, m := range models {\n\t\tDB.Create(&m)\n\t}\n\n\tlog.Printf(\"Seeded %d default models\", len(models))\n}\n\n// SeedPrices inserts default model pricing if none exist\nfunc SeedPrices() {\n\tvar count int64\n\tDB.Model(&ModelPrice{}).Count(&count)\n\tif count > 0 {\n\t\tlog.Printf(\"Skipping price seed: %d prices already exist\", count)\n\t\treturn\n\t}\n\n\t// Pricing in USD per 1M tokens (approximate as of April 2026)\n\tprices := []ModelPrice{\n\t\t// OpenAI GPT-5.5 series\n\t\t{Model: \"gpt-5.5\", InputPerMillion: 2.50, OutputPerMillion: 15.00},\n\t\t{Model: \"gpt-5.5-pro\", InputPerMillion: 10.00, OutputPerMillion: 60.00},\n\t\t{Model: \"gpt-5.5-mini\", InputPerMillion: 0.25, OutputPerMillion: 1.50},\n\t\t{Model: \"gpt-5.4\", InputPerMillion: 1.25, OutputPerMillion: 10.00},\n\t\t{Model: \"gpt-5.4-mini\", InputPerMillion: 0.15, OutputPerMillion: 0.60},\n\t\t{Model: \"o3\", InputPerMillion: 10.00, OutputPerMillion: 40.00},\n\t\t{Model: \"o4-mini\", InputPerMillion: 1.10, OutputPerMillion: 4.40},\n\n\t\t// Anthropic Claude 4.x\n\t\t{Model: \"claude-sonnet-4-6\", InputPerMillion: 3.00, OutputPerMillion: 15.00},\n\t\t{Model: \"claude-opus-4-6\", InputPerMillion: 15.00, OutputPerMillion: 75.00},\n\t\t{Model: \"claude-opus-4-7\", InputPerMillion: 15.00, OutputPerMillion: 75.00},\n\t\t{Model: \"claude-haiku-4-5\", InputPerMillion: 0.80, OutputPerMillion: 4.00},\n\n\t\t// Google Gemini\n\t\t{Model: \"gemini-3.1-pro\", InputPerMillion: 1.25, OutputPerMillion: 10.00},\n\t\t{Model: \"gemini-3.1-flash\", InputPerMillion: 0.15, OutputPerMillion: 3.50},\n\t\t{Model: \"gemini-3.1-flash-lite\", InputPerMillion: 0.075, OutputPerMillion: 0.30},\n\t\t{Model: \"gemini-2.5-pro\", InputPerMillion: 1.25, OutputPerMillion: 10.00},\n\t\t{Model: \"gemini-2.5-flash\", InputPerMillion: 0.30, OutputPerMillion: 2.50},\n\n\t\t// DeepSeek V4 系列\n\t\t{Model: \"deepseek-v4-pro\", InputPerMillion: 1.74, OutputPerMillion: 3.48},\n\t\t{Model: \"deepseek-v4-flash\", InputPerMillion: 0.14, OutputPerMillion: 0.28},\n\t\t// DeepSeek V3.2 系列\n\t\t{Model: \"deepseek-v3.2\", InputPerMillion: 0.27, OutputPerMillion: 1.10},\n\t\t// 兼容别名(映射到 V4 Flash)\n\t\t{Model: \"deepseek-chat\", InputPerMillion: 0.14, OutputPerMillion: 0.28},\n\t\t{Model: \"deepseek-reasoner\", InputPerMillion: 0.14, OutputPerMillion: 0.28},\n\n\t\t// 阿里云百炼 Qwen\n\t\t{Model: \"qwen3.6-max-preview\", InputPerMillion: 1.60, OutputPerMillion: 6.40},\n\t\t{Model: \"qwen3.6-plus\", InputPerMillion: 0.40, OutputPerMillion: 1.20},\n\t\t{Model: \"qwen3-max\", InputPerMillion: 1.60, OutputPerMillion: 6.40},\n\t\t{Model: \"qwen3-flash\", InputPerMillion: 0.05, OutputPerMillion: 0.20},\n\t\t{Model: \"qwen3.6-flash\", InputPerMillion: 0.05, OutputPerMillion: 0.20},\n\t\t{Model: \"qwen3-coder\", InputPerMillion: 0.80, OutputPerMillion: 3.20},\n\n\t\t// Moonshot Kimi\n\t\t{Model: \"kimi-k2\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"kimi-k2-6\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"kimi-for-coding\", InputPerMillion: 0.30, OutputPerMillion: 1.20},\n\n\t\t// 智谱 GLM\n\t\t{Model: \"glm-5\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"glm-5-flash\", InputPerMillion: 0.10, OutputPerMillion: 0.40},\n\t\t{Model: \"glm-4-plus\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\n\t\t// MiniMax\n\t\t{Model: \"minimax-m2.7\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"minimax-m2.5\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"minimax-m2\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\n\t\t// 小米\n\t\t{Model: \"mimo\", InputPerMillion: 0.30, OutputPerMillion: 1.20},\n\t\t{Model: \"mimo-v2\", InputPerMillion: 0.30, OutputPerMillion: 1.20},\n\t}\n\n\tfor _, p := range prices {\n\t\tDB.Create(&p)\n\t}\n\n\tlog.Printf(\"Seeded %d default model prices\", len(prices))\n}\n"}, "aba13b5e1371f73ae00494432c9980f191c363fd": {"t": 1785759520.830983, "n": 20116, "h": "18fa36d16a3558ea", "c": "package db\n\nimport (\n\t\"log\"\n)\n\n// ProviderType represents the type of provider/endpoint\nconst (\n\tProviderTypeOpenAI = \"openai\"\n\tProviderTypeAnthropic = \"anthropic\"\n)\n\n// ProviderCategory distinguishes between regular API and coding plan\nconst (\n\tCategoryAPI = \"api\"\n\tCategoryCodingPlan = \"coding_plan\"\n)\n\n// ProviderPreset holds preset configuration for a provider endpoint\ntype ProviderPreset struct {\n\tName string\n\tType string // openai, anthropic\n\tCategory string // api, coding_plan\n\tBaseURL string\n\tRemark string\n\tPriority int\n}\n\n// GetAllPresets returns all preset provider configurations\nfunc GetAllPresets() []ProviderPreset {\n\treturn []ProviderPreset{\n\t\t// ===== OpenAI =====\n\t\t{\n\t\t\tName: \"openai-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.openai.com\",\n\t\t\tRemark: \"OpenAI 官方 API\", Priority: 100,\n\t\t},\n\n\t\t// ===== Anthropic =====\n\t\t{\n\t\t\tName: \"anthropic-official\", Type: ProviderTypeAnthropic, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.anthropic.com\",\n\t\t\tRemark: \"Anthropic 官方 API\", Priority: 100,\n\t\t},\n\n\t\t// ===== Google Gemini =====\n\t\t{\n\t\t\tName: \"google-gemini\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://generativelanguage.googleapis.com/v1beta/openai\",\n\t\t\tRemark: \"Google Gemini API (OpenAI 兼容)\", Priority: 100,\n\t\t},\n\n\t\t// ===== DeepSeek =====\n\t\t{\n\t\t\tName: \"deepseek-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.deepseek.com\",\n\t\t\tRemark: \"DeepSeek 官方 API(V4/V3.2)\", Priority: 100,\n\t\t},\n\n\t\t// ===== 阿里云百炼 - 通用 API =====\n\t\t{\n\t\t\tName: \"aliyun-dashscope\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n\t\t\tRemark: \"阿里云百炼 DashScope (按量付费)\", Priority: 100,\n\t\t},\n\t\t// ===== 阿里云百炼 - Coding Plan =====\n\t\t{\n\t\t\tName: \"aliyun-coding-openai\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://coding.dashscope.aliyuncs.com/v1\",\n\t\t\tRemark: \"阿里云百炼 Coding Plan (OpenAI 兼容) | Key 以 sk-sp- 开头\", Priority: 100,\n\t\t},\n\t\t{\n\t\t\tName: \"aliyun-coding-anthropic\", Type: ProviderTypeAnthropic, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://coding.dashscope.aliyuncs.com/apps/anthropic/v1\",\n\t\t\tRemark: \"阿里云百炼 Coding Plan (Anthropic 兼容) | Key 以 sk-sp- 开头\", Priority: 100,\n\t\t},\n\t\t// ===== 阿里云百炼 - Coding Plan 国际版 =====\n\t\t{\n\t\t\tName: \"aliyun-coding-intl-openai\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://coding-intl.dashscope.aliyuncs.com/v1\",\n\t\t\tRemark: \"阿里云百炼 Coding Plan 国际版 (OpenAI 兼容)\", Priority: 90,\n\t\t},\n\t\t{\n\t\t\tName: \"aliyun-coding-intl-anthropic\", Type: ProviderTypeAnthropic, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://coding-intl.dashscope.aliyuncs.com/apps/anthropic\",\n\t\t\tRemark: \"阿里云百炼 Coding Plan 国际版 (Anthropic 兼容)\", Priority: 90,\n\t\t},\n\n\t\t// ===== 智谱 AI - 通用 API =====\n\t\t{\n\t\t\tName: \"zhipu-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://open.bigmodel.cn/api/paas/v4\",\n\t\t\tRemark: \"智谱 AI 官方 API (按量付费)\", Priority: 100,\n\t\t},\n\t\t// ===== 智谱 AI - Coding Plan =====\n\t\t{\n\t\t\tName: \"zhipu-coding-openai\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://open.bigmodel.cn/api/coding/paas/v4\",\n\t\t\tRemark: \"智谱 Coding Plan (OpenAI 兼容) | 专属 Coding Key\", Priority: 100,\n\t\t},\n\t\t{\n\t\t\tName: \"zhipu-coding-anthropic\", Type: ProviderTypeAnthropic, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://open.bigmodel.cn/api/anthropic\",\n\t\t\tRemark: \"智谱 Coding Plan (Anthropic 兼容) | 专属 Coding Key\", Priority: 100,\n\t\t},\n\n\t\t// ===== Moonshot/Kimi - 通用 API =====\n\t\t{\n\t\t\tName: \"moonshot-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.moonshot.cn/v1\",\n\t\t\tRemark: \"Moonshot Kimi 官方 API (按量付费)\", Priority: 100,\n\t\t},\n\t\t// ===== Moonshot/Kimi - Coding Plan =====\n\t\t{\n\t\t\tName: \"kimi-coding\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://api.kimi.com/coding/v1\",\n\t\t\tRemark: \"Kimi Coding Plan | 专属 Coding Key\", Priority: 100,\n\t\t},\n\n\t\t// ===== MiniMax - 通用 API =====\n\t\t{\n\t\t\tName: \"minimax-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.minimax.chat/v1\",\n\t\t\tRemark: \"MiniMax 官方 API (按量付费)\", Priority: 100,\n\t\t},\n\t\t// ===== MiniMax - Coding Plan (Token Plan) =====\n\t\t{\n\t\t\tName: \"minimax-coding\", Type: ProviderTypeOpenAI, Category: CategoryCodingPlan,\n\t\t\tBaseURL: \"https://api.minimax.chat/v1\",\n\t\t\tRemark: \"MiniMax Token Plan (Coding) | 同 Base URL,使用 Token Plan Key\", Priority: 100,\n\t\t},\n\n\t\t// ===== 小米 AI =====\n\t\t{\n\t\t\tName: \"xiaomi-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.xiaomi.com/v1\",\n\t\t\tRemark: \"小米 AI 官方 API\", Priority: 100,\n\t\t},\n\n\t\t// ===== Groq =====\n\t\t{\n\t\t\tName: \"groq-official\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.groq.com/openai/v1\",\n\t\t\tRemark: \"Groq 高速推理 API\", Priority: 90,\n\t\t},\n\n\t\t// ===== SiliconFlow =====\n\t\t{\n\t\t\tName: \"siliconflow\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.siliconflow.cn/v1\",\n\t\t\tRemark: \"SiliconFlow 聚合平台\", Priority: 90,\n\t\t},\n\n\t\t// ===== Together AI =====\n\t\t{\n\t\t\tName: \"together-ai\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://api.together.xyz/v1\",\n\t\t\tRemark: \"Together AI 聚合平台\", Priority: 80,\n\t\t},\n\n\t\t// ===== 自定义通用接口 =====\n\t\t{\n\t\t\tName: \"custom-openai\", Type: ProviderTypeOpenAI, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://your-api.example.com/v1\",\n\t\t\tRemark: \"自定义 OpenAI 兼容接口\", Priority: 50,\n\t\t},\n\t\t{\n\t\t\tName: \"custom-anthropic\", Type: ProviderTypeAnthropic, Category: CategoryAPI,\n\t\t\tBaseURL: \"https://your-api.example.com/v1\",\n\t\t\tRemark: \"自定义 Anthropic 兼容接口\", Priority: 50,\n\t\t},\n\t}\n}\n\n// SeedProviders inserts default provider configurations if none exist\nfunc SeedProviders() {\n\tvar count int64\n\tDB.Model(&ProviderConfig{}).Count(&count)\n\tif count > 0 {\n\t\tlog.Printf(\"Skipping provider seed: %d providers already exist\", count)\n\t\treturn\n\t}\n\n\tenabled := true\n\tpresets := GetAllPresets()\n\n\tfor _, p := range presets {\n\t\tprovider := ProviderConfig{\n\t\t\tName: p.Name,\n\t\t\tType: p.Type,\n\t\t\tCategory: p.Category,\n\t\t\tBaseURL: p.BaseURL,\n\t\t\tAPIKey: \"\",\n\t\t\tIsEnabled: &enabled,\n\t\t\tTimeout: 60,\n\t\t\tPriority: p.Priority,\n\t\t\tWeight: 1,\n\t\t\tRemark: p.Remark,\n\t\t}\n\t\tDB.Create(&provider)\n\t}\n\n\tlog.Printf(\"Seeded %d default providers (%d API, %d Coding Plan, %d Custom)\",\n\t\tlen(presets),\n\t\tcountByCategory(presets, CategoryAPI),\n\t\tcountByCategory(presets, CategoryCodingPlan),\n\t\tcountByCategory(presets, \"\")) // custom counted separately\n}\n\nfunc countByCategory(presets []ProviderPreset, cat string) int {\n\tcount := 0\n\tfor _, p := range presets {\n\t\tif cat == \"\" {\n\t\t\tif p.Priority == 50 {\n\t\t\t\tcount++\n\t\t\t}\n\t\t} else if p.Category == cat {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}\n\n// SeedModels inserts default model mappings if none exist\nfunc SeedModels() {\n\tvar count int64\n\tDB.Model(&ModelMapping{}).Count(&count)\n\tif count > 0 {\n\t\tlog.Printf(\"Skipping model seed: %d models already exist\", count)\n\t\treturn\n\t}\n\n\tenabled := true\n\n\t// Get provider IDs - only seed models for API category providers\n\tvar openaiID, anthropicID, deepseekID, geminiID, aliyunID, moonshotID, zhipuID, minimaxID, xiaomiID uint\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"openai-official\", CategoryAPI).Pluck(\"id\", &openaiID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"anthropic-official\", CategoryAPI).Pluck(\"id\", &anthropicID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"deepseek-official\", CategoryAPI).Pluck(\"id\", &deepseekID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"google-gemini\", CategoryAPI).Pluck(\"id\", &geminiID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"aliyun-dashscope\", CategoryAPI).Pluck(\"id\", &aliyunID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"moonshot-official\", CategoryAPI).Pluck(\"id\", &moonshotID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"zhipu-official\", CategoryAPI).Pluck(\"id\", &zhipuID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"minimax-official\", CategoryAPI).Pluck(\"id\", &minimaxID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ? AND category = ?\", \"xiaomi-official\", CategoryAPI).Pluck(\"id\", &xiaomiID)\n\n\t// Also get coding plan provider IDs for model mapping\n\tvar aliyunCodingID, zhipuCodingID, kimiCodingID uint\n\tDB.Model(&ProviderConfig{}).Where(\"name = ?\", \"aliyun-coding-openai\").Pluck(\"id\", &aliyunCodingID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ?\", \"zhipu-coding-openai\").Pluck(\"id\", &zhipuCodingID)\n\tDB.Model(&ProviderConfig{}).Where(\"name = ?\", \"kimi-coding\").Pluck(\"id\", &kimiCodingID)\n\n\tmodels := []ModelMapping{\n\t\t// ===== OpenAI 模型 =====\n\t\t// GPT-5.5 系列(2026-04-24 最新发布)\n\t\t{Name: \"gpt-5.5\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.5\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.5-pro\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.5-pro\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.5-mini\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.5-mini\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.4\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.4\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.4-mini\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.4-mini\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.2\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.2\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-5.2-mini\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-5.2-mini\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"o3\", ProviderConfigID: openaiID, UpstreamModel: \"o3\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"o4-mini\", ProviderConfigID: openaiID, UpstreamModel: \"o4-mini\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-oss-120b\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-oss-120b\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gpt-oss-20b\", ProviderConfigID: openaiID, UpstreamModel: \"gpt-oss-20b\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== Anthropic Claude 模型 =====\n\t\t{Name: \"claude-sonnet-4-6\", ProviderConfigID: anthropicID, UpstreamModel: \"claude-sonnet-4-6\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"claude-opus-4-6\", ProviderConfigID: anthropicID, UpstreamModel: \"claude-opus-4-6\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"claude-opus-4-7\", ProviderConfigID: anthropicID, UpstreamModel: \"claude-opus-4-7\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"claude-haiku-4-5\", ProviderConfigID: anthropicID, UpstreamModel: \"claude-haiku-4-5\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== Google Gemini 模型 =====\n\t\t{Name: \"gemini-3.1-pro\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-3.1-pro-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-3.1-flash\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-3.1-flash-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-3.1-flash-lite\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-3.1-flash-lite-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-3-flash\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-3-flash-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-2.5-pro\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-2.5-pro\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-2.5-flash\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-2.5-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"gemini-2.5-flash-lite\", ProviderConfigID: geminiID, UpstreamModel: \"gemini-2.5-flash-lite\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== DeepSeek 模型 =====\n\t\t// V4 系列(2026-04-24 最新发布)\n\t\t{Name: \"deepseek-v4-pro\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v4-pro\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"deepseek-v4-flash\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v4-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t// V3.2 系列(2026-07-24 废弃)\n\t\t{Name: \"deepseek-v3.2\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v3.2\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"deepseek-v3.2-speciale\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v3.2-speciale\", IsEnabled: &enabled, Weight: 1},\n\t\t// 兼容别名(即将废弃,映射到 V4 Flash)\n\t\t{Name: \"deepseek-chat\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v4-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"deepseek-reasoner\", ProviderConfigID: deepseekID, UpstreamModel: \"deepseek-v4-flash\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 阿里云百炼 Qwen 模型 (通用 API) =====\n\t\t{Name: \"qwen3.6-max-preview\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3.6-max-preview\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3.6-plus\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3.6-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3.5-plus\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3.5-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-max\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-max\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-max-thinking\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-max-thinking\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-plus\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-flash\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3.6-flash\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3.6-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-coder\", ProviderConfigID: aliyunID, UpstreamModel: \"qwen3-coder\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 阿里云百炼 Coding Plan 模型 =====\n\t\t{Name: \"qwen3-max\", ProviderConfigID: aliyunCodingID, UpstreamModel: \"qwen3-max\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3.6-plus\", ProviderConfigID: aliyunCodingID, UpstreamModel: \"qwen3.6-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"qwen3-coder\", ProviderConfigID: aliyunCodingID, UpstreamModel: \"qwen3-coder\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== Moonshot Kimi 模型 (通用 API) =====\n\t\t{Name: \"kimi-k2\", ProviderConfigID: moonshotID, UpstreamModel: \"kimi-k2\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"kimi-k2-thinking\", ProviderConfigID: moonshotID, UpstreamModel: \"kimi-k2-thinking\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"kimi-k2-6\", ProviderConfigID: moonshotID, UpstreamModel: \"kimi-k2-6\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== Kimi Coding Plan 模型 =====\n\t\t{Name: \"kimi-for-coding\", ProviderConfigID: kimiCodingID, UpstreamModel: \"kimi-for-coding\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"kimi-k2-6\", ProviderConfigID: kimiCodingID, UpstreamModel: \"kimi-k2-6\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 智谱 GLM 模型 (通用 API) =====\n\t\t{Name: \"glm-5\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-5\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-5-flash\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-5-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-4-plus\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-4-plus\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-4-flash\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-4-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-4v\", ProviderConfigID: zhipuID, UpstreamModel: \"glm-4v\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 智谱 Coding Plan 模型 =====\n\t\t{Name: \"glm-5\", ProviderConfigID: zhipuCodingID, UpstreamModel: \"glm-5\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-5-flash\", ProviderConfigID: zhipuCodingID, UpstreamModel: \"glm-5-flash\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"glm-4-plus\", ProviderConfigID: zhipuCodingID, UpstreamModel: \"glm-4-plus\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== MiniMax 模型 =====\n\t\t{Name: \"minimax-m2.7\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2.7\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2.7-highspeed\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2.7-highspeed\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2.5\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2.5\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2.5-highspeed\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2.5-highspeed\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"minimax-m2-her\", ProviderConfigID: minimaxID, UpstreamModel: \"minimax-m2-her\", IsEnabled: &enabled, Weight: 1},\n\n\t\t// ===== 小米 AI =====\n\t\t{Name: \"mimo\", ProviderConfigID: xiaomiID, UpstreamModel: \"mimo\", IsEnabled: &enabled, Weight: 1},\n\t\t{Name: \"mimo-v2\", ProviderConfigID: xiaomiID, UpstreamModel: \"mimo-v2\", IsEnabled: &enabled, Weight: 1},\n\t}\n\n\tfor _, m := range models {\n\t\tDB.Create(&m)\n\t}\n\n\tlog.Printf(\"Seeded %d default models\", len(models))\n}\n\n// SeedPrices inserts default model pricing if none exist\nfunc SeedPrices() {\n\tvar count int64\n\tDB.Model(&ModelPrice{}).Count(&count)\n\tif count > 0 {\n\t\tlog.Printf(\"Skipping price seed: %d prices already exist\", count)\n\t\treturn\n\t}\n\n\t// Pricing in USD per 1M tokens (approximate as of April 2026)\n\tprices := []ModelPrice{\n\t\t// OpenAI GPT-5.5 series\n\t\t{Model: \"gpt-5.5\", InputPerMillion: 2.50, OutputPerMillion: 15.00},\n\t\t{Model: \"gpt-5.5-pro\", InputPerMillion: 10.00, OutputPerMillion: 60.00},\n\t\t{Model: \"gpt-5.5-mini\", InputPerMillion: 0.25, OutputPerMillion: 1.50},\n\t\t{Model: \"gpt-5.4\", InputPerMillion: 1.25, OutputPerMillion: 10.00},\n\t\t{Model: \"gpt-5.4-mini\", InputPerMillion: 0.15, OutputPerMillion: 0.60},\n\t\t{Model: \"o3\", InputPerMillion: 10.00, OutputPerMillion: 40.00},\n\t\t{Model: \"o4-mini\", InputPerMillion: 1.10, OutputPerMillion: 4.40},\n\n\t\t// Anthropic Claude 4.x\n\t\t{Model: \"claude-sonnet-4-6\", InputPerMillion: 3.00, OutputPerMillion: 15.00},\n\t\t{Model: \"claude-opus-4-6\", InputPerMillion: 15.00, OutputPerMillion: 75.00},\n\t\t{Model: \"claude-opus-4-7\", InputPerMillion: 15.00, OutputPerMillion: 75.00},\n\t\t{Model: \"claude-haiku-4-5\", InputPerMillion: 0.80, OutputPerMillion: 4.00},\n\n\t\t// Google Gemini\n\t\t{Model: \"gemini-3.1-pro\", InputPerMillion: 1.25, OutputPerMillion: 10.00},\n\t\t{Model: \"gemini-3.1-flash\", InputPerMillion: 0.15, OutputPerMillion: 3.50},\n\t\t{Model: \"gemini-3.1-flash-lite\", InputPerMillion: 0.075, OutputPerMillion: 0.30},\n\t\t{Model: \"gemini-2.5-pro\", InputPerMillion: 1.25, OutputPerMillion: 10.00},\n\t\t{Model: \"gemini-2.5-flash\", InputPerMillion: 0.30, OutputPerMillion: 2.50},\n\n\t\t// DeepSeek V4 系列\n\t\t{Model: \"deepseek-v4-pro\", InputPerMillion: 1.74, OutputPerMillion: 3.48},\n\t\t{Model: \"deepseek-v4-flash\", InputPerMillion: 0.14, OutputPerMillion: 0.28},\n\t\t// DeepSeek V3.2 系列\n\t\t{Model: \"deepseek-v3.2\", InputPerMillion: 0.27, OutputPerMillion: 1.10},\n\t\t// 兼容别名(映射到 V4 Flash)\n\t\t{Model: \"deepseek-chat\", InputPerMillion: 0.14, OutputPerMillion: 0.28},\n\t\t{Model: \"deepseek-reasoner\", InputPerMillion: 0.14, OutputPerMillion: 0.28},\n\n\t\t// 阿里云百炼 Qwen\n\t\t{Model: \"qwen3.6-max-preview\", InputPerMillion: 1.60, OutputPerMillion: 6.40},\n\t\t{Model: \"qwen3.6-plus\", InputPerMillion: 0.40, OutputPerMillion: 1.20},\n\t\t{Model: \"qwen3-max\", InputPerMillion: 1.60, OutputPerMillion: 6.40},\n\t\t{Model: \"qwen3-flash\", InputPerMillion: 0.05, OutputPerMillion: 0.20},\n\t\t{Model: \"qwen3.6-flash\", InputPerMillion: 0.05, OutputPerMillion: 0.20},\n\t\t{Model: \"qwen3-coder\", InputPerMillion: 0.80, OutputPerMillion: 3.20},\n\n\t\t// Moonshot Kimi\n\t\t{Model: \"kimi-k2\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"kimi-k2-6\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"kimi-for-coding\", InputPerMillion: 0.30, OutputPerMillion: 1.20},\n\n\t\t// 智谱 GLM\n\t\t{Model: \"glm-5\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"glm-5-flash\", InputPerMillion: 0.10, OutputPerMillion: 0.40},\n\t\t{Model: \"glm-4-plus\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\n\t\t// MiniMax\n\t\t{Model: \"minimax-m2.7\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"minimax-m2.5\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\t\t{Model: \"minimax-m2\", InputPerMillion: 0.50, OutputPerMillion: 2.00},\n\n\t\t// 小米\n\t\t{Model: \"mimo\", InputPerMillion: 0.30, OutputPerMillion: 1.20},\n\t\t{Model: \"mimo-v2\", InputPerMillion: 0.30, OutputPerMillion: 1.20},\n\t}\n\n\tfor _, p := range prices {\n\t\tDB.Create(&p)\n\t}\n\n\tlog.Printf(\"Seeded %d default model prices\", len(prices))\n}\n"}}}}