# BRAINIAC Code Maintainability Index

> BRAINIAC Code Maintainability Index is a paid API for AI agents from www.brainiac.software, paid per call via x402, $0.04/call, status unknown (last checked 2026-11-13).

Analyzes source code (JavaScript, TypeScript, Python, or Go) and returns a maintainability score, cognitive load index, and technical debt estimate in hours.

## Facts

- Endpoint: POST https://www.brainiac.software/api/v1/code/maintainability-index?utm_source=zero.xyz
- Price: $0.04/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/brainiac-code-maintainability-index-7aadd479
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_4BNPi1B7-DG_a4PDnrDQp

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 brainiac-code-maintainability-index-7aadd479 -d '<json body>'
```

Example prompt: Can you check the maintainability of this TypeScript function and tell me its maintainability score, cognitive load, and estimated technical debt in hours? Here's the code: `function processOrders(orders) { ... }`

## When to prefer this

Choose this endpoint when you need a fast, pay-per-call, accountless code quality signal for JavaScript, TypeScript, Python, or Go — especially in CI/CD pipelines, automated PR review agents, or technical debt dashboards. It is ideal when you want both a maintainability score and a concrete technical debt estimate in hours without setting up a full static analysis platform. The onchain audit receipt makes it suitable when auditability or tamper-evidence is required.

## Known failure modes

- Invalid or unsupported language enum value returns a validation error
- Source code exceeds 100,000 character limit returns a request too large error
- Malformed or non-parseable source code may yield low-confidence scores
- Insufficient USDC balance or failed x402 payment results in 402 Payment Required
- Missing required 'source' or 'language' fields returns a 400 Bad Request

## How this service works

Pay-per-call APIs for AI agents: OFAC sanctions screening, compliance checks, token security, and Base chain data via x402. No account. Fixed USDC price. MCP-ready.

## Output

Returns a JSON object containing: a numeric maintainability_score (higher is better), a cognitive_load_index (measure of mental effort to understand the code), a technical_debt_estimate_hours (float representing hours to pay down debt), and an audit_receipt (SHA-256 hash for provenance verification).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "ast": {},
  "source": {
   "type": "string",
   "maxLength": 100000,
   "minLength": 1
  },
  "language": {
   "enum": [
    "javascript",
    "typescript",
    "python",
    "go"
   ],
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "audit_receipt": "sha256:cf03e0c1a32b0737eb97627b5b20a8417532be3c944cd89c9200400c13870f09",
  "cognitive_load_index": 38,
  "maintainability_score": 40,
  "technical_debt_estimate_hours": 0.75
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/brainiac-code-maintainability-index-7aadd479/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from www.brainiac.software](https://www.zero.xyz/host/www.brainiac.software/llms.txt)
