export interface PricingConfig {
evalFeeSats?: number;
workFeeShortSats?: number;
workFeeMediumSats?: number;
workFeeLongSats?: number;
shortMaxChars?: number;
mediumMaxChars?: number;
}
export class PricingService {
private readonly evalFee: number;
private readonly workFeeShort: number;
private readonly workFeeMedium: number;
private readonly workFeeLong: number;
private readonly shortMax: number;
private readonly mediumMax: number;
constructor(config?: PricingConfig) {
this.evalFee = config?.evalFeeSats ?? 10;
this.workFeeShort = config?.workFeeShortSats ?? 50;
this.workFeeMedium = config?.workFeeMediumSats ?? 100;
this.workFeeLong = config?.workFeeLongSats ?? 250;
this.shortMax = config?.shortMaxChars ?? 100;
this.mediumMax = config?.mediumMaxChars ?? 300;
calculateEvalFeeSats(): number {
return this.evalFee;
calculateWorkFeeSats(requestText: string): number {
const len = requestText.trim().length;
if (len <= this.shortMax) return this.workFeeShort;
if (len <= this.mediumMax) return this.workFeeMedium;
return this.workFeeLong;
export const pricingService = new PricingService();