For the complete documentation index, see llms.txt.

Rent vs Buy Calculator API

finance 2 credits / call v2026-04-22

Year-by-year wealth comparison of renting and investing versus buying, with the breakeven year.

One POST adds Rent vs Buy Calculator to your app, site, workflow, or agent — formula, validation, edge cases, and docs already handled.

prefer a UI? Open the Rent vs Buy Calculator on miniwebtool.com →

Start free — get a key → 1,000 credits · no card · 30 seconds

Endpoint

POST · 2cr
POST https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run

Request body

Field Type Req.
home_price
purchase price
float
down_payment_pct
down payment % of price
float
mortgage_rate
annual mortgage rate %
float
loan_term
30 | 20 | 15
str
property_tax_rate
annual property tax % of value
float
home_insurance
annual homeowners insurance
float
hoa_fees
monthly HOA fees
float
maintenance_rate
annual maintenance % of value
float
closing_cost_pct
closing costs % of price
float
home_appreciation
annual home appreciation %
float
selling_cost_pct
cost to sell % of value
float
monthly_rent
current monthly rent
float
rent_increase
annual rent increase %
float
renters_insurance
monthly renters insurance
float
investment_return
annual investment return %
float
tax_bracket
marginal tax bracket %
float
time_horizon
years to compare
int

Cost & access

  • 2 credits per successful call — failed calls refund.
  • Starts on: Free.
  • Max payload: 65536 bytes.
  • Privacy mode: hash_only
  • Available on: free, starter, pro, business, scale

Response envelope

{
  "request_id": "01K...",
  "tool": "rent-vs-buy-calculator",
  "tool_version": "2026-04-22",
  "credits_used": 2,
  "result": { ... }
}

Try it

Stored only in this browser tab. Playground test key is prefilled and only works on this page. Get a live key →
purchase price
down payment % of price
annual mortgage rate %
30 | 20 | 15
annual property tax % of value
annual homeowners insurance
monthly HOA fees
annual maintenance % of value
closing costs % of price
annual home appreciation %
cost to sell % of value
current monthly rent
annual rent increase %
monthly renters insurance
annual investment return %
marginal tax bracket %
years to compare

Get your own key

1,000 free calls/mo · no card · key arrives by email

One verification click, then your key + a ready-to-run request. No card, no spam.

Code examples

curl -X POST https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run \
  -H 'Authorization: Bearer mwt_live_YOUR_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"home_price":400000,"down_payment_pct":20,"mortgage_rate":6.5,"loan_term":"30","property_tax_rate":1.1,"home_insurance":1800,"hoa_fees":0,"maintenance_rate":1.0,"closing_cost_pct":3.0,"home_appreciation":3.0,"selling_cost_pct":6.0,"monthly_rent":2200,"rent_increase":3.0,"renters_insurance":15,"investment_return":7.0,"tax_bracket":22,"time_horizon":10}'
import requests

resp = requests.post(
    'https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run',
    headers={'Authorization': 'Bearer mwt_live_YOUR_KEY'},
    json={'home_price': 400000, 'down_payment_pct': 20, 'mortgage_rate': 6.5, 'loan_term': '30', 'property_tax_rate': 1.1, 'home_insurance': 1800, 'hoa_fees': 0, 'maintenance_rate': 1.0, 'closing_cost_pct': 3.0, 'home_appreciation': 3.0, 'selling_cost_pct': 6.0, 'monthly_rent': 2200, 'rent_increase': 3.0, 'renters_insurance': 15, 'investment_return': 7.0, 'tax_bracket': 22, 'time_horizon': 10},
)
resp.raise_for_status()
data = resp.json()
print(data)
const resp = await fetch(
  'https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer mwt_live_YOUR_KEY',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"home_price":400000,"down_payment_pct":20,"mortgage_rate":6.5,"loan_term":"30","property_tax_rate":1.1,"home_insurance":1800,"hoa_fees":0,"maintenance_rate":1.0,"closing_cost_pct":3.0,"home_appreciation":3.0,"selling_cost_pct":6.0,"monthly_rent":2200,"rent_increase":3.0,"renters_insurance":15,"investment_return":7.0,"tax_bracket":22,"time_horizon":10}),
  }
);
const data = await resp.json();
console.log(data);
<?php
$ch = curl_init('https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer mwt_live_YOUR_KEY',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
    'home_price' => 400000,
    'down_payment_pct' => 20,
    'mortgage_rate' => 6.5,
    'loan_term' => '30',
    'property_tax_rate' => 1.1,
    'home_insurance' => 1800,
    'hoa_fees' => 0,
    'maintenance_rate' => 1.0,
    'closing_cost_pct' => 3.0,
    'home_appreciation' => 3.0,
    'selling_cost_pct' => 6.0,
    'monthly_rent' => 2200,
    'rent_increase' => 3.0,
    'renters_insurance' => 15,
    'investment_return' => 7.0,
    'tax_bracket' => 22,
    'time_horizon' => 10
]),
]);
$resp = curl_exec($ch);
curl_close($ch);
print_r(json_decode($resp, true));
require 'net/http'
require 'json'
require 'uri'

uri = URI('https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')

