From e1e942b70e5d3dc0242620fe59694d7a2de66eb9 Mon Sep 17 00:00:00 2001 From: pjb157 Date: Fri, 31 Jul 2026 12:54:10 +0100 Subject: [PATCH] fix: show cache read multiplier in catalog --- src/lib/model-artifacts.test.ts | 10 ++++++---- src/lib/model-artifacts.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/lib/model-artifacts.test.ts b/src/lib/model-artifacts.test.ts index 0768514..20ebe96 100644 --- a/src/lib/model-artifacts.test.ts +++ b/src/lib/model-artifacts.test.ts @@ -150,15 +150,17 @@ describe("buildModelArtifacts", () => { }); describe("renderModelsIndexMarkdown", () => { - it("shows model-specific cache-read prices and unsupported fallbacks", () => { + it("shows model-specific cache-read multipliers and unsupported fallbacks", () => { const markdown = renderModelsIndexMarkdown([ { name: "Enabled", slug: "enabled", id: "enabled", rawName: "Enabled", type: "Generation", capabilities: [], playgroundUrl: "https://example.com/enabled", pricing: [], cacheReadPricePer1M: "\\$0.10", cacheReadMultiplier: 0.1 }, { name: "Unsupported", slug: "unsupported", id: "unsupported", rawName: "Unsupported", type: "Generation", capabilities: [], playgroundUrl: "https://example.com/unsupported", pricing: [] }, ]); - expect(markdown).toContain("| Model | Provider | Type | Realtime | Async | Batch (24h) | Cache read |"); - expect(markdown).toContain("| [Enabled](/inference-api/models/enabled) | — | Generation | — | — | — | \\$0.10 / 1M |"); - expect(markdown).toContain("| [Unsupported](/inference-api/models/unsupported) | — | Generation | — | — | — | — |"); + expect(markdown).toContain("| Model | Provider | Type | Realtime | Async | Batch (24h) | Cache read |"); + expect(markdown).toContain("|-------|----------|------|----------|-------|-------------|:----------:|"); + expect(markdown).toContain("| [Enabled](/inference-api/models/enabled) | — | Generation | — | — | — | 0.1× |"); + expect(markdown).toContain("| [Unsupported](/inference-api/models/unsupported) | — | Generation | — | — | — | ❌ |"); + expect(markdown).not.toContain("❌ Prompt caching is not supported for this model."); expect(markdown).not.toContain("90% discount"); }); }); diff --git a/src/lib/model-artifacts.ts b/src/lib/model-artifacts.ts index 06d2759..2dd77a4 100644 --- a/src/lib/model-artifacts.ts +++ b/src/lib/model-artifacts.ts @@ -211,12 +211,12 @@ export function renderModelsIndexMarkdown(artifacts: ModelArtifact[]): string { }; const overviewTable = [ - "| Model | Provider | Type | Realtime | Async | Batch (24h) | Cache read |", - "|-------|----------|------|----------|-------|-------------|------------|", + "| Model | Provider | Type | Realtime | Async | Batch (24h) | Cache read |", + "|-------|----------|------|----------|-------|-------------|:----------:|", ...artifacts.map((artifact) => { - const cacheRead = artifact.cacheReadPricePer1M - ? `${artifact.cacheReadPricePer1M} / 1M` - : "—"; + const cacheRead = artifact.cacheReadMultiplier !== undefined + ? `${artifact.cacheReadMultiplier}×` + : "❌"; return `| [${artifact.name}](${getModelArtifactPath(artifact.slug)}) | ${renderProvider(artifact.providerName)} | ${artifact.type} | ${formatTierCell(artifact, "Realtime")} | ${formatTierCell(artifact, "Async")} | ${formatTierCell(artifact, "Batch (24h)")} | ${cacheRead} |`; }), ].join("\n"); @@ -226,7 +226,7 @@ export function renderModelsIndexMarkdown(artifacts: ModelArtifact[]): string { The table below outlines the models we have available and their pricing per 1M tokens. If you are interested in understanding pricing for a model not listed below or if you'd like to request a new model - please reach out to support@doubleword.ai. :::info{title="Prompt caching"} -Prompt-caching availability and rates are model-specific. The **Cache read** column shows the current cache-read price for supported models. See the [prompt caching guide](/inference-api/prompt-caching) for setup, TTLs, and write pricing. +Prompt-caching availability and rates are model-specific. The **Cache read** column shows the current multiplier on the model's standard input price. See the [prompt caching guide](/inference-api/prompt-caching) for setup, TTLs, and write pricing. ::: ## Model Catalog