CashflowLens
$0.20/callNPV, IRR, XIRR & DCF valuation in a single call.
POST /api/agent-services/cashflowlens/analyzeWhat it does
Deterministic cashflow & return analytics in one call: NPV, IRR (periodic), XIRR (dated), MOIC / DPI / TVPI, payback period, plus an optional DCF valuation (enterprise value, equity value, implied share price) with Gordon-growth or exit-multiple terminal value. Pure math from caller-provided cashflows — no market-data feed, no fabrication. Every metric is accompanied by evidence-backed findings.
- Solve IRR / XIRR from any cashflow series
- NPV + DCF (Gordon-growth or exit-multiple)
- MOIC / DPI / TVPI and payback period
Example request
POST /api/agent-services/cashflowlens/analyze
{
"cashflows": [
-1000000,
50000,
60000,
70000,
1200000
],
"discountRate": 0.08,
"periodsPerYear": 1,
"nav": 0
}Example response (HTTP 200)
Deterministic — the same inputs always return the same audited output.
{
"service": "cashflowlens",
"requestId": "cfl-1a2b3c4d",
"mode": "periodic",
"summary": {
"totalIn": 1380000,
"totalOut": 1000000,
"net": 380000,
"npv": 162512.34,
"irrPerPeriod": 0.1287,
"irrAnnual": 0.1287,
"xirr": null,
"moic": 1.38,
"dpi": 1.38,
"tvpi": 1.38,
"paybackPeriod": 3.68
},
"dcf": null,
"findings": [
{
"rule": "mode",
"severity": "info",
"why": "Whether returns were computed on dated (XIRR) or periodic (IRR) cashflows.",
"evidence": "mode=periodic cashflows=5 periodsPerYear=1",
"fix": null
}
],
"cashflowCount": 5
}Input schema
Top-level request fields. Nested shapes are shown in the example above and the OpenAPI spec.
| Field | Type | Required | Description |
|---|---|---|---|
| cashflows | array | Yes | Series of cashflows. Each item is a number (periodic, t=0,1,2,...) OR an object {amount, date?, label?}. Outflows negative, inflows positive. If ANY item has a date, dated/XIRR mode is used. |
| discountRate | number | — | Annual rate for NPV (e.g. 0.10). Omit to skip NPV. |
| periodsPerYear | number | — | Periods per year to annualize a periodic IRR (default 1; e.g. 12 for monthly, 4 for quarterly). |
| nav | number | — | Residual / net asset value, used for TVPI = (distributions + nav) / paid-in. |
| dcf | object | — | Optional DCF valuation inputs. |
How to call it over x402
- 1. Send the request. The first unpaid call returns HTTP 402 with an x402 payment challenge — $0.20, USDC on Base, and the recipient.
- 2. Pay per call. Your x402 client signs the USDC payment and retries automatically — no API key, no account, no subscription. New to x402?
- 3. Read the result. HTTP 200 returns the computed values plus evidence-backed findings.
With the x402 fetch client (Node / TypeScript)
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.AGENT_WALLET_KEY);
const pay = wrapFetchWithPayment(fetch, account); // USDC on Base
const res = await pay("https://hermesplant.com/api/agent-services/cashflowlens/analyze", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"cashflows": [
-1000000,
50000,
60000,
70000,
1200000
],
"discountRate": 0.08,
"periodsPerYear": 1,
"nav": 0
}),
});
const result = await res.json();Inspect the 402 with curl
curl -i -X POST https://hermesplant.com/api/agent-services/cashflowlens/analyze \
-H "content-type: application/json" \
-d '{"cashflows":[-1000000,50000,60000,70000,1200000],"discountRate":0.08,"periodsPerYear":1,"nav":0}'
# → HTTP/1.1 402 Payment Required (x402 challenge: price, USDC asset, Base network, recipient)
# → sign the USDC-on-Base payment and retry to receive HTTP 200Prefer zero code? This endpoint is also exposed as a tool on the Hermes Plant MCP server, so an MCP-capable agent can call it with its own x402 wallet.
Other agent services
LP/GP distribution waterfalls, solved exactly.
Black-Scholes option pricing with the full Greeks.
Yield, duration, convexity & loan amortization.
Portfolio risk scored straight from holdings.
Wallet AML & compliance risk screening.
Full deal underwriting — DCF, returns, sensitivity & waterfall in one call.
Score an MCP server before your agent installs it.
Catch destructive agent commands before they run.
Route risky agent actions to human approval.
Deterministic email & contact data validation.
Need a calculator that isn’t here yet? contact@hermesplant.com