Update Longcat presets to LongCat-2.0 (#4838)

* Update Longcat presets to LongCat-2.0

* fix(proxy): classify LongCat-2.0 as text-only for media sanitizer

The Longcat presets now use LongCat-2.0, but the known_text_only_model
allowlist still only matched the retired longcat-flash-chat tail. Without
this, images pasted into a text-only LongCat-2.0 session are forwarded
upstream instead of being replaced with the unsupported-image marker,
causing a hard rejection. Add longcat-2.0 (keeping the retired name for
saved configs) and a regression test.

---------

Co-authored-by: chengzifeng <chengzifeng@meituan.com>
Co-authored-by: Jason <farion1231@gmail.com>
This commit is contained in:
Cheng Zi Feng
2026-07-04 16:38:35 +08:00
committed by GitHub
parent 0cda8d46c7
commit 7a8b956253
11 changed files with 195 additions and 29 deletions
+1 -5
View File
@@ -577,11 +577,7 @@ export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [
baseUrl: "https://api.longcat.chat/anthropic",
mode: "proxy",
apiFormat: "anthropic",
modelRoutes: brandedRoutes(
"LongCat-Flash-Chat",
"LongCat-Flash-Chat",
"LongCat-Flash-Chat",
),
modelRoutes: brandedRoutes("LongCat-2.0", "LongCat-2.0", "LongCat-2.0"),
icon: "longcat",
iconColor: "#29E154",
},
+6 -5
View File
@@ -587,11 +587,12 @@ export const providerPresets: ProviderPreset[] = [
env: {
ANTHROPIC_BASE_URL: "https://api.longcat.chat/anthropic",
ANTHROPIC_AUTH_TOKEN: "",
ANTHROPIC_MODEL: "LongCat-Flash-Chat",
ANTHROPIC_DEFAULT_HAIKU_MODEL: "LongCat-Flash-Chat",
ANTHROPIC_DEFAULT_SONNET_MODEL: "LongCat-Flash-Chat",
ANTHROPIC_DEFAULT_OPUS_MODEL: "LongCat-Flash-Chat",
CLAUDE_CODE_MAX_OUTPUT_TOKENS: "6000",
ANTHROPIC_MODEL: "LongCat-2.0",
ANTHROPIC_SMALL_FAST_MODEL: "LongCat-2.0",
ANTHROPIC_DEFAULT_HAIKU_MODEL: "LongCat-2.0",
ANTHROPIC_DEFAULT_SONNET_MODEL: "LongCat-2.0",
ANTHROPIC_DEFAULT_OPUS_MODEL: "LongCat-2.0",
CLAUDE_CODE_MAX_OUTPUT_TOKENS: "131072",
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: 1,
},
},
+3 -3
View File
@@ -723,7 +723,7 @@ requires_openai_auth = true`,
config: generateThirdPartyConfig(
"longcat",
"https://api.longcat.chat/openai/v1",
"LongCat-2.0-Preview",
"LongCat-2.0",
),
endpointCandidates: ["https://api.longcat.chat/openai/v1"],
// 美团 LongCat 官方 Codex 文档用 wire_api=responses 对自家 base_url,原生 Responses,无需路由接管转换
@@ -732,8 +732,8 @@ requires_openai_auth = true`,
// 注:LongCat 的 /responses 工具类型契约文档化程度最低,建议真机冒烟一次
modelCatalog: modelCatalog([
{
model: "LongCat-2.0-Preview",
displayName: "LongCat 2.0 Preview",
model: "LongCat-2.0",
displayName: "LongCat 2.0",
contextWindow: 1048576,
},
]),
+2 -2
View File
@@ -779,13 +779,13 @@ export const hermesProviderPresets: HermesProviderPreset[] = [
base_url: "https://api.longcat.chat/openai/v1",
api_key: "",
api_mode: "chat_completions",
models: [{ id: "LongCat-Flash-Chat", name: "LongCat Flash Chat" }],
models: [{ id: "LongCat-2.0", name: "LongCat 2.0" }],
},
category: "cn_official",
icon: "longcat",
iconColor: "#29E154",
suggestedDefaults: {
model: { default: "LongCat-Flash-Chat", provider: "longcat" },
model: { default: "LongCat-2.0", provider: "longcat" },
},
},
{
+12 -8
View File
@@ -1068,15 +1068,19 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
websiteUrl: "https://longcat.chat/platform",
apiKeyUrl: "https://longcat.chat/platform/api_keys",
settingsConfig: {
baseUrl: "https://api.longcat.chat/v1",
baseUrl: "https://api.longcat.chat/openai/v1",
apiKey: "",
api: "openai-completions",
authHeader: true,
models: [
{
id: "LongCat-Flash-Chat",
name: "LongCat Flash Chat",
contextWindow: 128000,
id: "LongCat-2.0",
name: "LongCat 2.0",
reasoning: false,
input: ["text"],
contextWindow: 1048576,
maxTokens: 131072,
compat: { maxTokensField: "max_tokens" },
cost: { input: 0.001, output: 0.004 },
},
],
@@ -1087,8 +1091,8 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
templateValues: {
baseUrl: {
label: "Base URL",
placeholder: "https://api.longcat.chat/v1",
defaultValue: "https://api.longcat.chat/v1",
placeholder: "https://api.longcat.chat/openai/v1",
defaultValue: "https://api.longcat.chat/openai/v1",
editorValue: "",
},
apiKey: {
@@ -1098,8 +1102,8 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
},
},
suggestedDefaults: {
model: { primary: "longcat/LongCat-Flash-Chat" },
modelCatalog: { "longcat/LongCat-Flash-Chat": { alias: "LongCat" } },
model: { primary: "longcat/LongCat-2.0" },
modelCatalog: { "longcat/LongCat-2.0": { alias: "LongCat" } },
},
},
{
+7 -4
View File
@@ -1054,12 +1054,15 @@ export const opencodeProviderPresets: OpenCodeProviderPreset[] = [
npm: "@ai-sdk/openai-compatible",
name: "Longcat",
options: {
baseURL: "https://api.longcat.chat/v1",
baseURL: "https://api.longcat.chat/openai/v1",
apiKey: "",
setCacheKey: true,
},
models: {
"LongCat-Flash-Chat": { name: "LongCat Flash Chat" },
"LongCat-2.0": {
name: "LongCat 2.0",
options: { thinking: { type: "disabled" } },
},
},
},
category: "cn_official",
@@ -1068,8 +1071,8 @@ export const opencodeProviderPresets: OpenCodeProviderPreset[] = [
templateValues: {
baseURL: {
label: "Base URL",
placeholder: "https://api.longcat.chat/v1",
defaultValue: "https://api.longcat.chat/v1",
placeholder: "https://api.longcat.chat/openai/v1",
defaultValue: "https://api.longcat.chat/openai/v1",
editorValue: "",
},
apiKey: {
+3
View File
@@ -645,6 +645,9 @@ export interface OpenClawModel {
};
contextWindow?: number;
maxTokens?: number; // 最大输出 token 数
compat?: {
maxTokensField?: string; // 最大输出 token 请求字段名(如 "max_tokens"
};
}
// OpenClaw 默认模型配置(agents.defaults.model