$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-metrics2
Calls / 30d
2
Unique payers / 30d
Aug 31
Last called
exact
Payment scheme
Call this service
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 -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
0xa0bfa4f07281c9b248dc3aed2217836bca24869bUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913Is this your API?
Pin it to the top of Developer Tools and the homepage with a featured placement.
More from API Acre & similar services
API Acre · Crypto Base Network Status
apiacre.com
Read the latest Base mainnet block and a bounded EIP-1559 fee history in one RPC batch, including gas utilization and priority-fee percentile samples.
API Acre · WEB Metadata
apiacre.com
Extract webpage metadata from one public URL: page title, meta description, canonical URL, headings, hreflang, icons, feeds, Open Graph, Twitter Cards, and JSON-LD Schema.org types, with redirect and response provenance plus privacy-safe, publisher-asserted Organization facts with field evidence.
API Acre · Data Schema
apiacre.com
Create and generate a nested JSON Schema Draft 2020-12 contract by inferring field types and required fields from representative JSON, CSV, TSV, JSON Lines, or YAML records, with equivalent CSV/TSV numeric and null inference, input evidence, and non-enforcing observed bounds.