/** * Model pricing and credit calculation helpers for the agent bridge. * * Extracted verbatim from `agent-bridge.ts`: the hardcoded per-model pricing * table (USD per 1M tokens), vendor-prefix stripping, backend-credit-rate * resolution and credit computation. Pure functions — no bridge state. */ import type { AllowedModel } from "../../relay/models-fetch.js"; /** * Strip vendor prefix to extract the bare model name. * e.g. "openai/gpt-5.3-codex" → "gpt-5.3-codex". * Returns the original string when no separator is present. */ export declare function bareModelId(modelId: string): string; /** Get model cost from backend credit rates, falling back to hardcoded pricing table. */ export declare function getModelCost(m: AllowedModel): { input: number; output: number; cacheRead: number; cacheWrite: number; }; /** Look up pricing for a modelId. Returns null when unknown. */ export declare function lookupPricing(modelId: string): { input: number; output: number; cacheWrite: number; cacheRead: number; } | null; /** Per-model credit rates (credits per 1M tokens), nullable when unset. */ export type CreditRates = { creditInputPer1M?: number | null; creditOutputPer1M?: number | null; creditCachedInputPer1M?: number | null; creditCacheReadPer1M?: number | null; creditCacheWritePer1M?: number | null; }; /** * Resolve credit rates for a subagent result. Subagents may run a different * model than the parent — prefer the allowed-models entry matching the * subagent's modelId (exact, then bare-id); fall back to the parent's active * rates only when the model id is unknown — a known model without configured * credit rates yields null rates (0 credits). * Pure function — no bridge state. */ export declare function resolveCreditRatesForModel(modelId: string | undefined, allowedModels: readonly AllowedModel[] | undefined, fallbackRates: CreditRates | null): CreditRates | null; /** * Calculate credits from token usage using per-model credit rates. * * NOTE: We intentionally keep higher precision here (no 2-decimal rounding) * so small turns don't collapse to 0.00 in live UI aggregation. Rendering * layers decide final display precision. */ export declare function calculateCredits(inputTokens: number, outputTokens: number, cacheReadTokens?: number, cacheWriteTokens?: number, creditInputPer1M?: number | null, creditOutputPer1M?: number | null, creditCachedInputPer1M?: number | null, creditCacheReadPer1M?: number | null, creditCacheWritePer1M?: number | null): number; //# sourceMappingURL=pricing.d.ts.map