import type { LlmUsage } from "@slowcook-ai/core"; /** * Per-million-token prices for Claude models. Source of truth for * Anthropic cost accounting. Provider-specific (Anthropic bills cache * reads at ~10% of new-input, cache writes at ~125%); lives next to the * adapter that uses it rather than in a central registry. */ export declare const PRICING_PER_M_TOKENS: Record; /** Is this model in the pricing table? Ledger writers ask before recording a * dollar figure โ€” an unpriced model must record `null`, never `0`. */ export declare function isModelPriced(model: string): boolean; /** * NEVER SILENT-ZERO (2026-08-13, dovizir handover ยง2). `costUsdForUsage` * returns 0 for an unpriced model, which is indistinguishable from a free * call: a real refine run logged `{"usd":0,"model":"claude-opus-5", * "tokens_out":3519}` โ€” tokens counted, dollars vanished, budgets lying. * * Ledger writers call THIS instead. An unpriced model yields `null` (the * ledger records "unknown", not "free") plus one loud stderr line per model * per process, naming the model and the recovery path. */ export declare function costEntryUsd(model: string, usage: LlmUsage): number | null; /** * Compute USD cost from normalized usage counters + a model id. * Anthropic's API reports `input_tokens` as new-input-only (cache tokens * are separate counters, not subsets). Cache reads bill at ~10% of input; * cache writes at ~125%. */ export declare function costUsdForUsage(model: string, usage: LlmUsage): number; /** * Build an HTML-comment cost marker for embedding in audit-trail comments * (source-issue comments from refine / testgen / brew). Hidden from * human-rendered markdown but machine-parseable by `on-brew-merged`'s * pipeline-total aggregator. * * Format: `` * * Chosen over a persisted .brewing/costs/*.jsonl file because (a) no extra * git commits, (b) the comment trail is already the audit log, (c) the * aggregator just walks issue comments via the GitHub API. */ export declare function costMarker(fields: { agent: "refine" | "testgen" | "brew" | "taste"; usd: number; tokensIn?: number; tokensOut?: number; cacheRead?: number; cacheCreate?: number; model?: string; round?: number | string; }): string; /** * Parse one or more cost markers out of a text blob (typically a GitHub * issue comment body). Returns a flat list โ€” a single comment can contain * at most one marker by convention, but the parser is robust to multiple. */ export interface ParsedCostMarker { agent: string; usd: number; tokensIn?: number; tokensOut?: number; cacheRead?: number; cacheCreate?: number; model?: string; round?: string; } export declare function parseCostMarkers(body: string): ParsedCostMarker[]; /** * Render a human-readable cost footer to append to a PM-facing comment. * * Format: * --- * ๐Ÿ’ฐ **This step:** $0.35 ยท **Story total:** $0.42 (2 agent calls so far) * * The footer is part of slowcook's contract that agent cost is visible * to the PM at every comment, not just embedded in invisible HTML * markers. A PM building a feature should see "this round cost me X * cents; the whole story so far is Y dollars" in real time. * * `thisRunUsd`: the cost of the call that produced this comment. * `priorMarkers`: parsed cost markers from prior bot comments on the * same issue/PR (use `parseCostMarkers` over a concatenated body). * Empty array for the first comment in a story. * * The visible footer renders the story-total INCLUDING `thisRunUsd`, * so the math always reads true even on round 1. */ export declare function formatCostFooter(thisRunUsd: number, priorMarkers: ParsedCostMarker[]): string; /** * 0.19.0-ฮฑ.31 (sc#69) โ€” mid-flight rate-limit hint. Render a fuel-low * signal in the cost footer when the provider's `*-remaining` headers * are below threshold. Distinct visual from the budget-low warning * (sc#66) โ€” this one is about ephemeral burst pacing, not money. * * Thresholds: * - tokensRemaining โ‰ค 5_000 โ†’ tight (typical per-minute pool is 40Kโ€“80K) * - requestsRemaining โ‰ค 5 โ†’ tight * Returns empty string when neither field is present or both are * above threshold โ€” so footers stay clean during normal operation. */ export interface RateLimitsForHint { tokensRemaining?: number; requestsRemaining?: number; tokensResetAt?: string; requestsResetAt?: string; } export declare function formatRateLimitHint(rl: RateLimitsForHint | undefined): string; //# sourceMappingURL=pricing.d.ts.map