This page is about the MegaLens connector inside your coding tool. To review pull requests, use the GitHub Action.
Integrations/REST API

MegaLens REST API

Run a MegaLens review from any script, CI job or tool that can send an HTTP request, not only from an IDE. It is the same review: reviewers from different AI companies check the code, and a second AI check confirms the quoted line appears in the code you sent.

Use cases

CI/CD pipelines

You can call the API from your CI job and fail the build on findings you choose. No IDE required.

PR automation

Your own bot can post the findings as pull request comments. Findings include a severity and a next step, and a file and line when the code was sent.

Custom platforms

Build MegaLens review into your own tools. Internal dashboards, Slack bots, code review portals, anything with HTTP.

Large jobs

Send large jobs to POST /api/v1/analyses and fetch the result later from GET /api/v1/analyses/{id}. Up to 500 KB of context per job.

Quick start

A full review takes a few minutes, so it runs in the background. Start it with one POST, then ask for the result with GET.

1. Start the review

Start a review
curl -X POST https://megalens.ai/api/v1/analyses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: build-1234" \
  -d '{
    "skill": "code_intelligence",
    "mode": "multi",
    "tier": "standard",
    "prompt": "Review this function",
    "context": "..."
  }'

It answers at once with 202 Accepted and a run id:

Example response
{
  "runId": "RUN_ID",
  "status": "queued",
  "mode": "multi",
  "tier": "standard",
  "skill": "code_intelligence"
}

The Idempotency-Key header is optional. If you send the same key again, you get the run you already started instead of a second, paid one.

2. Ask for the result

Get the review result
curl https://megalens.ai/api/v1/analyses/RUN_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

status is queued, running, completed, failed or cancelled. While the run is going, the response has a Retry-After header: wait that many seconds before you ask again. When it is completed, the findings are in result. When it failed, the reason is in error. Asking for the result does not use up a call.

Endpoints

MethodEndpointDescription
POST/api/v1/analysesFull review. Returns a run id to poll.
GET/api/v1/analyses/{id}Status and result of a review you started.
POST/api/v1/analyzeQuick review, answers in seconds. Waits for the answer, so use it only with mode quick.
GET/api/v1/usageCalls used and remaining today for this key.

Skills

Each skill configures the review pipeline for a specific domain. Pass the skill name in the skill field.

code_intelligenceCode Intelligence
security_auditSecurity Audit
full_auditFull Audit
researchResearch
seoSEO
saas_launchSaaS Launch
wordpressWordPress
legalLegal
generalGeneral
planningPlanning
diff_auditDiff Audit

Modes

quickQuick

A review by a single model. It answers fastest, so use it for simple checks where you need a quick answer.

multiMulti

Several models review independently. A judge checks their findings against the code. Use POST /api/v1/analyses for multi. It takes a few minutes.

Tiers

TierReviewing modelsJudgeSecond check
free2YesNo
standard3YesNo
deep3YesYes

Pricing

REST API calls use credits from your plan or your pay as you go balance.

Plus, Pro and Max

Monthly plans

Plans: Plus $19 a month for 20 credits, Pro $69 a month for 80 credits, Max $199 a month for 250 credits. Or pay as you go at $1.25 a credit, from $5. A Standard review uses 1 credit and a Deep review uses 8. Cancel any time.

Pay as you go

$1.25 a credit

From $5, no plan needed, no extra fee. Credits you buy never expire.

How model costs are paid

On a plan, credits come with it every month. Otherwise, pay as you go with credits that never expire. See all plans and rates

Independent reviews and a judge, via HTTP.

Use it from CI, bots or your own tools. No IDE needed.