req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer mwt_live_YOUR_KEY'
req['Content-Type'] = 'application/json'
req.body = {
  'home_price' => 400000,
  'down_payment_pct' => 20,
  'mortgage_rate' => 6.5,
  'loan_term' => '30',
  'property_tax_rate' => 1.1,
  'home_insurance' => 1800,
  'hoa_fees' => 0,
  'maintenance_rate' => 1.0,
  'closing_cost_pct' => 3.0,
  'home_appreciation' => 3.0,
  'selling_cost_pct' => 6.0,
  'monthly_rent' => 2200,
  'rent_increase' => 3.0,
  'renters_insurance' => 15,
  'investment_return' => 7.0,
  'tax_bracket' => 22,
  'time_horizon' => 10
}.to_json

resp = http.request(req)
puts JSON.parse(resp.body).inspect
package main

import (
  "bytes"
  "encoding/json"
  "fmt"
  "io"
  "net/http"
)

func main() {
  body, _ := json.Marshal(map[string]interface{}{
    "home_price": 400000,
    "down_payment_pct": 20,
    "mortgage_rate": 6.5,
    "loan_term": "30",
    "property_tax_rate": 1.1,
    "home_insurance": 1800,
    "hoa_fees": 0,
    "maintenance_rate": 1.0,
    "closing_cost_pct": 3.0,
    "home_appreciation": 3.0,
    "selling_cost_pct": 6.0,
    "monthly_rent": 2200,
    "rent_increase": 3.0,
    "renters_insurance": 15,
    "investment_return": 7.0,
    "tax_bracket": 22,
    "time_horizon": 10,
  })
  req, _ := http.NewRequest("POST", "https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run", bytes.NewReader(body))
  req.Header.Set("Authorization", "Bearer mwt_live_YOUR_KEY")
  req.Header.Set("Content-Type", "application/json")

  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  out, _ := io.ReadAll(resp.Body)
  fmt.Println(string(out))
}
import java.net.URI;
import java.net.http.*;

var client = HttpClient.newHttpClient();
var req = HttpRequest.newBuilder()
    .uri(URI.create("https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run"))
    .header("Authorization", "Bearer mwt_live_YOUR_KEY")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString("{\"home_price\":400000,\"down_payment_pct\":20,\"mortgage_rate\":6.5,\"loan_term\":\"30\",\"property_tax_rate\":1.1,\"home_insurance\":1800,\"hoa_fees\":0,\"maintenance_rate\":1.0,\"closing_cost_pct\":3.0,\"home_appreciation\":3.0,\"selling_cost_pct\":6.0,\"monthly_rent\":2200,\"rent_increase\":3.0,\"renters_insurance\":15,\"investment_return\":7.0,\"tax_bracket\":22,\"time_horizon\":10}"))
    .build();

var resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());
agents let your coding agent do it

Copy this into Claude Code, Cursor, Codex, Aider or Cline. It carries the endpoint, the full schema, a sample response, and the credit rules — so the agent wires rent-vs-buy-calculator up correctly without draining your key.

Free to iterate: the prompt points the agent at POST /v1/tools/rent-vs-buy-calculator/dry-run, which validates the request and returns the response shape for 0 credits. Only the final confirmation call is billed (2 credits).
Stable URL for this prompt: /tools/rent-vs-buy-calculator/prompt.md (?variant=cursor / ?variant=mcp).
Paste into Claude Code, or save as CLAUDE.md context.
Integrate the MiniWebtool Rent vs Buy Calculator API into this project.

## Your task

1. Read the reference below.
2. Ask me where this belongs in the codebase if it is not obvious.
3. Write the integration in the language and style of the surrounding code:
   a small typed client function, errors handled, key read from the
   environment (never hard-coded, never committed).
4. Verify with `/dry-run` first, then exactly one live call.
5. Show me the diff and the live result.

## Credit budget — follow these exactly

This API is metered. A live call costs 2 credits; the free tier
includes 1,000 credits per month. Burning them during integration is the
single most common way to waste this key.

1. **Do all wiring against `/dry-run`, which costs 0 credits.** It validates the
   payload for real and returns a sample result with the exact response shape.
   Iterate there until your request builds and your parsing works.
2. **Make at most ONE live `/run` call** — a single end-to-end confirmation once
   dry-run passes. Print the result, then stop.
3. **Never call the API from unit tests, examples, or a retry loop.** Assert
   against the sample response captured from `/dry-run` instead.
4. **On 4xx, fix the payload — do not retry.** The error body is RFC 7807
   `application/problem+json` and says exactly what is wrong.
5. **On 429, honour `Retry-After`** and back off; do not tighten the loop.
6. **Read `X-MWT-Credits-Remaining`** on every response. If it drops below 50,
   stop making live calls and tell me.
7. If the integration needs repeated calls at runtime, **cache by input** — this
   tool is deterministic, so the same input always returns the same output.

## The API

**Rent vs Buy Calculator** — Year-by-year wealth comparison of renting and investing versus buying, with the breakeven year.

