npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fathom-token-sdk

v0.4.0

Published

Programmatic access to Fathom's AI cost intelligence: estimation, routing, intent, and store

Readme

fathom-token-sdk

npm version

Typed programmatic API for Fathom's AI cost intelligence. Estimate tokens, recommend models, manage intent, and check budgets — all from your own code.

Install

npm install fathom-token-sdk

Quick Start

import { estimateFeature, createRouter, loadIntent } from "fathom-token-sdk";

// Estimate a feature's token cost
const estimate = await estimateFeature({
  description: "add OAuth login with Google and GitHub",
  complexity: "L",
});
console.log(estimate.totalTokens, estimate.estimatedCost);

// Get a model recommendation
const router = createRouter();
const rec = router.recommend({
  description: "refactor auth middleware",
  complexity: "M",
});
console.log(rec.model, rec.reasoning, rec.estimatedCost);

// Load project intent
const intent = await loadIntent(".fathom");
console.log(intent.purpose, intent.guardrails);

API Surface

Estimation (@fathom/core)

| Export | Description | |--------|-------------| | estimateFeature(opts) | Estimate tokens and cost for a single feature | | estimateAll(features) | Estimate an array of features | | loadData() | Load model pricing and complexity data | | getModelPricing(model) | Get pricing for a specific model | | getComplexityMultiplier(complexity) | Get the multiplier for S/M/L/XL |

Routing (@fathom/router)

| Export | Description | |--------|-------------| | createRouter(config?) | Create a model router with optional config | | scoreModelForTask(model, task) | Score a model for a specific task | | estimateTokensForTask(task) | Estimate tokens for a task context | | estimateCost(tokens, model) | Calculate cost from token count | | checkBudget(config) | Check budget status | | dailyBudgetRemaining(config) | Get remaining daily budget | | getDefaultModels() | List all known models | | getModelById(id) | Look up a model by ID | | getModelsByProvider(provider) | Filter models by provider | | getModelsByTier(tier) | Filter models by tier (frontier/mid/economy) |

Intent (@fathom/intent)

| Export | Description | |--------|-------------| | loadIntent(dir) | Load intent.yaml from a .fathom/ directory | | saveIntent(dir, intent) | Save intent.yaml | | detectIntent(description) | Auto-detect intent from a project description | | resolveGuardrails(intent) | Resolve guardrail templates to concrete rules | | loadTemplate(name) | Load a guardrail template (OWASP, WCAG, etc.) | | listTemplates() | List available guardrail templates |

Store (@fathom/store)

| Export | Description | |--------|-------------| | createStore(config) | Create a store instance from config | | createStoreFromConfig(path) | Create a store from a config file | | loadStoreConfig(path) | Load store configuration | | FileStore | File-based store implementation |

Types

All types are exported for TypeScript consumers:

import type {
  LoadedData,
  Router, RouterConfig, Recommendation, TaskContext, BudgetState,
  BudgetCheckResult,
  IntentConfig, ResolvedGuardrails, GuardrailTemplate,
  FathomStore, StoreConfig,
} from "fathom-token-sdk";

Requirements

  • Node.js 20+
  • TypeScript 5+ (for type exports)

Part of Fathom

fathom-token-sdk is a curated re-export of the Fathom workspace packages, bundled as a single dependency. Use it when you want programmatic access without importing individual @fathom/* packages.

License

MIT