← MarketplaceGet started free
Guide

AI Code Review Without Copy-Pasting into ChatGPT

The Problem

Pasting code into ChatGPT is slow, doesn't scale, breaks on large diffs, and isn't repeatable. You can't run it in CI, you can't audit the output, and you can't integrate it with your PR workflow.

The Alternative

Call a code review agent via API and get back structured JSON — score, issues, suggestions — that you can act on programmatically.

Prerequisites

  • Runcept account and API key
  • A PR diff (from git or GitHub API)
  • curl

    # Get the diff
    

    DIFF=$(git diff main...HEAD)

    # Start review

    RESPONSE=$(curl -sS -X POST https://www.runcept.com/api/v1/run \

    -H "Authorization: Bearer $RUNCEPT_API_KEY" \

    -H "Content-Type: application/json" \

    --data-raw "{\"agent\": \"code-reviewer\", \"input\": {\"diff\": $(echo "$DIFF" | head -c 8000 | jq -Rs .)}}")

    JOB_ID=$(echo $RESPONSE | jq -r '.job_id')

    echo "Job started: $JOB_ID"

    # Poll

    for i in {1..20}; do

    sleep 4

    RESULT=$(curl -sS "https://www.runcept.com/api/v1/jobs/$JOB_ID" \

    -H "Authorization: Bearer $RUNCEPT_API_KEY")

    STATUS=$(echo $RESULT | jq -r '.status')

    if [ "$STATUS" = "complete" ]; then

    echo $RESULT | jq '.output'

    break

    fi

    done

    JavaScript

    import { execSync } from 'child_process'
    
    

    const diff = execSync('git diff main...HEAD').toString()

    const { job_id } = await fetch('https://www.runcept.com/api/v1/run', {

    method: 'POST',

    headers: {

    Authorization: Bearer ${process.env.RUNCEPT_API_KEY},

    'Content-Type': 'application/json',

    },

    body: JSON.stringify({

    agent: 'code-reviewer',

    input: { diff: diff.slice(0, 8000) },

    }),

    }).then(r => r.json())

    while (true) {

    await new Promise(r => setTimeout(r, 4000))

    const job = await fetch(https://www.runcept.com/api/v1/jobs/${job_id}, {

    headers: { Authorization: Bearer ${process.env.RUNCEPT_API_KEY} },

    }).then(r => r.json())

    if (job.status === 'complete') {

    // { score: 82, issues: [...], suggestions: [...] }

    console.log(job.output)

    break

    }

    }

    Output Structure

    {
    

    "score": 78,

    "issues": [

    { "severity": "error", "line": 42, "message": "Missing null check before .id access" },

    { "severity": "warning", "line": 87, "message": "Magic number — extract as named constant" }

    ],

    "suggestions": [

    "Add input validation at the API boundary",

    "Extract duplicate logic into a shared helper"

    ]

    }

    CI Integration

    Add this as a required check to block PRs with a score below 70. See the CI pipeline guide.

    Next Steps

  • Add to GitHub Actions to run on every PR automatically
  • Browse code agents
  • Use this agent on Runcept

    View code-reviewer agent →

    Related guides

    Add AI Code Review to Your CI PipelineCall an AI Agent API from Node.jsCall an AI Agent API from PythonRun an AI Agent from GitHub Actions