Lightweight currency conversion library. Cashify-compatible API — bring your own rates and convert synchronously — plus one extra superpower: Moneyify.live() auto-fetches mid-market rates from the AllRatesToday API so you never need to maintain a rate table yourself.
- 💡 Drop-in replacement for
cashify(syncconvert, expression parsing, big.js support) - 🌍 Auto-fetch 160+ currencies at mid-market rates with no retail spread
- 📦 Zero runtime dependencies
- 🧮 Optional
big.jsintegration for arbitrary-precision math - 💬 Parses expressions:
"10 USD to EUR","€10 EUR in GBP","1,250.5 usd in gbp" - 🟦 Written in TypeScript, ships ESM + CJS +
.d.ts - ⚡ Node 18+
npm install moneyifyyarn add moneyify
pnpm add moneyifyimport { Moneyify } from "moneyify";
const rates = { EUR: 1.00, GBP: 0.85, USD: 1.08 };
const m = new Moneyify({ base: "EUR", rates });
m.convert(10, { from: "EUR", to: "GBP" }); // 8.5
m.convert("10 EUR to GBP"); // 8.5
m.convert("€10 EUR in USD"); // 10.8import { Moneyify } from "moneyify";
// Rates are fetched and cached on construction.
const m = await Moneyify.live({
base: "USD",
apiKey: process.env.ALLRATESTODAY_API_KEY,
});
m.convert(100, { from: "USD", to: "INR" }); // e.g. 8320.5
m.convert("50 USD to EUR"); // e.g. 46.17Get a free API key at allratestoday.com/register — no credit card required.
import { convert } from "moneyify";
convert(10, {
from: "EUR",
to: "GBP",
base: "EUR",
rates: { GBP: 0.85, EUR: 1.0 },
}); // 8.5import { parse } from "moneyify";
parse("10 EUR to GBP"); // { amount: 10, from: "EUR", to: "GBP" }
parse("€10 EUR"); // { amount: 10, from: "EUR" }
parse("1,250.5 usd in gbp"); // { amount: 1250.5, from: "USD", to: "GBP" }Supported separators: to, in, as (case-insensitive).
Supported symbols: $, €, £, ¥, ₹, ₽, ₺, ₩, ₪, R$, A$, C$, HK$, NZ$, S$.
import Big from "big.js";
import { Moneyify } from "moneyify";
const m = new Moneyify({
base: "USD",
rates: { EUR: 0.923456789 },
BigJs: Big,
});
m.convert(100, { from: "USD", to: "EUR" }); // 92.3456789 (no float drift)| Option | Type | Description |
|---|---|---|
base |
string |
Base currency ("USD", "EUR", …). Required. |
rates |
Record<string, number> |
Rate table where each value is "1 base = X of this currency". Default: {}. |
BigJs |
BigJsConstructor |
Optional big.js-compatible constructor for arbitrary-precision math. |
Sync. Returns a number (or big.js-backed number if BigJs was passed).
amount:numberor a parseable expression string ("10 USD to EUR")options.from?: source currency (defaults tobase)options.to?: target currency (required unless embedded in the expression)
Moneyify.live({
base: string;
apiKey?: string; // defaults to process.env.ALLRATESTODAY_API_KEY
baseUrl?: string; // default: "https://allratestoday.com"
fetch?: typeof fetch;
timeoutMs?: number; // default 15000
symbols?: string[]; // pre-fetch only these codes (default: all 160+)
BigJs?: BigJsConstructor;
}): Promise<Moneyify>Pre-fetches rates against base and returns a ready-to-use instance. Once resolved, .convert(...) is fully synchronous.
Same as instance.convert() but bring your own base and rates each call. Cashify parity.
Returns { amount, from?, to? }. Throws MoneyifyError if unparseable.
All errors thrown by moneyify are instances of MoneyifyError. Network/API errors include a .status field with the HTTP status code.
import { MoneyifyError } from "moneyify";
try {
m.convert(10, { from: "USD", to: "XYZ" });
} catch (err) {
if (err instanceof MoneyifyError) {
console.error(err.status, err.message);
}
}The public API is identical. Drop-in swap:
- import { Cashify, convert, parse } from "cashify";
+ import { Moneyify as Cashify, convert, parse } from "moneyify";Everything else works the same. If you want to stop maintaining your rate table, switch from new Cashify({ base, rates }) to await Moneyify.live({ base, apiKey }).
160+ currencies including majors (USD, EUR, GBP, JPY, CHF, CAD, AUD, NZD), emerging-market (INR, CNY, BRL, MXN, TRY, ZAR, SGD, HKD, KRW, THB, PHP, PKR, BDT, LKR, NGN, GHS, KES, AED, SAR, EGP), and precious metals (XAU, XAG).
Full list: allratestoday.com/api/v1/symbols.
The same rates are available to coding agents and LLM tools without a second integration:
- Claude Code plugin (no key):
/plugin marketplace add AllRates-Today/claude-code-pluginthen/plugin install allratestoday@allratestoday - Hosted MCP endpoint:
https://allratestoday.com/api/mcp— Streamable HTTP, keyless, nothing to install - Local MCP servers:
npx -y @allratestoday/mcp-server(live mid-market rates) ·npx -y @allratestoday/central-bank-mcp(official central-bank rates) - Trial key for agents, no signup:
POST https://allratestoday.com/api/agent/keys(sendContent-Type: application/json) returns a 100-call key valid 7 days, enough to try live rates (all history and dated rates, market and official, need a paid plan); both MCP servers expose it asrequest_trial_key - Daily Reference Rate (first published 2026-10-12): one fixed USD table per business day, the 16:00 London median of minute samples, never revised — keyless at
https://allratestoday.com/api/open/reference-rate,get_reference_ratein the MCP server - Machine-readable site guide: llms.txt
cashify– The library this package's API is modelled on. If you only need offline conversion math and don't want a network call, use cashify.fx-rates– Even lighter companion: a one-function library +fx-ratesCLI for real-time rates.@allratestoday/sdk– Full-featured SDK with historical data, batch requests, and webhooks.react-currency-localizer-realtime– React hooks and components for auto-localized pricing.allratestoday– The REST API that powersMoneyify.live().
This project contains code generated by Large Language Models (LLMs), under human supervision and proofreading. All published versions are reviewed, tested, and released by a human maintainer.
- API Documentation
- Register (Free)
- Dashboard
- Status
- Postman collection
- ChatGPT app — ask ChatGPT for live and official central bank rates
- OpenAPI reference on Bump.sh — also on SwaggerHub
- Bank Exchange Rate API — live buy and sell rates from 1,200+ commercial banks in 120+ countries · npm · GitHub
- GitHub
MIT © AllRatesToday — maintained by Chathuranga Basnayaka.