# Ailabra Profit Calculator

> Ailabra Profit Calculator is a paid API for AI agents from x402.ailabra.org, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Calculates deterministic profit and cash flow metrics from a batch of structured autonomous-agent economic events.

## Facts

- Endpoint: POST https://x402.ailabra.org/api/v1/x402/profit/calculate
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/ailabra-profit-calculator-091637d1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_jX_4hvLo9DXPyuqKgUAr2

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 ailabra-profit-calculator-091637d1 -d '<json body>'
```

Example prompt: Calculate the profit and cash flow for my AI agent venture 'venture-42' from these events: a $500 USDC revenue inflow from customer 'cust-001' on 2024-06-01, a $50 USDC fee outflow on 2024-06-02, and a $20 USDC refund outflow on 2024-06-03 — all self-reported and categorized as 'saas-sales' or 'platform-fee'.

## When to prefer this

Use this endpoint when you need a deterministic, auditable profit and cash flow computation from structured agent economic events, especially in x402-payment-enabled autonomous agent pipelines. Prefer it over generic accounting APIs when your events include x402 payment IDs, on-chain transaction hashes, agent/venture/experiment IDs, or when you need schema-validated verification levels (onchain_verified, receipt_verified, etc.).

## Known failure modes

- Missing required event fields (schemaVersion, externalId, occurredAt, kind, direction, amount, currency, category, source) return validation errors
- Invalid amount format (non-numeric or negative) triggers pattern validation failure
- Currency code not matching ^[A-Z][A-Z0-9]{1,11}$ returns schema error
- Submitting more than 1000 events in a single call returns a maxItems violation
- Invalid kind or direction enum values return enum constraint errors
- Payment failure (insufficient USDC balance) results in 402 response before processing

## How this service works

Calculate deterministic profit and cash flow from autonomous-agent economic events.

## Output

A deterministic profit and cash flow summary computed from the submitted economic events. The response aggregates inflows and outflows by kind (revenue, expense, fee, refund, etc.), applies asset and adjustment policies, and returns net profit, total inflows, total outflows, and per-category breakdowns.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "events": {
   "type": "array",
   "items": {
    "$id": "https://x402.ailabra.org/api/v1/schemas/economic-event",
    "type": "object",
    "title": "Ailabra Economic Event v1",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "required": [
     "schemaVersion",
     "externalId",
     "occurredAt",
     "kind",
     "direction",
     "amount",
     "currency",
     "category",
     "source"
    ],
    "properties": {
     "kind": {
      "enum": [
       "revenue",
       "expense",
       "refund",
       "fee",
       "transfer",
       "capital",
       "withdrawal",
       "asset_purchase",
       "asset_sale",
       "adjustment"
      ],
      "type": "string"
     },
     "amount": {
      "type": "string",
      "pattern": "^(?:0|[1-9]\\d*)(?:\\.\\d+)?$"
     },
     "source": {
      "type": "object",
      "required": [
       "name",
       "type",
       "verification"
      ],
      "properties": {
       "name": {
        "type": "string",
        "maxLength": 120,
        "minLength": 1,
        "description": "Identifies the originating ledger or integration and participates in duplicate detection with externalId."
       },
       "type": {
        "type": "string"
       },
       "reference": {
        "type": "string"
       },
       "verification": {
        "enum": [
         "self_reported",
         "receipt_supplied",
         "receipt_verified",
         "onchain_verified",
         "system_observed"
        ],
        "type": "string"
       }
      },
      "additionalProperties": false
     },
     "agentId": {
      "type": "string"
     },
     "category": {
      "type": "string",
      "maxLength": 120,
      "minLength": 1
     },
     "currency": {
      "type": "string",
      "pattern": "^[A-Z][A-Z0-9]{1,11}$"
     },
     "metadata": {
      "type": "object"
     },
     "direction": {
      "enum": [
       "inflow",
       "outflow"
      ],
      "type": "string"
     },
     "productId": {
      "type": "string"
     },
     "ventureId": {
      "type": "string"
     },
     "adjustment": {
      "type": "object",
      "required": [
       "reason",
       "profitTreatment"
      ],
      "properties": {
       "reason": {
        "type": "string"
       },
       "profitTreatment": {
        "enum": [
         "revenue",
         "cost",
         "exclude"
        ],
        "type": "string"
       }
      }
     },
     "customerId": {
      "type": "s
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "totals": {
   "USDC": {
    "netOperatingProfit": "82.5"
   }
  },
  "schemaVersion": "2",
  "serviceVersion": "1.0.9",
  "calculationEngineVersion": "2.0.0"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/ailabra-profit-calculator-091637d1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.ailabra.org](https://www.zero.xyz/host/x402.ailabra.org/llms.txt)
