# agent402.tools IRR Calculator

> agent402.tools IRR Calculator is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Computes the internal rate of return (IRR) of a cashflow stream using Newton-Raphson iteration, finding the discount rate at which NPV equals zero.

## Facts

- Endpoint: POST https://agent402.tools/api/irr
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-irr-calculator-098941ce
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_jAhxtFWBEx2ZQhKXCBSwE

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-tools-irr-calculator-098941ce -d '<json body>'
```

Example prompt: What's the IRR on this investment? The cashflows are: year 0 is -50000, then 12000, 15000, 18000, 20000, and 25000 in years 1 through 5. Use a starting guess of 10%.

## When to prefer this

Use this endpoint when you need a quick, accurate IRR calculation for a discrete periodic cashflow stream (e.g. annual project returns, loan schedules) and want server-side Newton-Raphson solving without implementing the algorithm yourself. Ideal for financial agents doing capital budgeting, project evaluation, or loan comparison where IRR is needed as a decision metric.

## Known failure modes

- Cashflow array has fewer than 2 elements — API returns validation error
- No sign change in cashflows (all positive or all negative) — Newton-Raphson cannot converge, returns error
- Newton-Raphson fails to converge with given guess — try a different initial guess value
- Cashflow array exceeds 1200 elements — returns payload too large error
- Payment of 0.001 USDC not fulfilled — returns 402 Payment Required

## How this service works

Compute the internal rate of return (IRR) of a cashflow stream - the discount rate at which NPV = 0. Index 0 is treated as t=0 (typically the negative initial investment); indices 1..n are inflows in subsequent periods. Solved via Newton-Raphson with bisection fallback. Requires at least one positive and one negative cashflow (otherwise IRR is undefined). Multiple sign changes in the cashflows can produce multiple IRR roots - we return the first one found.

## Output

Returns the computed IRR as a decimal (e.g. 0.18 = 18%) representing the discount rate at which the net present value of the provided cashflow stream equals zero, solved via Newton-Raphson iteration.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "guess": {
   "type": "number",
   "description": "Initial guess for IRR as decimal (default 0.1 = 10%). Used as the Newton-Raphson starting point."
  },
  "cashflows": {
   "type": "array",
   "description": "Array of cashflows. Index 0 = t=0. Must contain at least one positive and one negative value. 2-1200 elements."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "irr": 0.248883,
  "npvAtIrr": 0,
  "converged": true,
  "iterations": 6
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-irr-calculator-098941ce/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
