Benchify is an API that fixes common issues in LLM-generated code using non-AI techniques. The issues are fixed more effectively, faster, and cheaper than another LLM call.

Getting Started

1. Log into Benchify

Log in to your account at app.benchify.com.

2. Create an API Key

  1. Navigate to Settings by clicking on your profile icon
  2. Select the Credentials section
  3. Click the Create API Key button and give your key a descriptive name
  4. Copy the generated key and save it somewhere secure (you won’t be able to see it again)

For the examples below, we’ll refer to your key as $BENCHIFY_KEY.

Using the API

Submit a Repository for Fixing

To use the Fixer API, you’ll need:

  • Your Benchify API key
  • A URL pointing to either a public .git repository or a publicly accessible zip/tar/tar.gz file with your source code
  • The command needed to build your project
curl -X POST https://api.benchify.com/v1/fixer \
  -H "Authorization: Bearer $BENCHIFY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "repoUrl": "$REPO_URL",
  "jobName": "fix-simple-demo",
  "buildCmd": "npm run build"
}'

Understanding the Response

The Fixer will attempt to fix your code and return a response with:

  • build_status: Indicates whether the build command succeeded (0) or failed (non-zero) after applying the fix
  • build_output: The console output from running your build command
  • diff: The changes made to fix your code
{
  "build_status": 0,
  "build_output": "... build logs ...",
  "diff": "... git diff format of changes ..."
}

Error Responses

If there’s an issue with your request, you’ll receive an error status code:

Missing Required Parameter (400 Bad Request):

{
  "error": "repoUrl is required"
}

Invalid API Key (401 Unauthorized):

"Unauthorized."

Applying the Fix

You can apply the diff to your codebase using the git apply command:

# Replace with your upload logic
sh upload.sh projects/my-project > url.txt

curl -X POST https://api.benchify.com/v1/fixer \
  -H "Authorization: Bearer $BENCHIFY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "repoUrl": "'"$REPO_URL"'",
  "buildCmd": "npm run build",
  "jobName": "fix-my-project"
}' > response.json

# Move into your project root before applying the patch
cd projects/my-project
git apply <(jq -r '.diff' ../../response.json)

Using Fixer Results in Your AI Agent

Even when the Fixer fails, the diff it suggests is often directionally correct. Your AI agent may want to use the diff and build_output as a starting point for its own suggestions.

Benchify only bills you for successful Fixer runs (where build_status is 0), but provides the full output regardless.