- Live endpoint: `POST https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run` — costs 2 credits
- Dry run: `POST https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/dry-run` — costs 0 credits, same auth and validation
- Auth: `Authorization: Bearer <MINIWEBTOOL_API_KEY>`
- Content type: `application/json`
- Tool version: `2026-04-22` (output shape is stable within a major version)
- Full machine-readable spec: `https://api.miniwebtool.com/v1/openapi.json`

### Request body

| field | type | required | notes |
|---|---|---|---|
| `home_price` | float | no | purchase price (default `400000`) |
| `down_payment_pct` | float | no | down payment % of price (default `20`) |
| `mortgage_rate` | float | no | annual mortgage rate % (default `6.5`) |
| `loan_term` | str | no | one of: 30, 20, 15 — 30 \| 20 \| 15 (default `30`) |
| `property_tax_rate` | float | no | annual property tax % of value (default `1.1`) |
| `home_insurance` | float | no | annual homeowners insurance (default `1800`) |
| `hoa_fees` | float | no | monthly HOA fees (default `0`) |
| `maintenance_rate` | float | no | annual maintenance % of value (default `1.0`) |
| `closing_cost_pct` | float | no | closing costs % of price (default `3.0`) |
| `home_appreciation` | float | no | annual home appreciation % (default `3.0`) |
| `selling_cost_pct` | float | no | cost to sell % of value (default `6.0`) |
| `monthly_rent` | float | no | current monthly rent (default `2200`) |
| `rent_increase` | float | no | annual rent increase % (default `3.0`) |
| `renters_insurance` | float | no | monthly renters insurance (default `15`) |
| `investment_return` | float | no | annual investment return % (default `7.0`) |
| `tax_bracket` | float | no | marginal tax bracket % (default `22`) |
| `time_horizon` | int | no | years to compare (default `10`) |

Example request body:

```json
{
  "home_price": 400000,
  "down_payment_pct": 20,
  "mortgage_rate": 6.5,
  "loan_term": "30",
  "property_tax_rate": 1.1,
  "home_insurance": 1800,
  "hoa_fees": 0,
  "maintenance_rate": 1.0,
  "closing_cost_pct": 3.0,
  "home_appreciation": 3.0,
  "selling_cost_pct": 6.0,
  "monthly_rent": 2200,
  "rent_increase": 3.0,
  "renters_insurance": 15,
  "investment_return": 7.0,
  "tax_bracket": 22,
  "time_horizon": 10
}
```

### Response envelope

```json
{
  "request_id": "req_01H…",
  "tool": "rent-vs-buy-calculator",
  "tool_version": "2026-04-22",
  "credits_used": 2,
  "result": {
    "home_price": 400000.0,
    "down_payment": 80000.0,
    "loan_amount": 320000.0,
    "closing_costs": 12000.0,
    "monthly_mortgage_payment": 2022.62,
    "time_horizon_years": 10,
    "total_buying_cost": 406331.21,
    "total_renting_cost": 304446.41,
    "total_mortgage_interest": 193997.73,
    "total_tax_savings": 42679.5,
    "final_home_value": 537566.55,
    "final_net_home_equity": 234028.95,
    "buyer_total_wealth": 234028.95,
    "renter_total_wealth": 266178.62,
    "net_advantage": -32149.66,
    "recommendation": "rent",
    "breakeven_year": null,
    "yearly": [
      {
        "year": 1,
        "buy_yearly_cost": 29918.58,
        "rent_yearly_cost": 26580.0,
        "home_value": 412000.0,
        "remaining_balance": 316423.28,
        "net_home_equity": 70856.72,
        "buyer_total_wealth": 70856.72,
        "renter_total_wealth": 106847.81,
        "net_advantage": -35991.09,
        "monthly_rent": 2266.0
      },
      {
        "year": 2,
        "buy_yearly_cost": 30223.28,
        "rent_yearly_cost": 27372.0,
        "home_value": 424360.0,
        "remaining_balance": 312607.02,
        "net_home_equity": 86291.38,
        "buyer_total_wealth": 86291.38,
        "renter_total_wealth": 122208.05,
        "net_advantage": -35916.67,
        "monthly_rent": 2333.98
      },
      {
        "year": 3,
        "buy_yearly_cost": 30539.07,
        "rent_yearly_cost": 28187.76,
        "home_value": 437090.8,
        "remaining_balance": 308535.17,
        "net_home_equity": 102330.18,
        "buyer_total_wealth": 102330.18,
        "renter_total_wealth": 138100.94,
        "net_advantage": -35770.76,
        "monthly_rent": 2404.0
      },
      {
        "year": 4,
        "buy_yearly_cost": 30866.41,
        "rent_yearly_cost": 29027.99,
        "home_value": 450203.52,
        "remaining_balance": 304190.63,
        "net_home_equity": 119000.68,
        "buyer_total_wealth": 119000.68,
        "renter_total_wealth": 154547.64,
        "net_advantage": -35546.96,
        "monthly_rent": 2476.12
      },
      {
        "year": 5,
        "buy_yearly_cost": 31205.79,
        "rent_yearly_cost": 29893.43,
        "home_value": 463709.63,
        "remaining_balance": 299555.13,
        "net_home_equity": 136331.92,
        "buyer_total_wealth": 136331.92,
        "renter_total_wealth": 171570.35,
        "net_advantage": -35238.42,
        "monthly_rent": 2550.4
      },
      {
        "year": 6,
        "buy_yearly_cost": 31557.71,
        "rent_yearly_cost": 30784.84,
        "home_value": 477620.92,
        "remaining_balance": 294609.18,
        "net_home_equity": 154354.49,
        "buyer_total_wealth": 154354.49,
        "renter_total_wealth": 189192.31,
        "net_advantage": -34837.82,
        "monthly_rent": 2626.92
      },
      {
        "year": 7,
        "buy_yearly_cost": 31922.72,
        "rent_yearly_cost": 31702.98,
        "home_value": 491949.55,
        "remaining_balance": 289331.98,
        "net_home_equity": 173100.59,
        "buyer_total_wealth": 173100.59,
        "renter_total_wealth": 207437.9,
        "net_advantage": -34337.31,
        "monthly_rent": 2705.72
      },
      {
        "year": 8,
        "buy_yearly_cost": 32301.38,
        "rent_yearly_cost": 32648.67,
        "home_value": 506708.03,
        "remaining_balance": 283701.37,
        "net_home_equity": 192604.18,
        "buyer_total_wealth": 192604.18,
        "renter_total_wealth": 226332.7,
        "net_advantage": -33728.52,
        "monthly_rent": 2786.89
      },
      {
        "year": 9,
        "buy_yearly_cost": 32694.27,
        "rent_yearly_cost": 33622.73,
        "home_value": 521909.27,
        "remaining_balance": 277693.66,
        "net_home_equity": 212901.06,
        "buyer_total_wealth": 212901.06,
        "renter_total_wealth": 245903.55,
        "net_advantage": -33002.49,
        "monthly_rent": 2870.5
      },
      {
        "year": 10,
        "buy_yearly_cost": 33102.01,
        "rent_yearly_cost": 34626.01,
        "home_value": 537566.55,
        "remaining_balance": 271283.6,
        "net_home_equity": 234028.95,
        "buyer_total_wealth": 234028.95,
        "renter_total_wealth": 266178.62,
        "net_advantage": -32149.66,
        "monthly_rent": 2956.62
      }
    ],
    "note": "The renter is assumed to invest the down payment, closing costs and any monthly cost difference at the given return."
  }
}
```

