Price and SAC loan amortization simulator
br_simulate_loan_amortizationSimulates a Brazilian loan or financing under the Price (constant installment) and SAC (constant principal) systems and returns installment values, total paid, total interest and, on request, the full month-by-month table. Use it to compare financing offers, size an installment plan, or expose interest cost before a credit decision. Do not use it to restate a past amount by an inflation index (use br_correct_monetary_value) or to convert currency (use br_convert_ptax_fx). Deterministic, read-only and fully computed at the edge with no external data source, so identical input always returns identical output and a retry is always safe. Costs 0.005 USDC per call via x402 v2 on Base (eip155:8453) or a B2B X-API-Key; out-of-range input is clamped rather than rejected (term is bounded to 1..420 months and negative principal or rate becomes zero), while an unpaid call returns HTTP 402 with a PAYMENT-REQUIRED header and malformed JSON returns HTTP 400 with success:false, never an exception.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"principal": "<principal>",
"monthlyInterestRatePct": "<monthlyInterestRatePct>",
"months": "<months>"
},
"name": "br_simulate_loan_amortization"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| months | Yes | Term in months. Values are floored and clamped to the 1..420 range (420 months is the 35-year ceiling of Brazilian mortgage practice). | |
| system | No | Amortization system to compute. PRICE keeps the installment constant and back-loads principal; SAC keeps principal constant so installments start higher and fall, with less total interest. BOTH (the default) returns the two side by side for comparison and costs the same single call. | BOTH |
| aiSummary | No | When true (the default), appends aiExecutiveBrief, a one-sentence Portuguese summary. Set false to cut roughly 80 ms of latency. | |
| principal | Yes | Financed amount in BRL, as a plain number (50000 means R$ 50.000,00). Negative values are clamped to zero. | |
| includeSchedule | No | When true, each requested system also returns its full schedule array. With BOTH and a long term this can mean hundreds of rows, so leave it false when only totals matter. | |
| monthlyInterestRatePct | Yes | Nominal monthly interest rate in percent, not a decimal fraction: 1.49 means 1,49% per month, roughly 19,4% per year. Pass 0 for an interest-free plan, in which case Price splits the principal evenly. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Stable machine-readable failure code. Common values: 'bad_request' (malformed JSON or missing operation), 'invalid_payment' / 'settlement_failed' (x402 verification or settlement refused, returned with HTTP 402), 'B2B_KEY_INVALID' and 'B2B_QUOTA_EXCEEDED' (B2B X-API-Key path). | |
| message | No | Human-readable explanation of the failure, in Portuguese. Safe to log or surface to a human operator. | |
| success | Yes | false when the call was rejected before any calculation ran. Absent on success paths that return success:true. | |
| loanSimulation | No | Simulation result. The price and sac blocks appear only for the requested system. | |
| aiExecutiveBrief | No | One-sentence Portuguese summary of the result. Omitted when aiSummary is false. | |
| processingTimeMs | No | Edge processing time in milliseconds, excluding payment settlement. | |
| suggestedNextSteps | No | Chaining hints for autonomous agents: sibling paid APIs in the same suite that are commonly called right after this one. Purely advisory, never required. |