DEV Community

2x lazymac
2x lazymac

Posted on • Originally published at api.lazy-mac.com

How to Use the Crypto Tax Calculator API — Free REST + MCP Server

Tax season with crypto is painful. Different cost basis methods give wildly different results — FIFO might save you thousands vs LIFO depending on market conditions. This API calculates capital gains and losses using all three methods so you can pick the optimal one.

Try It Right Now

curl -s https://api.lazy-mac.com/crypto-tax/api/v1/methods | jq
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "methods": [
    {
      "id": "fifo",
      "name": "First In First Out",
      "description": "Sells the oldest purchased coins first."
    },
    {
      "id": "lifo",
      "name": "Last In First Out",
      "description": "Sells the most recently purchased coins first."
    },
    {
      "id": "average",
      "name": "Average Cost",
      "description": "Uses the weighted average cost of all holdings."
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Calculate Capital Gains

curl -s -X POST https://api.lazy-mac.com/crypto-tax/api/v1/calculate \
  -H "Content-Type: application/json" \
  -d '{
    "method": "fifo",
    "transactions": [
      {"type": "buy", "amount": 1.0, "price": 30000, "date": "2025-01-15"},
      {"type": "buy", "amount": 0.5, "price": 45000, "date": "2025-06-01"},
      {"type": "sell", "amount": 0.8, "price": 50000, "date": "2025-12-01"}
    ]
  }' | jq
Enter fullscreen mode Exit fullscreen mode

All Endpoints

Endpoint Description
POST /api/v1/calculate Calculate gains with specific method
POST /api/v1/csv Upload CSV of transactions
GET /api/v1/methods List supported accounting methods
POST /api/v1/summary Annual summary report

Compare All Methods

Run the same transactions through FIFO, LIFO, and Average to find which saves you the most:

import requests

txns = [
    {"type": "buy", "amount": 1.0, "price": 30000, "date": "2025-01-15"},
    {"type": "sell", "amount": 0.5, "price": 55000, "date": "2025-11-01"}
]

for method in ["fifo", "lifo", "average"]:
    r = requests.post(
        "https://api.lazy-mac.com/crypto-tax/api/v1/calculate",
        json={"method": method, "transactions": txns}
    ).json()
    print(f"{method.upper()}: {r}")
Enter fullscreen mode Exit fullscreen mode

Use as an MCP Server

{
  "mcpServers": {
    "crypto-tax": {
      "url": "https://api.lazy-mac.com/crypto-tax/mcp"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Ask Claude: "Calculate my capital gains for these trades using FIFO"

Pricing

Tier Requests/mo Price
Free 100 $0
Pro 10,000 $9/mo
Business Unlimited $49/mo

Get Pro Access on Gumroad →


Browse all 22 APIs at api.lazy-mac.com →

More from the lazymac API Toolkit:

Top comments (0)