`result` holds the tool output. Errors come back as
`application/problem+json` with `type`, `title`, `status`, and `detail`.

### Getting a key

If `MINIWEBTOOL_API_KEY` is not already in the environment, stop and ask me for
one — do not sign up, scrape, or guess a key. Free keys: https://api.miniwebtool.com/dashboard/
Paste into Codex, Aider, Cline, or any coding agent.
Integrate the MiniWebtool Rent vs Buy Calculator API into this project.

## Your task

1. Read the reference below.
2. Ask me where this belongs in the codebase if it is not obvious.
3. Write the integration in the language and style of the surrounding code:
   a small typed client function, errors handled, key read from the
   environment (never hard-coded, never committed).
4. Verify with `/dry-run` first, then exactly one live call.
5. Show me the diff and the live result.

## Credit budget — follow these exactly

This API is metered. A live call costs 2 credits; the free tier
includes 1,000 credits per month. Burning them during integration is the
single most common way to waste this key.

1. **Do all wiring against `/dry-run`, which costs 0 credits.** It validates the
   payload for real and returns a sample result with the exact response shape.
   Iterate there until your request builds and your parsing works.
2. **Make at most ONE live `/run` call** — a single end-to-end confirmation once
   dry-run passes. Print the result, then stop.
3. **Never call the API from unit tests, examples, or a retry loop.** Assert
   against the sample response captured from `/dry-run` instead.
4. **On 4xx, fix the payload — do not retry.** The error body is RFC 7807
   `application/problem+json` and says exactly what is wrong.
5. **On 429, honour `Retry-After`** and back off; do not tighten the loop.
6. **Read `X-MWT-Credits-Remaining`** on every response. If it drops below 50,
   stop making live calls and tell me.
7. If the integration needs repeated calls at runtime, **cache by input** — this
   tool is deterministic, so the same input always returns the same output.

## The API

**Rent vs Buy Calculator** — Year-by-year wealth comparison of renting and investing versus buying, with the breakeven year.

- Live endpoint: `POST https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run` — costs 2 credits
- Dry run: `POST https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/dry-run` — costs 0 credits, same auth and validation
- Auth: `Authorization: Bearer <MINIWEBTOOL_API_KEY>`
- Content type: `application/json`
- Tool version: `2026-04-22` (output shape is stable within a major version)
- Full machine-readable spec: `https://api.miniwebtool.com/v1/openapi.json`

### Request body

