# DataForge Linear Regression API

> DataForge Linear Regression API is a paid API for AI agents from dataforge-production-ba33.up.railway.app, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-14).

Fits a simple linear regression to paired x/y data points and returns slope, intercept, and R² correlation statistics

## Facts

- Endpoint: POST https://dataforge-production-ba33.up.railway.app/api/linear-regression?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/dataforge-linear-regression-api-8c15dd6d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_EYSuoQTQDnlxFD4QbBhxv

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 dataforge-linear-regression-api-8c15dd6d -d '<json body>'
```

Example prompt: Can you run a linear regression on this dataset — x values are [1, 2, 3, 4, 5] and y values are [2.1, 3.9, 6.2, 7.8, 10.1] — and tell me the slope, intercept, and R-squared?

## When to prefer this

Choose this endpoint when you need fast, cheap linear regression statistics (slope, intercept, R, R²) for pairs of numeric arrays without setting up a local data science environment. At $0.005 per call it is ideal for agent workflows, automation pipelines, or operational dashboards that need statistical summaries on demand. Prefer this over a general-purpose compute service when the input is already clean numeric arrays and you only need simple linear fit statistics.

## Known failure modes

- Mismatched array lengths between x and y cause a 400 error
- Fewer than two data points provided — regression is undefined
- Non-numeric values in arrays cause parsing or validation errors
- Payment not included or insufficient — 402 Payment Required response
- Empty arrays or null inputs return an error

## How this service works

Low-cost statistical and analytical micro-APIs for agents and operations workflows.

## Output

Returns a JSON object with four fields: slope (rate of change of y per unit x), intercept (y-axis crossing point of best-fit line), r (Pearson correlation coefficient), and r2 (coefficient of determination indicating proportion of variance explained). Values are floating-point numbers.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "x": {
   "type": "array",
   "items": {
    "type": "number"
   }
  },
  "y": {
   "type": "array",
   "items": {
    "type": "number"
   }
  },
  "points": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "x": {
      "type": "number"
     },
     "y": {
      "type": "number"
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "r": 0.999,
  "r2": 0.998,
  "slope": 2.03,
  "intercept": -0.03
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/dataforge-linear-regression-api-8c15dd6d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from dataforge-production-ba33.up.railway.app](https://www.zero.xyz/host/dataforge-production-ba33.up.railway.app/llms.txt)
