fix(ai): support long cache retention compat

closes #3543
This commit is contained in:
Mario Zechner
2026-04-23 23:43:34 +02:00
parent 1312346199
commit 4cd4cfd98e
11 changed files with 331 additions and 29 deletions

View File

@@ -461,6 +461,35 @@ describe("ModelRegistry", () => {
expect(compat?.supportsEagerToolInputStreaming).toBe(false);
});
test("compat schema accepts long cache retention flag", () => {
writeRawModelsJson({
demo: {
baseUrl: "https://example.com",
apiKey: "DEMO_KEY",
api: "anthropic-messages",
compat: {
supportsLongCacheRetention: false,
},
models: [
{
id: "demo-model",
reasoning: true,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 1000,
maxTokens: 100,
},
],
},
});
const registry = ModelRegistry.create(authStorage, modelsJsonPath);
const compat = registry.find("demo", "demo-model")?.compat as AnthropicMessagesCompat | undefined;
expect(registry.getError()).toBeUndefined();
expect(compat?.supportsLongCacheRetention).toBe(false);
});
test("model-level baseUrl overrides provider-level baseUrl for custom models", () => {
writeRawModelsJson({
"opencode-go": {