| field | type | required | notes |
|---|---|---|---|
| `home_price` | float | no | purchase price (default `400000`) |
| `down_payment_pct` | float | no | down payment % of price (default `20`) |
| `mortgage_rate` | float | no | annual mortgage rate % (default `6.5`) |
| `loan_term` | str | no | one of: 30, 20, 15 — 30 \| 20 \| 15 (default `30`) |
| `property_tax_rate` | float | no | annual property tax % of value (default `1.1`) |
| `home_insurance` | float | no | annual homeowners insurance (default `1800`) |
| `hoa_fees` | float | no | monthly HOA fees (default `0`) |
| `maintenance_rate` | float | no | annual maintenance % of value (default `1.0`) |
| `closing_cost_pct` | float | no | closing costs % of price (default `3.0`) |
| `home_appreciation` | float | no | annual home appreciation % (default `3.0`) |
| `selling_cost_pct` | float | no | cost to sell % of value (default `6.0`) |
| `monthly_rent` | float | no | current monthly rent (default `2200`) |
| `rent_increase` | float | no | annual rent increase % (default `3.0`) |
| `renters_insurance` | float | no | monthly renters insurance (default `15`) |
| `investment_return` | float | no | annual investment return % (default `7.0`) |
| `tax_bracket` | float | no | marginal tax bracket % (default `22`) |
| `time_horizon` | int | no | years to compare (default `10`) |

Example request body:

```json
{
  "home_price": 400000,
  "down_payment_pct": 20,
  "mortgage_rate": 6.5,
  "loan_term": "30",
  "property_tax_rate": 1.1,
  "home_insurance": 1800,
  "hoa_fees": 0,
  "maintenance_rate": 1.0,
  "closing_cost_pct": 3.0,
  "home_appreciation": 3.0,
  "selling_cost_pct": 6.0,
  "monthly_rent": 2200,
  "rent_increase": 3.0,
  "renters_insurance": 15,
  "investment_return": 7.0,
  "tax_bracket": 22,
  "time_horizon": 10
}
```

### Response envelope

```json
{
  "request_id": "req_01H…",
  "tool": "rent-vs-buy-calculator",
  "tool_version": "2026-04-22",
  "credits_used": 2,
  "result": {
    "home_price": 400000.0,
    "down_payment": 80000.0,
    "loan_amount": 320000.0,
    "closing_costs": 12000.0,
    "monthly_mortgage_payment": 2022.62,
    "time_horizon_years": 10,
    "total_buying_cost": 406331.21,
    "total_renting_cost": 304446.41,
    "total_mortgage_interest": 193997.73,
    "total_tax_savings": 42679.5,
    "final_home_value": 537566.55,
    "final_net_home_equity": 234028.95,
    "buyer_total_wealth": 234028.95,
    "renter_total_wealth": 266178.62,
    "net_advantage": -32149.66,
    "recommendation": "rent",
    "breakeven_year": null,
    "yearly": [
      {
        "year": 1,
        "buy_yearly_cost": 29918.58,
        "rent_yearly_cost": 26580.0,
        "home_value": 412000.0,
        "remaining_balance": 316423.28,
        "net_home_equity": 70856.72,
        "buyer_total_wealth": 70856.72,
        "renter_total_wealth": 106847.81,
        "net_advantage": -35991.09,
        "monthly_rent": 2266.0
      },
      {
        "year": 2,
        "buy_yearly_cost": 30223.28,
        "rent_yearly_cost": 27372.0,
        "home_value": 424360.0,
        "remaining_balance": 312607.02,
        "net_home_equity": 86291.38,
        "buyer_total_wealth": 86291.38,
        "renter_total_wealth": 122208.05,
        "net_advantage": -35916.67,
        "monthly_rent": 2333.98
      },
      {
        "year": 3,
        "buy_yearly_cost": 30539.07,
        "rent_yearly_cost": 28187.76,
        "home_value": 437090.8,
        "remaining_balance": 308535.17,
        "net_home_equity": 102330.18,
        "buyer_total_wealth": 102330.18,
        "renter_total_wealth": 138100.94,
        "net_advantage": -35770.76,
        "monthly_rent": 2404.0
      },
      {
        "year": 4,
        "buy_yearly_cost": 30866.41,
        "rent_yearly_cost": 29027.99,
        "home_value": 450203.52,
        "remaining_balance": 304190.63,
        "net_home_equity": 119000.68,
        "buyer_total_wealth": 119000.68,
        "renter_total_wealth": 154547.64,
        "net_advantage": -35546.96,
        "monthly_rent": 2476.12
      },
      {
        "year": 5,
        "buy_yearly_cost": 31205.79,
        "rent_yearly_cost": 29893.43,
        "home_value": 463709.63,
        "remaining_balance": 299555.13,
        "net_home_equity": 136331.92,
        "buyer_total_wealth": 136331.92,
        "renter_total_wealth": 171570.35,
        "net_advantage": -35238.42,
        "monthly_rent": 2550.4
      },
      {
        "year": 6,
        "buy_yearly_cost": 31557.71,
        "rent_yearly_cost": 30784.84,
        "home_value": 477620.92,
        "remaining_balance": 294609.18,
        "net_home_equity": 154354.49,
        "buyer_total_wealth": 154354.49,
        "renter_total_wealth": 189192.31,
        "net_advantage": -34837.82,
        "monthly_rent": 2626.92
      },
      {
        "year": 7,
        "buy_yearly_cost": 31922.72,
        "rent_yearly_cost": 31702.98,
        "home_value": 491949.55,
        "remaining_balance": 289331.98,
        "net_home_equity": 173100.59,
        "buyer_total_wealth": 173100.59,
        "renter_total_wealth": 207437.9,
        "net_advantage": -34337.31,
        "monthly_rent": 2705.72
      },
      {
        "year": 8,
        "buy_yearly_cost": 32301.38,
        "rent_yearly_cost": 32648.67,
        "home_value": 506708.03,
        "remaining_balance": 283701.37,
        "net_home_equity": 192604.18,
        "buyer_total_wealth": 192604.18,
        "renter_total_wealth": 226332.7,
        "net_advantage": -33728.52,
        "monthly_rent": 2786.89
      },
      {
        "year": 9,
        "buy_yearly_cost": 32694.27,
        "rent_yearly_cost": 33622.73,
        "home_value": 521909.27,
        "remaining_balance": 277693.66,
        "net_home_equity": 212901.06,
        "buyer_total_wealth": 212901.06,
        "renter_total_wealth": 245903.55,
        "net_advantage": -33002.49,
        "monthly_rent": 2870.5
      },
      {
        "year": 10,
        "buy_yearly_cost": 33102.01,
        "rent_yearly_cost": 34626.01,
        "home_value": 537566.55,
        "remaining_balance": 271283.6,
        "net_home_equity": 234028.95,
        "buyer_total_wealth": 234028.95,
        "renter_total_wealth": 266178.62,
        "net_advantage": -32149.66,
        "monthly_rent": 2956.62
      }
    ],
    "note": "The renter is assumed to invest the down payment, closing costs and any monthly cost difference at the given return."
  }
}
```

