Token Pricing Catalog (config/pricing-catalog.ts)

velobase-harness · src/server/billing/config/pricing-catalog.ts · typescript · MIT
payments, ai, lang:typescript, tag:tokens

Calculates and manages token-based billing costs across different model tiers and user plans. Reuse in AI application backends requiring granular usage tracking and billing.

// Source: https://github.com/velobase/velobase-harness | License: MIT | Copyright 2026 Velobase
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Unified pricing catalog for token-based billing
 * All rates are in credits per 1K tokens
 */

export type ModelTier = 'STANDARD' | 'ADVANCED' | 'REASONING';
export type UserTier = 'FREE' | 'PLUS' | 'PREMIUM';

interface TokenPricing {
  input: number;  // credits per 1K input tokens
  output: number; // credits per 1K output tokens
}

/**
 * Token pricing by model tier and user tier
 * Based on internal pricing table (docs/PRICING_INTERNAL_TABLE_V1.md)
 */
export const TOKEN_PRICING: Record<ModelTier, Record<UserTier, TokenPricing>> = {
  STANDARD: {
    FREE: { input: 0, output: 0 },      // Included in base fee
    PLUS:

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key