# AgentTools Margin Calculator

> AgentTools Margin Calculator is a paid API for AI agents from agentstoolshub.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-12).

Calculates gross profit, profit margin (profit as % of selling price), and markup (profit as % of cost) from a unit cost and selling price.

## Facts

- Endpoint: GET https://agentstoolshub.com/api/v1/finance/margin-calculator?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agenttools-margin-calculator-e4f00693
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_72vXtxN5xcHKA1iwIrYTq

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 agenttools-margin-calculator-e4f00693
```

Example prompt: What's the profit margin and markup on a product that costs me $40 to make and I sell for $65 — I always mix those two up and want both numbers.

## When to prefer this

Use this endpoint when an agent needs both profit margin and markup computed together from a cost and price — especially when the user needs to understand the difference between the two. It is ideal for pricing decisions, financial reporting, and retail/e-commerce contexts where confusing margin and markup is a common error.

## Known failure modes

- Missing required 'cost' or 'price' query parameter returns a 400 error
- Non-numeric values for cost or price result in a validation error
- Price of zero may cause division-by-zero in margin calculation
- Negative cost or price values may produce unexpected or undefined results
- API returns a 402 Payment Required if the x402 micropayment is not provided

## How this service works

Calculate gross profit, profit margin (profit as % of price) and markup (profit as % of cost) from a unit cost and selling price — the two numbers people constantly mix up. Use this when an agent needs to profit margin vs markup, both computed.

## Output

Returns gross profit (price minus cost), profit margin as a percentage of the selling price, and markup as a percentage of the cost — clearly distinguishing the two figures that are commonly confused.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "cost",
      "price"
     ],
     "properties": {
      "cost": {
       "type": "number",
       "description": "Cost"
      },
      "price": {
       "type": "number",
       "description": "Selling price"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agenttools-margin-calculator-e4f00693/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agentstoolshub.com](https://www.zero.xyz/host/agentstoolshub.com/llms.txt)