`result` holds the tool output. Errors come back as
`application/problem+json` with `type`, `title`, `status`, and `detail`.

### Getting a key

If `MINIWEBTOOL_API_KEY` is not already in the environment, stop and ask me for
one — do not sign up, scrape, or guess a key. Free keys: https://api.miniwebtool.com/dashboard/
Save as .cursor/rules/miniwebtool-rent-vs-buy-calculator.mdc
---
description: MiniWebtool Rent vs Buy Calculator API — usage and credit budget
globs:
alwaysApply: false
---

# MiniWebtool Rent vs Buy Calculator API

## The API

**Rent vs Buy Calculator** — Year-by-year wealth comparison of renting and investing versus buying, with the breakeven year.

- Live endpoint: `POST https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run` — costs 2 credits
- Dry run: `POST https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/dry-run` — costs 0 credits, same auth and validation
- Auth: `Authorization: Bearer <MINIWEBTOOL_API_KEY>`
- Content type: `application/json`
- Tool version: `2026-04-22` (output shape is stable within a major version)
- Full machine-readable spec: `https://api.miniwebtool.com/v1/openapi.json`

### Request body

| field | type | required | notes |
|---|---|---|---|
| `home_price` | float | no | purchase price (default `400000`) |
| `down_payment_pct` | float | no | down payment % of price (default `20`) |
| `mortgage_rate` | float | no | annual mortgage rate % (default `6.5`) |
| `loan_term` | str | no | one of: 30, 20, 15 — 30 \| 20 \| 15 (default `30`) |
| `property_tax_rate` | float | no | annual property tax % of value (default `1.1`) |
| `home_insurance` | float | no | annual homeowners insurance (default `1800`) |
| `hoa_fees` | float | no | monthly HOA fees (default `0`) |
| `maintenance_rate` | float | no | annual maintenance % of value (default `1.0`) |
| `closing_cost_pct` | float | no | closing costs % of price (default `3.0`) |
| `home_appreciation` | float | no | annual home appreciation % (default `3.0`) |
| `selling_cost_pct` | float | no | cost to sell % of value (default `6.0`) |
| `monthly_rent` | float | no | current monthly rent (default `2200`) |
| `rent_increase` | float | no | annual rent increase % (default `3.0`) |
| `renters_insurance` | float | no | monthly renters insurance (default `15`) |
| `investment_return` | float | no | annual investment return % (default `7.0`) |
| `tax_bracket` | float | no | marginal tax bracket % (default `22`) |
| `time_horizon` | int | no | years to compare (default `10`) |

Example request body:

```json
{
  "home_price": 400000,
  "down_payment_pct": 20,
  "mortgage_rate": 6.5,
  "loan_term": "30",
  "property_tax_rate": 1.1,
  "home_insurance": 1800,
  "hoa_fees": 0,
  "maintenance_rate": 1.0,
  "closing_cost_pct": 3.0,
  "home_appreciation": 3.0,
  "selling_cost_pct": 6.0,
  "monthly_rent": 2200,
  "rent_increase": 3.0,
  "renters_insurance": 15,
  "investment_return": 7.0,
  "tax_bracket": 22,
  "time_horizon": 10
}
```

### Response envelope

