{"record":{"id":"c03045c973efa729","repo":"paperclipai/paperclip","slug":"model-pricing-unavailable-for-model","errorCode":null,"errorMessage":"model pricing unavailable for ${model}","messagePattern":"model pricing unavailable for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/evals/model-pricing.ts","lineNumber":42,"sourceCode":"  \"openrouter/qwen/qwen3.8-max-0902\": { input: 2, cachedInput: 0.25, output: 6 },\n  \"openrouter/google/gemini-3.8-flash\": { input: 0.75, cachedInput: 0.075, output: 3.75 },\n  \"openrouter/z-ai/glm-5.3\": { input: 1.4, cachedInput: 0.14, output: 4.4 },\n  \"openrouter/deepseek/deepseek-v4-flash-0731\": { input: 0.14, cachedInput: 0.028, output: 0.28 },\n  \"openrouter/openai/gpt-6-astra\": { input: 10, cachedInput: 1, output: 50 },\n});\n\nexport interface EstimatedModelCost {\n  estimatedCostNanodollars: number;\n  pricingVersion: typeof MODEL_PRICING_VERSION;\n  ratesUsdPerMillionTokens: TokenRatesUsdPerMillion;\n}\n\nexport function estimateModelCostNanodollars(\n  model: string,\n  usage: { inputTokens: number; cachedInputTokens: number; outputTokens: number },\n): EstimatedModelCost {\n  const rates = RATES[model];\n  if (rates === undefined) throw new Error(`model pricing unavailable for ${model}`);\n  const uncachedInput = Math.max(0, usage.inputTokens - usage.cachedInputTokens);\n  const estimatedCostNanodollars = Math.round(\n    uncachedInput * rates.input * 1_000\n      + usage.cachedInputTokens * rates.cachedInput * 1_000\n      + usage.outputTokens * rates.output * 1_000,\n  );\n  return { estimatedCostNanodollars, pricingVersion: MODEL_PRICING_VERSION, ratesUsdPerMillionTokens: { ...rates } };\n}\n","sourceCodeStart":24,"sourceCodeEnd":51,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/evals/model-pricing.ts#L24-L51","documentation":"estimateModelCostNanodollars looks up per-token rates in its hardcoded RATES table and throws when the requested model string has no entry. Cost estimation is impossible without rates, so the library fails fast instead of returning a zero cost. Adding a model requires extending the RATES map.","triggerScenarios":"Calling estimateModelCostNanodollars with a model name not present in the RATES lookup (new/unreleased model, aliased name, version-suffixed model ID, or typo).","commonSituations":"A provider released a new model before pricing was added; code passes a full model ID like 'claude-opus-4-1-20250805' while RATES keys by short name; renaming/moving models between providers.","solutions":["Add the missing model to the RATES map in packages/paperclip-runner/src/evals/model-pricing.ts with current input/cachedInput/output rates","Normalize/alias the model string to a known key before calling (strip date suffixes, map aliases)","Check the exact model string the usage object carries (log it) and align it with RATES keys","Upgrade the package if a newer version added the model's pricing"],"exampleFix":"// before\nconst cost = estimateModelCostNanodollars(model, usage); // throws for unknown model\n// after\nconst key = model.replace(/-\\d{8}$/, '');\nif (!(key in KNOWN_MODELS)) throw new Error(`add pricing for ${model} to RATES`);\nconst cost = estimateModelCostNanodollars(key, usage);","handlingStrategy":"validation","validationCode":"if (!(model in RATES)) throw new Error(`no pricing for model ${model}; add to RATES`);","typeGuard":"function hasPricing(model: string): model is keyof typeof RATES {\n  return model in RATES;\n}","tryCatchPattern":"let cost: number;\ntry {\n  cost = estimateModelCostNanodollars(model, usage);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('model pricing unavailable')) {\n    cost = 0; // or fall back to a token-based default\n  } else throw err;\n}","preventionTips":["Keep the RATES map in sync with the models your evals run","Normalize model IDs (strip date suffixes) before lookup","Log the exact model string when pricing fails"],"tags":["pricing","evals","configuration"],"backgroundTag":"model-pricing-unavailable","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-02T18:44:00.616Z","contentChangedAt":"2026-09-02T18:44:00.616Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}