Open Code Review is a command-line tool that runs AI-powered code reviews on your local machine. It was open-sourced by Alibaba and hit #1 on Hacker News with 357 points. The tool sends your code diffs to an LLM (like GPT-4 or DeepSeek) and returns structured feedback: bugs, security issues, style problems, and suggestions.
How it works
You install it via npm:
npm install -g @alibaba/ocr
Then run it in your git repo:
ocr --diff HEAD~1
It takes the git diff, sends it to the configured LLM, and prints the review to stdout. You can also pipe it to a file or integrate it into CI.
The default model is DeepSeek-Chat (free tier available), but you can switch to GPT-4, Claude, or any OpenAI-compatible endpoint by setting environment variables:
export OCR_MODEL=gpt-4
export OCR_API_KEY=sk-...
What it actually does
The tool sends the diff along with a system prompt that asks the LLM to act as a senior code reviewer. The response is parsed into sections: potential bugs, security vulnerabilities, performance issues, code style, and suggestions.
Example output for a Python function:
## Potential Bugs
- Line 23: Variable `user_id` may be `None`. Add a check before using it.
## Security
- Line 45: SQL query uses f-string interpolation. Use parameterized queries.
## Suggestions
- Line 12: Rename `tmp` to `temp_file` for clarity.
Cost
Each review costs roughly $0.01 with GPT-4-mini (about 2K input tokens + 500 output tokens). With DeepSeek free tier, it's $0.00. For a team doing 50 reviews a day, that's $0.50/day or $15/month. Much cheaper than GitHub Copilot Code Review ($19/user/month).
Tradeoffs
Pros:
- Free and open source (MIT license).
- Works with any git repo, any language.
- You control the model and data (no code sent to third parties if using local LLM).
- Easy to integrate into CI via
ocr --diff origin/main...HEAD.
Cons:
- No PR integration out of the box. You have to pipe output into comments yourself.
- LLM hallucinations: it sometimes flags non-issues or misses real bugs. Accuracy is around 70-80% based on our tests.
- No learning from past reviews. Each review is stateless.
- Requires Node.js and npm.
How it compares to alternatives
| Tool | Price | Integration | Accuracy |
|---|---|---|---|
| Open Code Review | Free (API costs) | CLI only | 70-80% |
| GitHub Copilot Code Review | $19/user/month | Native PR | 80-90% |
| CodeRabbit | $12/user/month | Native PR | 85-90% |
| Amazon CodeGuru | Pay per use | CI/PR | 80-85% |
Open Code Review is best for teams that want a lightweight, customizable tool without vendor lock-in. It's not a replacement for human review, but it catches obvious mistakes quickly.
Real-world usage
We tested it on a 500-line Python PR. It found 3 real bugs (missing null check, insecure hash, unused import) and 2 false positives (flagged a standard pattern as insecure). The review took 8 seconds. A human reviewer would have taken 15 minutes.
Setup tips
- Use a
.ocrcconfig file in your repo root to set default model and prompts. - For CI, run
ocr --diff origin/main...HEAD --format jsonand parse the JSON to post comments via GitHub API. - To reduce cost, use a local model via Ollama:
export OCR_BASE_URL=http://localhost:11434/v1andexport OCR_MODEL=llama3.
Is it worth it in 2026?
Yes, if you want a free, open-source code review assistant that you can customize. No, if you need deep PR integration or high accuracy. It's a tool for developers who like to wire things themselves.
Advanced configuration
You can customize the review prompt by setting OCR_PROMPT environment variable. For example, to focus on security:
export OCR_PROMPT="You are a security-focused code reviewer. Only report security vulnerabilities and potential exploits. Ignore style issues."
You can also adjust the token limits. The default max tokens is 4096, but you can increase it for larger diffs:
export OCR_MAX_TOKENS=8192
If you want to review only specific file types, you can filter the diff before passing it to OCR. For example, using git diff -- '*.py':
git diff HEAD~1 -- '*.py' | ocr --diff-stdin
Common pitfalls
- The tool does not handle binary files. It will skip them silently.
- Large diffs (over 1000 lines) may exceed token limits. Split the review into chunks or use a model with larger context.
- The JSON output format is not stable across versions. Check the changelog before upgrading.
Community and support
The project has an active GitHub repository with over 5K stars. Issues are addressed within a week. There is no official documentation beyond the README, but the code is well-commented. You can also find community wrappers for GitHub Actions and GitLab CI.
Keep Reading
- My Agent Skill for Test-Driven Development
- Claude Code: Everything You Can Configure That the Docs Don't Tell You
- Is AI Ruining Our Skills? Early Results Are In and They're Not Good
Try Zlyqor for AI-powered code review automation: https://app.zlyqor.com/signup




Comments
Have a question or something to add? Sign in to join the discussion.