fix(chutes): report cache-read pricing from live catalog (#111253)

This commit is contained in:
mushuiyu886
2026-07-19 19:56:42 -07:00
committed by GitHub
parent da10827439
commit 367fe9a42b
2 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -187,7 +187,7 @@ describe("chutes-models", () => {
input_modalities: ["text", "image"],
context_length: 200000,
max_output_length: 16384,
pricing: { prompt: 0.1, completion: 0.2 },
pricing: { prompt: 0.1, completion: 0.2, input_cache_read: 0.05 },
},
{ id: "new-provider/simple-model" },
],
@@ -201,6 +201,12 @@ describe("chutes-models", () => {
const secondModel = requireChutesModel(models, 1);
expect(firstModel.id).toBe("zai-org/GLM-5-TEE");
expect(secondModel.reasoning).toBe(true);
expect(secondModel.cost).toEqual({
input: 0.1,
output: 0.2,
cacheRead: 0.05,
cacheWrite: 0,
});
if (!secondModel.compat) {
throw new Error("expected Chutes API model compat");
}
+2 -1
View File
@@ -58,6 +58,7 @@ interface ChutesModelEntry {
pricing?: {
prompt?: number;
completion?: number;
input_cache_read?: number;
};
[key: string]: unknown;
}
@@ -127,7 +128,7 @@ export async function discoverChutesModels(accessToken?: string): Promise<ModelD
cost: {
input: entry.pricing?.prompt || 0,
output: entry.pricing?.completion || 0,
cacheRead: 0,
cacheRead: entry.pricing?.input_cache_read || 0,
cacheWrite: 0,
},
contextWindow: asPositiveSafeInteger(entry.context_length) ?? CHUTES_DEFAULT_CONTEXT_WINDOW,