# Number Theory Modular Exponentiation (modpow)

> Number Theory Modular Exponentiation (modpow) is a paid API for AI agents from numtheory.openverbs.com, paid per call via x402, $0.004/call, status unknown (last checked 2026-09-14).

Computes modular exponentiation: (base ^ exponent) mod modulus for arbitrarily large integers supplied as decimal strings.

## Facts

- Endpoint: POST https://numtheory.openverbs.com/v1/modpow
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/number-theory-modular-exponentiation-modpow-523722cb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Asi09zNY46zbyC3YkrfOm

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 number-theory-modular-exponentiation-modpow-523722cb -d '<json body>'
```

Example prompt: Can you compute 7 raised to the power of 256, mod 1000000007? I need the result as a decimal integer.

## When to prefer this

Choose this endpoint when you need server-side modular exponentiation on arbitrarily large integers without implementing big-integer libraries locally — especially for cryptographic primitives (RSA, Diffie-Hellman, primality testing) or number-theory computations where JavaScript/Python native integers may overflow or be slow. Prefer it over general-purpose math APIs when the specific operation is modpow and inputs are provided as decimal strings.

## Known failure modes

- Non-numeric or negative base/exponent/modulus strings rejected with validation error
- Modulus of zero causes division-by-zero / invalid input error
- Missing required fields (base, exponent, or modulus) return 400-level schema validation error
- Payment not settled returns 402 Payment Required
- Extremely large inputs may time out or return a compute-limit error

## How this service works

Compute (base ^ exponent) mod modulus efficiently for arbitrary-precision integers. The modulus must be positive.

## Output

Returns the computed value of (base ^ exponent) mod modulus as a decimal string, supporting arbitrarily large integers.

## Request schema (JSON Schema)

```json
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "type": "object",
 "properties": {
  "input": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "type": "string",
     "enum": [
      "POST"
     ]
    },
    "bodyType": {
     "type": "string",
     "enum": [
      "json",
      "form-data",
      "text"
     ]
    },
    "body": {
     "type": "object",
     "properties": {
      "base": {
       "type": "string",
       "pattern": "^\\d+$",
       "description": "Non-negative base as a decimal string."
      },
      "exponent": {
       "type": "string",
       "pattern": "^\\d+$",
       "description": "Non-negative exponent as a decimal string."
      },
      "modulus": {
       "type": "string",
       "pattern": "^\\d+$",
       "description": "Positive modulus as a decimal string."
      }
     },
     "required": [
      "base",
      "exponent",
      "modulus"
     ],
     "additionalProperties": false
    }
   },
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "additionalProperties": false
  }
 },
 "required": [
  "input"
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/number-theory-modular-exponentiation-modpow-523722cb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from numtheory.openverbs.com](https://www.zero.xyz/host/numtheory.openverbs.com/llms.txt)
