{"uid":"cap_8Qgx51U3EzodO6fuXU7Ws","slug":"coinopselect-code-refactor-suggest-api-9a06d819","name":"CoinOpSelect Code Refactor Suggest API","description":"Paid on-chain token, wallet, contract and research data over x402 on Base.","url":"https://coinop.publicvm.com/api/v1/code/refactor-suggest?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"source":{"type":"string"}}},"responseSchema":{"type":"json","example":{"query":"refactor-suggest","result":{}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_UK0am9DV6Nmxa_CosYEse","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Accepts source code and returns AI-generated refactoring suggestions, paid per call via x402 on Base.","exampleAgentPrompt":"Can you suggest refactoring improvements for this code snippet: `function calcTotal(items) { let t = 0; for(let i=0;i<items.length;i++){t+=items[i].price;} return t; }`?","exampleUseCases":[{"title":"Refactor legacy function for readability","prompt":"Here's a messy legacy JavaScript function I inherited — can you suggest refactoring improvements to make it more readable and maintainable? `function proc(d,x){var r=[];for(var i=0;i<d.length;i++){if(d[i]>x)r.push(d[i]);}return r;}`"},{"title":"Improve Python class structure","prompt":"Can you suggest how to refactor this Python class to follow better design patterns and reduce duplication? `class DataProcessor: def process_csv(self, f): ... def process_json(self, f): ...`"},{"title":"Optimize loop-heavy code","prompt":"I have some Solidity code with nested loops that feels inefficient — please suggest refactoring ideas to clean it up and reduce complexity: `for(uint i=0;i<arr.length;i++){for(uint j=0;j<arr2.length;j++){...}}`"}],"resultDescription":"Returns a JSON object containing refactoring suggestions and recommendations for the provided source code, typically including identified issues, proposed improvements, and potentially restructured code snippets.","failureModes":["Empty or missing source field returns empty result object","Malformed JSON body returns HTTP 400","Payment not provided or x402 handshake fails returns HTTP 402","Very large code inputs may exceed processing limits","Non-code text input may yield low-quality or generic suggestions"],"whenToPreferThis":"Choose this endpoint when you need quick, on-demand AI-powered refactoring suggestions for code snippets and are comfortable paying $0.01 USDC per call via x402 on Base. Suitable for agents embedded in developer workflows or CI pipelines that need programmatic code quality feedback without a subscription.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:20:55.537Z","isFirstParty":false,"canonicalSlug":"coinopselect-code-refactor-suggest-api-9a06d819"}