Quick Start: Server-Side Analysis
This page shows engineers how to run server-side analysis with the API or dashboard, and how to add it to a pull request pipeline. Server-side analysis ingests the input and calls the LLM for you.
Run an analysis with one API call
Section titled “Run an analysis with one API call”In the dashboard: Rules → Packs. Enable the pack you want to use. Packs are disabled by default; an analysis request for a disabled pack returns 404. You can also enable a pack with POST /v1/orgs/{org_id}/packs/python-code-change and {"enabled": true}.
In the dashboard: Analysis → Analyze. You can also send the request directly:
jq -n \ --arg raw_input "$(git diff origin/main -- '*.py')" \ '{connection_id: "anthropic", model: "claude-sonnet-5", api_key: "sk-ant-...", raw_input: $raw_input}' \ | curl -X POST -H "X-API-Key: $OPENTREMOR_API_KEY" http://localhost:8000/v1/python-code-change/my-changeset/analyze \ -H "Content-Type: application/json" -d @-Inputs with at most server.sync_analysis_max_units units (5 by default) return the report in the response:
{"job_id": "...", "revision_id": "...", "report_markdown": "...", "resource_count": 3, "quota_exceeded": false}Larger inputs return a queued job:
{"job_id": "b7e2...", "status": "queued", "revision_id": "..."}Poll the job until it is done:
curl -H "X-API-Key: $OPENTREMOR_API_KEY" http://localhost:8000/v1/jobs/b7e2...When the job is done, fetch the report:
curl -H "X-API-Key: $OPENTREMOR_API_KEY" \ http://localhost:8000/v1/changesets/my-changeset/reportconnection_id can name a hosted provider when you send its key in api_key. Or use a stored LLM connection and omit api_key to use its stored key. For a pack with multiple rule variants, set rule_type to select one. In the dashboard’s Analyze page, choose it from the Variant picker, shown only when the chosen pack has more than one variant. You can also pass categories to run only selected rule categories, such as ["performance"]; see Rule Categories in a Run. See Server-Side Analysis for the full reference.
Let the server choose a pack
Section titled “Let the server choose a pack”In the dashboard: Analysis → Analyze. Select Auto-detect (by file type) to let the server route the input to matching packs. For an API request, use /{changeset}/analyze/auto instead of /{pack}/{changeset}/analyze. The server routes each file in a diff by matching pack file patterns. It routes a single non-diff input by its content.
jq -n \ --arg raw_input "$(cat pr.diff)" \ '{connection_id: "anthropic", model: "claude-sonnet-5", api_key: "sk-ant-...", raw_input: $raw_input}' \ | curl -X POST -H "X-API-Key: $OPENTREMOR_API_KEY" http://localhost:8000/v1/my-changeset/analyze/auto \ -H "Content-Type: application/json" -d @-The response includes packs_used and a detections audit trail. See POST /v1/{changeset}/analyze/auto. Auto-detect is also the Analyze page’s default, and the GitHub webhook uses auto-routing for pull requests.
If no pack matches and the optional generic pack is installed and enabled for the org, the server uses it for a best-effort analysis. The dashboard marks this as “No pack found” and says that results are not guaranteed. If the generic pack is unavailable, unmatched input is reported in the detections instead.
Run it on every pull or merge request
Section titled “Run it on every pull or merge request”In the dashboard: Analysis → Analyze. Choose the pack, variant, connection, and model. In the Run the analysis elsewhere panel, open the GitHub Action or GitLab CI tab and copy the pipeline file.
The pipeline:
- Collects the files the pack reads. Auto-detect mode includes every changed file.
- Sends the input to
/analyzeor/analyze/auto. For large inputs, it pollsGET /v1/jobs/{job_id}. - Fetches a summary report and posts it as a pull or merge request comment.
Each pull or merge request gets its own changeset (<changeset>-pr-<number> on GitHub, <changeset>-mr-<iid> on GitLab). Each push adds a revision to that changeset.
The pipeline needs OPENTREMOR_API_URL and OPENTREMOR_API_KEY. Use a service account key with the analysis permission. It also needs LLM_API_KEY if the selected connection has no stored key. GitLab needs a GITLAB_TOKEN project access token with the api scope to post the comment. For a pack that reads command output instead of a diff, such as terraform-plan, replace the marked pipeline line with the command that produces its input.
Next steps
Section titled “Next steps”See Triage a Finding to suppress a finding, or Authentication to set up a multi-tenant deployment. To drive the LLM call yourself, see Client-Led Loop.