# OpenVerbs Linear Regression

> OpenVerbs Linear Regression is a paid API for AI agents from stats.openverbs.com, paid per call via x402, $0.004/call, status unknown (last checked 2026-09-15).

Fits a simple linear regression to paired x/y data arrays and optionally predicts y at a given x value

## Facts

- Endpoint: POST https://stats.openverbs.com/v1/regression
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/openverbs-linear-regression-2f1b07ae
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_vy7IIbe15BGALEeyBanZF

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 openverbs-linear-regression-2f1b07ae -d '<json body>'
```

Example prompt: Can you fit a linear regression to my data — x is [1, 2, 3, 4, 5] and y is [2.1, 3.9, 6.2, 7.8, 10.1] — and predict what y would be at x = 6?

## When to prefer this

Choose this endpoint when you need a quick, serverless linear regression computation without standing up your own statistical environment. It is ideal for simple bivariate relationships where a straight-line fit is appropriate, especially when you also want a point prediction at a specific x value. Prefer it over general-purpose compute endpoints when you want a clean, purpose-built statistical API that accepts raw numeric arrays directly.

## Known failure modes

- x and y arrays of different lengths — validation error returned
- fewer than 2 data points provided — minimum constraint violated
- non-numeric values in x or y arrays — schema validation failure
- arrays exceeding 100,000 items — maxItems constraint rejection
- payment not provided or insufficient — 402 Payment Required
- perfectly vertical data (all x values identical) — undefined slope / division-by-zero error

## How this service works

Ordinary-least-squares linear regression of y on x: slope, intercept, correlation r and coefficient of determination r². Pass predictAt to also evaluate the fitted line at a given x. Rejected as a clean 400 if lengths differ or x has zero variance.

## Output

Returns the fitted linear regression parameters including slope, intercept, and R-squared (goodness-of-fit). If predictAt is provided, also returns the predicted y value at that x coordinate. The result enables the caller to understand the linear relationship between the two variables and make point predictions.

## 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": {
      "x": {
       "type": "array",
       "items": {
        "type": "number"
       },
       "minItems": 2,
       "maxItems": 100000,
       "description": "Independent variable."
      },
      "y": {
       "type": "array",
       "items": {
        "type": "number"
       },
       "minItems": 2,
       "maxItems": 100000,
       "description": "Dependent variable (same length as x)."
      },
      "predictAt": {
       "type": "number",
       "description": "Optional x at which to evaluate the fitted line."
      }
     },
     "required": [
      "x",
      "y"
     ],
     "additionalProperties": false
    }
   },
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "additionalProperties": false
  }
 },
 "required": [
  "input"
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/openverbs-linear-regression-2f1b07ae/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from stats.openverbs.com](https://www.zero.xyz/host/stats.openverbs.com/llms.txt)