```json
{
  "request_id": "req_01H…",
  "tool": "rent-vs-buy-calculator",
  "tool_version": "2026-04-22",
  "credits_used": 2,
  "result": {
    "home_price": 400000.0,
    "down_payment": 80000.0,
    "loan_amount": 320000.0,
    "closing_costs": 12000.0,
    "monthly_mortgage_payment": 2022.62,
    "time_horizon_years": 10,
    "total_buying_cost": 406331.21,
    "total_renting_cost": 304446.41,
    "total_mortgage_interest": 193997.73,
    "total_tax_savings": 42679.5,
    "final_home_value": 537566.55,
    "final_net_home_equity": 234028.95,
    "buyer_total_wealth": 234028.95,
    "renter_total_wealth": 266178.62,
    "net_advantage": -32149.66,
    "recommendation": "rent",
    "breakeven_year": null,
    "yearly": [
      {
        "year": 1,
        "buy_yearly_cost": 29918.58,
        "rent_yearly_cost": 26580.0,
        "home_value": 412000.0,
        "remaining_balance": 316423.28,
        "net_home_equity": 70856.72,
        "buyer_total_wealth": 70856.72,
        "renter_total_wealth": 106847.81,
        "net_advantage": -35991.09,
        "monthly_rent": 2266.0
      },
      {
        "year": 2,
        "buy_yearly_cost": 30223.28,
        "rent_yearly_cost": 27372.0,
        "home_value": 424360.0,
        "remaining_balance": 312607.02,
        "net_home_equity": 86291.38,
        "buyer_total_wealth": 86291.38,
        "renter_total_wealth": 122208.05,
        "net_advantage": -35916.67,
        "monthly_rent": 2333.98
      },
      {
        "year": 3,
        "buy_yearly_cost": 30539.07,
        "rent_yearly_cost": 28187.76,
        "home_value": 437090.8,
        "remaining_balance": 308535.17,
        "net_home_equity": 102330.18,
        "buyer_total_wealth": 102330.18,
        "renter_total_wealth": 138100.94,
        "net_advantage": -35770.76,
        "monthly_rent": 2404.0
      },
      {
        "year": 4,
        "buy_yearly_cost": 30866.41,
        "rent_yearly_cost": 29027.99,
        "home_value": 450203.52,
        "remaining_balance": 304190.63,
        "net_home_equity": 119000.68,
        "buyer_total_wealth": 119000.68,
        "renter_total_wealth": 154547.64,
        "net_advantage": -35546.96,
        "monthly_rent": 2476.12
      },
      {
        "year": 5,
        "buy_yearly_cost": 31205.79,
        "rent_yearly_cost": 29893.43,
        "home_value": 463709.63,
        "remaining_balance": 299555.13,
        "net_home_equity": 136331.92,
        "buyer_total_wealth": 136331.92,
        "renter_total_wealth": 171570.35,
        "net_advantage": -35238.42,
        "monthly_rent": 2550.4
      },
      {
        "year": 6,
        "buy_yearly_cost": 31557.71,
        "rent_yearly_cost": 30784.84,
        "home_value": 477620.92,
        "remaining_balance": 294609.18,
        "net_home_equity": 154354.49,
        "buyer_total_wealth": 154354.49,
        "renter_total_wealth": 189192.31,
        "net_advantage": -34837.82,
        "monthly_rent": 2626.92
      },
      {
        "year": 7,
        "buy_yearly_cost": 31922.72,
        "rent_yearly_cost": 31702.98,
        "home_value": 491949.55,
        "remaining_balance": 289331.98,
        "net_home_equity": 173100.59,
        "buyer_total_wealth": 173100.59,
        "renter_total_wealth": 207437.9,
        "net_advantage": -34337.31,
        "monthly_rent": 2705.72
      },
      {
        "year": 8,
        "buy_yearly_cost": 32301.38,
        "rent_yearly_cost": 32648.67,
        "home_value": 506708.03,
        "remaining_balance": 283701.37,
        "net_home_equity": 192604.18,
        "buyer_total_wealth": 192604.18,
        "renter_total_wealth": 226332.7,
        "net_advantage": -33728.52,
        "monthly_rent": 2786.89
      },
      {
        "year": 9,
        "buy_yearly_cost": 32694.27,
        "rent_yearly_cost": 33622.73,
        "home_value": 521909.27,
        "remaining_balance": 277693.66,
        "net_home_equity": 212901.06,
        "buyer_total_wealth": 212901.06,
        "renter_total_wealth": 245903.55,
        "net_advantage": -33002.49,
        "monthly_rent": 2870.5
      },
      {
        "year": 10,
        "buy_yearly_cost": 33102.01,
        "rent_yearly_cost": 34626.01,
        "home_value": 537566.55,
        "remaining_balance": 271283.6,
        "net_home_equity": 234028.95,
        "buyer_total_wealth": 234028.95,
        "renter_total_wealth": 266178.62,
        "net_advantage": -32149.66,
        "monthly_rent": 2956.62
      }
    ],
    "note": "The renter is assumed to invest the down payment, closing costs and any monthly cost difference at the given return."
  }
}
```

`result` holds the tool output. Errors come back as
`application/problem+json` with `type`, `title`, `status`, and `detail`.

### Getting a key

If `MINIWEBTOOL_API_KEY` is not already in the environment, stop and ask me for
one — do not sign up, scrape, or guess a key. Free keys: https://api.miniwebtool.com/dashboard/

## Credit budget — follow these exactly

This API is metered. A live call costs 2 credits; the free tier
includes 1,000 credits per month. Burning them during integration is the
single most common way to waste this key.

