{"uid":"cap_ZDOWR--MvxgDMUeAj-GyG","slug":"momoai-code-review-76edc3cb","name":"momoAI Code Review","description":"Pay-per-use LLM API. Chat, reasoning, code review, translation, summarization, data extraction, and more. Pay with USDC on Base.","url":"https://aimomo.vercel.app/api/code","method":"POST","headers":{},"bodySchema":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Source code to review"},"focus":{"type":"string"},"language":{"type":"string","description":"Programming language (auto-detect if omitted)"}}},"responseSchema":{"type":"object","properties":{"data":{"type":"object","properties":{"model":{"type":"string"},"usage":{"type":"object"},"review":{"type":"object","properties":{"score":{"type":"integer"},"issues":{"type":"array"},"summary":{"type":"string"},"suggestions":{"type":"array"}}}}},"meta":{"type":"object","properties":{"focus":{"type":"string"},"price":{"type":"string"},"endpoint":{"type":"string"},"language":{"type":"string"},"timestamp":{"type":"string"}}},"success":{"type":"boolean"}}},"example":{"request":{"code":"def calculate_sum(numbers):\n    total = 0\n    for num in numbers:\n        total += num\n    return total\n\nresult = calculate_sum([1, 2, 3, 4, 5])\nprint(result)","focus":"code quality and best practices","language":"python"},"response":{"data":{"model":"mimo-v2.5-pro","usage":{"total_tokens":1708,"prompt_tokens":167,"completion_tokens":1541,"prompt_tokens_details":{},"completion_tokens_details":{"reasoning_tokens":1031}},"review":{"score":5,"issues":["No docstring or comments provided for the function, reducing readability and maintainability.","Lack of type hints, which hinders code clarity and static analysis.","The function implementation uses a manual loop instead of leveraging Python's built-in `sum()` function, which is more efficient and Pythonic.","Global code (function call and print statement) is not protected by a `if __name__ == '__main__':` guard, preventing proper module reuse.","Potential runtime errors if the input list contains non-numeric types (e.g., strings) or is not iterable, with no error handling or validation."],"summary":"The code is functionally correct and simple, but it lacks key Python best practices such as documentation, type hints, use of built-in functions, and proper module structure. These omissions reduce code quality, readability, and maintainability. Implementing the suggested improvements would enhance the code's robustness and adherence to Python standards.","suggestions":["Add a docstring to describe the function's purpose, parameters, and return value for better documentation.","Include type hints to improve code clarity and support static type checking tools.","Simplify the function by using the built-in `sum()` function, which is optimized and reduces code redundancy.","Wrap the execution code in a `if __name__ == '__main__':` block to allow the module to be imported without side effects.","Consider adding input validation or error handling to make the function more robust, especially for edge cases like non-numeric inputs.","Example improved code: ```python\ndef calculate_sum(numbers: list[float]) -> float:\n    \"\"\"Calculate the sum of a list of numbers.\n    \n    Args:\n        numbers: A list of numeric values.\n    \n    Returns:\n        The sum of the numbers.\n    \n    Raises:\n        TypeError: If input is not a list or contains non-numeric types.\n    \"\"\"\n    if not isinstance(numbers, list):\n        raise TypeError(\"Input must be a list\")\n    return sum(numbers)\n\nif __name__ == '__main__':\n    result = calculate_sum([1, 2, 3, 4, 5])\n    print(result)\n```"]}},"meta":{"focus":"code quality and best practices","model":"mimo-v2.5-pro","price":"$0.08","endpoint":"/api/code","language":"python","provider":"mimo","timestamp":"2026-06-20T05:44:59.313Z"},"success":true}},"exampleRequest":{"code":"def calculate_sum(numbers):\n    total = 0\n    for num in numbers:\n        total += num\n    return total\n\nresult = calculate_sum([1, 2, 3, 4, 5])\nprint(result)","focus":"code quality and best practices","language":"python"},"tags":["x402"],"displayCostAmount":"0.08","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","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.08/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.08","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.08","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_OgV8ZaSWlU9ZPambbEH4s","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.08","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Submits source code for AI-powered review, returning a quality score, identified issues, and improvement suggestions.","exampleAgentPrompt":"Can you review this Python function for me and score it — focus on security issues: `def login(user, pw): return db.query(f'SELECT * FROM users WHERE user={user} AND pw={pw}')`?","exampleUseCases":[{"title":"Automated PR code quality gate","prompt":"Before we merge this pull request, can you run a quality check on the changed functions and give me a score? If it's below 75 or there are any critical issues flagged, I want to know exactly what needs to be fixed before we approve it."},{"title":"Find security vulnerabilities in snippet","prompt":"I've got this JavaScript authentication handler and I'm worried it might have security holes — can you analyze it for vulnerabilities and tell me what's risky and how to fix it? Here's the code: `function auth(req) { const token = req.query.token; return db.find('tokens', token); }`"},{"title":"Score legacy code before refactor","prompt":"We're about to refactor this old PHP script and I want a baseline quality score plus a list of the biggest problems before we start — can you review it and prioritize what's most worth cleaning up?"}],"resultDescription":"Returns a JSON object with a success flag, a review object containing an integer quality score (0-100), an array of identified issues, a summary string, and an array of suggestions, plus metadata including the detected or specified language, focus area, price paid, and timestamp.","failureModes":["Missing required 'code' field returns validation error","Payment failure or insufficient USDC balance prevents execution","Unsupported or ambiguous language may reduce review accuracy","Very large code inputs may be truncated or rejected","Network timeout on Vercel serverless cold starts"],"whenToPreferThis":"Use this endpoint when you need a structured, scored code review with explicit issues and suggestions returned as machine-readable JSON, especially in automated pipelines or agents that need to programmatically act on review results. Prefer over general-purpose LLM chat endpoints when you want a consistent review schema with a numeric quality score.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T00:43:27.278Z","isFirstParty":false}