//go:build llm_script package main import ( "fmt" "regexp" "strings" ) const default360PricingURL = "https://ai.360.com/open/models" var platform360CardPattern = regexp.MustCompile(`(?s)([A-Za-z0-9._/-]+)\n([^\n]+)\n.*?(?:输入价格|Input Price)\s*:\s*¥([\d.]+)\s*/\s*1M tokens.*?(?:输出价格|Output Price)\s*:\s*¥([\d.]+)\s*/\s*1M tokens.*?(?:上下文|Context)\s*:\s*([\d,]+)`) func parse360PricingCatalog(raw string) ([]officialPricingRecord, error) { matches := platform360CardPattern.FindAllStringSubmatch(raw, -1) if len(matches) == 0 { return nil, fmt.Errorf("unexpected 360 pricing content") } records := make([]officialPricingRecord, 0, len(matches)) for _, match := range matches { modelName := strings.TrimSpace(match[1]) providerName := normalize360Provider(match[2], modelName) providerNameCn, providerCountry, providerWebsite := providerMetadata(providerName) record := officialPricingRecord{ ModelID: normalizeExternalID("360", modelName), ModelName: modelName, ProviderName: providerName, ProviderNameCn: providerNameCn, ProviderCountry: providerCountry, ProviderWebsite: providerWebsite, OperatorName: "360 Open Platform", OperatorNameCn: "360 智脑开放平台", OperatorCountry: "CN", OperatorWebsite: "https://ai.360.com", OperatorType: "relay", Region: "CN", Currency: "CNY", InputPrice: mustParseSubscriptionPrice(match[3]), OutputPrice: mustParseSubscriptionPrice(match[4]), ContextLength: parseContextLengthCommon(match[5]), SourceURL: default360PricingURL, ModelSourceURL: default360PricingURL, DateConfidence: "unknown", DateSourceKind: "official_product_page", Modality: detectModality(modelName), } record.IsFree = record.InputPrice == 0 && record.OutputPrice == 0 records = append(records, record) } return records, nil } func normalize360Provider(raw string, modelName string) string { switch strings.ToLower(strings.TrimSpace(raw)) { case "deepseek", "深度求索": return "DeepSeek" case "moonshot ai", "月之暗面": return "Moonshot AI" case "qwen", "阿里巴巴", "通义千问": return "Qwen" case "zhipu", "智谱": return "Zhipu AI" case "字节跳动": return "ByteDance" case "360智脑": return "360" default: providerByPath := providerFromModelPath(modelName) if providerByPath != "unknown" { return providerByPath } return strings.TrimSpace(raw) } }