Developer overview

The whole Lokrix measurement engine is programmable. A scoped REST API, a generated TypeScript SDK, and an MCP server expose the same resources you drive in the app — projects, scans, calibrated scores with confidence intervals, competitors, and the simulated optimization engine — to your code and your agents.

Three ways to build

All three surfaces talk to the same API and honour the same tenancy, scopes, and credit accounting. Pick the one that fits your integration:

  • REST API — bearer-authenticated HTTP under a /v1 version prefix, described by an OpenAPI 3.1 document. Use it from any language.
  • MCP server @lokrix/mcp-server exposes the engine as tools for agents (Claude Desktop and any MCP client) over stdio or Streamable HTTP.
  • SDK @lokrix/sdk, a typed TypeScript client generated from the OpenAPI spec, so you never hand-write request plumbing.
The Lokrix AI REST API surface (/v1)A versioned root, slash v1, connects to eight endpoint groups: scans, projects, recommendations, simulate, competitors, history, reports and usage, each with an example request path./v1versionedScansPOST /v1/scansProjectsGET /v1/projectsRecommendationsGET …/recommendationsSimulatePOST /v1/simulateCompetitorsGET …/competitorsHistoryGET …/historyReportsPOST /v1/reportsUsageGET /v1/usage

Authentication & access

Every request authenticates with an API-key bearer token that carries a set of least-privilege scopes. Mint keys in Settings → API keys. Access is tiered: the Free plan has no API/MCP access, Starter is read-only, and Growth and Enterprise unlock the full read/write API and MCP (plus bring-your-own encrypted provider keys). The full endpoint and tool tables live on the public developer reference.

What every response carries

The API is data-honest by construction. Scored payloads never return a single-run yes/no — they carry:

  • Provenance — a badge of live, cached, or predicted. Mock/sample data is never presented as live.
  • A 95% confidence interval on every probability, because engine answers are non-deterministic and sampled Monte-Carlo style.
  • Predictable envelopes — offset pagination ({ items, total, limit, offset }), gzip/br compression, a 202 pending_approval envelope for gated workspaces, and 429 for over-limit or over-budget requests.

Credits are the same as in the app

One credit is one live answer-engine response, so live-run cost scales as prompts × engines × samples × cadence. Predictive scoring and what-if simulation run on the calibrated model and cost 0 credits on every plan. See Credits & metering for how the balance is charged, whichever surface you call from.