1. **Do all wiring against `/dry-run`, which costs 0 credits.** It validates the
   payload for real and returns a sample result with the exact response shape.
   Iterate there until your request builds and your parsing works.
2. **Make at most ONE live `/run` call** — a single end-to-end confirmation once
   dry-run passes. Print the result, then stop.
3. **Never call the API from unit tests, examples, or a retry loop.** Assert
   against the sample response captured from `/dry-run` instead.
4. **On 4xx, fix the payload — do not retry.** The error body is RFC 7807
   `application/problem+json` and says exactly what is wrong.
5. **On 429, honour `Retry-After`** and back off; do not tighten the loop.
6. **Read `X-MWT-Credits-Remaining`** on every response. If it drops below 50,
   stop making live calls and tell me.
7. If the integration needs repeated calls at runtime, **cache by input** — this
   tool is deterministic, so the same input always returns the same output.
Skip the HTTP client — connect the agent directly.
Add the MiniWebtool MCP server to this project, then use the
`rent-vs-buy-calculator` tool from it.

Server URL: https://api.miniwebtool.com/v1/mcp
Transport: HTTP (Streamable HTTP / JSON-RPC 2.0)
Auth header: `Authorization: Bearer <MINIWEBTOOL_API_KEY>`

Claude Code:

```bash
claude mcp add --transport http miniwebtool https://api.miniwebtool.com/v1/mcp \
  --header "Authorization: Bearer $MINIWEBTOOL_API_KEY"
```

Or add it to the MCP config file your client uses:

```json
{
  "mcpServers": {
    "miniwebtool": {
      "type": "http",
      "url": "https://api.miniwebtool.com/v1/mcp",
      "headers": { "Authorization": "Bearer ${MINIWEBTOOL_API_KEY}" }
    }
  }
}
```

Once connected, `tools/list` exposes `rent-vs-buy-calculator` with its JSON Schema, so you can
call it directly instead of writing an HTTP client.

## Credit budget — follow these exactly

This API is metered. A live call costs 2 credits; the free tier
includes 1,000 credits per month. Burning them during integration is the
single most common way to waste this key.

1. **Do all wiring against `/dry-run`, which costs 0 credits.** It validates the
   payload for real and returns a sample result with the exact response shape.
   Iterate there until your request builds and your parsing works.
2. **Make at most ONE live `/run` call** — a single end-to-end confirmation once
   dry-run passes. Print the result, then stop.
3. **Never call the API from unit tests, examples, or a retry loop.** Assert
   against the sample response captured from `/dry-run` instead.
4. **On 4xx, fix the payload — do not retry.** The error body is RFC 7807
   `application/problem+json` and says exactly what is wrong.
5. **On 429, honour `Retry-After`** and back off; do not tighten the loop.
6. **Read `X-MWT-Credits-Remaining`** on every response. If it drops below 50,
   stop making live calls and tell me.
7. If the integration needs repeated calls at runtime, **cache by input** — this
   tool is deterministic, so the same input always returns the same output.
how-to call rent-vs-buy-calculator
  1. Get an API key
    Get an API key. Sign up free for a bearer token. 1,000 credits/month, no card.
  2. Assemble the JSON body
    Required fields: . See the Request body table above for the full schema.
  3. POST to https://api.miniwebtool.com/v1/tools/rent-vs-buy-calculator/run
    Headers: Authorization: Bearer <key> and Content-Type: application/json. Copy-paste snippets in 7 languages are under Code examples.
  4. Parse the response
    Envelope: {request_id, tool, tool_version, credits_used, result}. The typed output lives in result.
faq frequently asked
What does the Rent vs Buy Calculator API do?+

Year-by-year wealth comparison of renting and investing versus buying, with the breakeven year. Use it to add this utility without rebuilding formulas, validation, examples, and documentation.

How much does one call to Rent vs Buy Calculator cost?+

2 credits per successful call. Failed calls (validation errors, 5xx) don't bill.

What parameters does the Rent vs Buy Calculator API require?+

Required fields: (none). Full schema at /v1/openapi.json.

Is the Rent vs Buy Calculator API deterministic?+

Yes — same input, same output, forever. Tool version 2026-04-22; output shape is stable within a major version.

Can an AI agent call the Rent vs Buy Calculator API?+

Yes. Connect to https://api.miniwebtool.com/v1/mcp over the Model Context Protocol. The agent discovers `rent-vs-buy-calculator` with its JSON Schema automatically, so the model can plan while MiniWebtool handles the exact tool result.

What format does the API return?+

JSON with a stable envelope: `{request_id, tool, tool_version, credits_used, result}`. Errors are RFC 7807 `application/problem+json`.

mcp use from an AI agent

Every endpoint on this site is also exposed via the Model Context Protocol at https://api.miniwebtool.com/v1/mcp. Claude, Cursor, and any MCP-capable agent can discover this tool (rent-vs-buy-calculator) and its JSON Schema automatically — no client codegen.

# List tools the agent can call
curl -s https://api.miniwebtool.com/v1/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
 | jq '.result.tools[] | select(.name=="rent-vs-buy-calculator")'
see-also related finance tools