# Factorial for Agents

> Factorial for Agents is a paid API for AI agents from api.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-13).

Computes n! (factorial) for integer n up to 20, returning the exact result or a structured error for out-of-range inputs, billed at $0.001 USDC per successful call via x402 on Base.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/factorial
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/factorial-for-agents-7bb01dec
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_e6hgcypYNWX8UaTkHZCbh

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 factorial-for-agents-7bb01dec -d '<json body>'
```

Example prompt: What is the factorial of 12?

## When to prefer this

Choose this endpoint when you need a deterministic, first-party factorial computation without shipping a math library or managing dependencies. Ideal for agentic pipelines, combinatorics demos, test fixtures, or educational tools where n is guaranteed to be 20 or below and you want a pay-per-call model with no API key or subscription overhead.

## Known failure modes

- n > 20: returns a structured error indicating n exceeds the allowed cap, no charge
- n < 0: returns a structured validation error for negative input
- non-integer n: schema validation error, not billed
- missing n field: structured validation error, not billed
- payment failure: x402 payment rejected, call not executed

## How this service works

Factorial (n≤20). Call for combinatorics demos and small counting problems with an explicit n cap. Returns n! for n up to 20; larger n returns a structured error. $0.001 USDC per successful call via x402 on Base—deterministic first-party JSON, no API key, no subscription, and nothing is billed on structured validation errors.

## Output

Returns a JSON object containing the computed factorial value (n!) as an integer for valid inputs (0 ≤ n ≤ 20). For n > 20 or invalid inputs, returns a structured JSON error indicating the out-of-range condition. Successful calls are billed $0.001 USDC; structured validation errors are not billed.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "n": {
   "type": "integer",
   "description": "Integer input (see tool summary for allowed range)."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "n": 12,
  "value": 479001600,
  "schema": "delx/factorial/v1"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/factorial-for-agents-7bb01dec/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.delx.ai](https://www.zero.xyz/host/api.delx.ai/llms.txt)
