API Acre · Developer Code Metrics

by API Acre

POSTBaseSolana

$0.025

per call · USD Coin on Base

Measure caller-supplied source code with Python AST analysis or a deterministic lexical fallback, including per-function complexity, a SHA-256 fingerprint, density ratios, syntax status, and actionable maintainability signals without retaining or forwarding the code.

Endpoint

POST https://apiacre.com/v1/developer/code-metrics

2

Calls / 30d

2

Unique payers / 30d

Aug 31

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://apiacre.com/v1/developer/code-metrics", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "code": "def greet(name):\n    return f'Hello {name}'",
    "language": "python"
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://apiacre.com/v1/developer/code-metrics" \
  -H "Content-Type: application/json" \
  -d '{"code":"def greet(name):\n    return f'Hello {name}'","language":"python"}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "data": {
    "analysis": {
      "limitations": [
        "AST complexity is a static heuristic, not a runtime or co...",
        "Comment counts include comment-only lines, not inline com..."
      ],
      "method": "Python AST with deterministic lexical metrics",
      "version": "apiacre-code-metrics/3"
    },
    "averageLineLength": 21,
    "blankLineDensity": 0,
    "branchPoints": 0,
    "classes": 0,
    "commentDensity": 0,
    "complexityPerFunction": 1,
    "estimatedCyclomaticComplexity": 1,
    "functionMetrics": [
      {
        "endLine": 2,
        "kind": "function",
        "line": 1,
        "name": "greet"
      }
    ],
    "functions": 1,
    "functionsTruncated": false,
    "language": "python",
    "lines": {
      "blank": 0,
      "code": 2,
      "comments": 0,
      "total": 2
    },
    "longLineCount": 0,
    "maintainabilitySignal": 95,
    "maximumFunctionComplexity": 1,
    "maximumLineLength": 26,
    "reviewSignals": [],
    "source": {
      "characters": 43,
      "sha256": "d588756864c1c6b9016a1829ea9283915950ef23e5b1c04018413ed71...",
      "utf8Bytes": 43
    },
    "syntax": {
      "engine": "python-ast",
      "error": null,
      "valid": true
    },
    "workMarkerCount": 0
  },
  "meta": {
    "cached": false,
    "duration_ms": 42,
    "next_actions": [
      {
        "method": "POST",
        "reason": "Compare the measured source with a caller-supplied baseli...",
        "service": "developer.code-change-review",
        "title": "Code change review"
      }
    ],
    "sources": [],
    "warnings": []
  },
  "request_id": "018f1f54-7f38-7ba2-8dc3-5f90272d9f1a",
  "service": "developer.code-metrics",
  "version": "1"
}

Payment details

Pay to0xa0bfa4f07281c9b248dc3aed2217836bca24869b
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase, Solana
Schemesexact

Is this your API?

Pin it to the top of Developer Tools and the homepage with a featured placement.

Get featured →

More from API Acre & similar services