{"uid":"cap_4BNPi1B7-DG_a4PDnrDQp","slug":"brainiac-code-maintainability-index-7aadd479","name":"BRAINIAC Code Maintainability Index","description":"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.","url":"https://www.brainiac.software/api/v1/code/maintainability-index?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"ast":{},"source":{"type":"string","maxLength":100000,"minLength":1},"language":{"enum":["javascript","typescript","python","go"],"type":"string"}}},"responseSchema":{"type":"json","example":{"audit_receipt":"sha256:cf03e0c1a32b0737eb97627b5b20a8417532be3c944cd89c9200400c13870f09","cognitive_load_index":38,"maintainability_score":40,"technical_debt_estimate_hours":0.75}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.04","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.04/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.04","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.04","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_YrwGGIsGPIdZtKhIqGY3z","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.04","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Analyzes source code (JavaScript, TypeScript, Python, or Go) and returns a maintainability score, cognitive load index, and technical debt estimate in hours.","exampleAgentPrompt":"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) { ... }`","exampleUseCases":[{"title":"Pre-merge code quality gate","prompt":"Before I merge this Python function into main, can you run a maintainability analysis on it and tell me the maintainability score, cognitive load index, and technical debt estimate? Here's the code: `def calculate_invoice(items, discounts, tax_rate): ...`"},{"title":"Refactoring priority ranking","prompt":"I have this Go function that I suspect is hard to maintain — can you score its maintainability, cognitive load, and technical debt so I know if it should be top of my refactoring list? Code: `func aggregateMetrics(data []Record) Result { ... }`"},{"title":"Developer onboarding code review","prompt":"I'm onboarding a new dev and want to show them areas of high technical debt — can you analyze this JavaScript module for its maintainability score and cognitive load index so we know what to tackle first? Here's the source: `function handleWebhook(req, res) { ... }`"}],"resultDescription":"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).","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-13T18:46:03.048Z","isFirstParty":false,"canonicalSlug":"brainiac-code-maintainability-index-7aadd479"}