AI ReviewBot¶
AI-powered assistant for automated code review in your CI/CD pipeline.
What is it?¶
AI Code Reviewer is a tool that automatically analyzes your Pull Requests (GitHub) and Merge Requests (GitLab), finds issues and suggests fixes with an "Apply Suggestion" button. Essentially, you get an unbiased senior developer's perspective on your code along with suggestions for improvement.
Integration with a wide range of existing LLM providers is possible (by default Google Gemini, model gemini-2.5-flash โ at the time of the current release, the free tier usage limits on requests per minute and per day are sufficient for a normal workflow of a team of 4-8 full-time developers).
What do you get?¶
Code Comments โ overall code assessment and recommendations
Task Alignment โ PR/MR alignment with task context
Inline Comments โ comments directly on code lines
Apply Suggestion โ one-click button to apply fixes
Mentoring explanations โ why it matters + resource links
Language adaptivity โ detects language from PR/MR context
Metrics โ execution time, tokens
Resilience โ retry logic for 429/5xx errors
Quick Start¶
Important: to follow the next steps you'll need your personal Google API key. You can get it for free either at Google AI Studio or Google Cloud Console.
AI Code Reviewer can be configured to use different LLM providers and models, both free and paid. The following examples use the gemini-2.5-flash model. Other documentation sections explain how to connect other providers and use other models. We're interested in your opinion about the differences between various models โ we'd love to read about your experience in the comments.
GitHub¶
In your repository, create:
- in Settings โ Secrets and variables [Security] โ Actions โ press New repository secret:
- create a secret named AI_REVIEWER_GOOGLE_API_KEY with your Google API key as the value.
- in the root of your project repository:
- create file .github/workflows/ai-review.yml with the following content:
# .github/workflows/ai-review.yml
name: AI Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: KonstZiv/ai-code-reviewer@v1
with:
google_api_key: ${{ secrets.AI_REVIEWER_GOOGLE_API_KEY }}
GitLab¶
In your repository, create:
-
GitLab Token (required for posting comments):
- Personal Access Token (all plans, including Free) โ go to your
User SettingsโAccess Tokens, create token with scopeapi. Comments will appear under your username. - Project Access Token (Premium/Ultimate only) โ go to
SettingsโAccess Tokens, create token with nameai-reviewer, roleDeveloper, scopeapi - Copy the token (shown only once!)
- Personal Access Token (all plans, including Free) โ go to your
-
CI/CD Variables:
- Go to
SettingsโCI/CDโVariables - Add
AI_REVIEWER_GOOGLE_API_KEY: your Google API key (Masked) - Add
AI_REVIEWER_GITLAB_TOKEN: token from step 1 (Masked)
- Go to
-
CI configuration:
- Create file
.gitlab-ci.ymlin the project root:
- Create file
# .gitlab-ci.yml
ai-review:
image: ghcr.io/konstziv/ai-code-reviewer:1
script:
- ai-review
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
allow_failure: true
Create a new PR/MR โ get a review.
Review quality directly depends on AI Code Reviewer's understanding of your intentions (just like with a real human reviewer). Therefore, it's a good idea to accompany the development process with documentation: - create an issue describing the problem and desired results - create a linked branch/linked PR/MR in the issue, describing the problem in more detail, the solution approach, constraints, desired results, edge cases โ anything that adds context understanding, tools, results - if you work in a team โ communicate in issues, comment on PR/MRs โ all this adds context and improves review quality
Supported Platforms¶
| Platform | Status | Integration |
|---|---|---|
| GitHub | GitHub Actions / GitHub Action | |
| GitLab | GitLab CI / Docker image | |
| Self-hosted | Docker / PyPI |
How does it work?¶
graph TD
A[PR/MR created] --> B[CI runs AI Review]
B --> C[Get diff + context]
C --> D[Analyze with Gemini]
D --> E[Post Inline Comments]
E --> F[Apply Suggestion button]
Step by step:
- You create a PR/MR
- CI pipeline runs AI Code Reviewer
- The tool fetches diff, PR description, linked task
- Gemini analyzes the code and generates recommendations
- Results are posted as inline comments with an "Apply" button
Review Example¶
๐ด CRITICAL: Hardcoded Secret
File: config.py:15
Hardcoded API key found in code.
Why does this matter?
Secrets in code end up in git history and can be stolen. Use environment variables or secret managers.
Issue Categories¶
| Category | Description |
|---|---|
| Vulnerabilities, hardcoded secrets | |
| Readability, naming, DRY | |
| SOLID, design patterns | |
| N+1, inefficient algorithms | |
| Coverage, edge cases |
Installation¶
Configuration¶
Minimal configuration โ just the API key:
Additional options:
| Variable | Description | Default |
|---|---|---|
AI_REVIEWER_LANGUAGE |
Response language (ISO 639) | en |
AI_REVIEWER_LANGUAGE_MODE |
adaptive / fixed |
adaptive |
AI_REVIEWER_GEMINI_MODEL |
Gemini model | gemini-2.5-flash |
AI_REVIEWER_LOG_LEVEL |
Logging level | INFO |
Legacy names
Old variable names without AI_REVIEWER_ prefix still work as fallback.
Documentation¶
-
Copy-paste instructions for GitHub and GitLab
-
All environment variables and options
-
Permissions, secrets, workflow tips
-
Job tokens, MR triggers, self-hosted
-
Commands and parameters
-
FAQ and problem solving
Cost¶
AI Code Reviewer uses Google Gemini 3 Flash โ in Free Tier mode. The free tier limits are sufficient for serving PR/MRs for a team of 4-8 full-time developers, including both reviews and meaningful comments (without flood and off-topic).
If using the paid tier (Pay-as-you-go), a typical review costs ~$0.003โ$0.01.
~1000 reviews = ~$3 ... ~$10
License¶
Apache 2.0 โ free to use, modify, and distribute.
Support¶
GitHub Issues โ bugs and suggestions
GitHub Discussions โ questions and discussions
Ready to improve your code reviews? Get started โ