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 judge marks a finding verified only when it can quote the code that proves it.

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

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:

{
  "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

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 access needs a plan or pay-as-you-go credits. REST API calls are paid from pay-as-you-go credits.

Plus and Pro

From $19 a month

A monthly allowance of reviews with model usage included: 50 reviews on Plus, 200 on Pro. A review of up to 25,000 tokens of input counts as one; larger ones count one more for every further 25,000. Research and planning count double. The count is worked out from the size of your input as MegaLens estimates it (about 3.5 characters to a token). Every plan and pay-as-you-go run the strongest reviewer panel, with reviewers from Anthropic, OpenAI and Google. Every review is verified the same way. Pro is the team plan: one account, one bill and one shared allowance. Cancel any time.

Pay as you go

Prepaid credits

No plan needed. Add credits and each review is charged from them. The current rate is on the pricing page.

How model costs are paid

On a plan, model usage is part of your monthly allowance. Otherwise, pay as you go with prepaid credits. See all plans and rates

Independent reviews and a judge, via HTTP.

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