DocsAPI ReferenceMonitors API Endpoints

Monitors API Endpoints

Monitors (workloads), ingest, and comparison Run endpoints.

These endpoints power Monitors — creating monitors (API: workloads), ingesting production traffic, and running comparison evals (API: audits).monitorId is accepted as an alias for workloadId on ingest.

Monitors (workloads)

GET /workloads

List monitors configured for continuous comparison.

curl -H "X-API-Key: plm_live_..." \
  https://app.peerlm.com/api/v1/workloads

POST /workloads

Create a workload. Requires read-write scope.

curl -X POST \
  -H "X-API-Key: plm_live_..." \
  -H "Content-Type: application/json" \
  -d '{"name": "my-chatbot", "current_model": "gpt-4o"}' \
  https://app.peerlm.com/api/v1/workloads
FieldTypeRequiredDescription
namestringYesName for the workload
current_modelstringNoThe model currently used in production

Ingest

POST /ingest

Ingest production LLM logs. Fire-and-forget — returns 202 Accepted. Requires read-write scope.

curl -X POST \
  -H "X-API-Key: plm_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "workloadName": "my-chatbot",
    "records": [
      {
        "prompt": "Summarize this contract...",
        "response": "The contract states...",
        "model": "gpt-4o",
        "latencyMs": 1200,
        "tokensIn": 150,
        "tokensOut": 200
      }
    ]
  }' \
  https://app.peerlm.com/api/v1/ingest

Request Body

FieldTypeRequiredDescription
workloadIdstringNoExisting workload ID
workloadNamestringNoAuto-creates workload if needed
recordsarrayYesLog records (max 500 per batch)
sampleRatenumberNoServer-side sampling rate 0-1 (default: 1)

Record Fields

FieldTypeRequired
promptstringYes
responsestringNo
modelstringNo
systemPromptstringNo
tokensIn / tokensOutnumberNo
latencyMsnumberNo
idstringNo
metadataobjectNo

Audits

GET /audits

List audit runs. Optional filters: workload_id, status, limit (default 50, max 100).

curl -H "X-API-Key: plm_live_..." \
  "https://app.peerlm.com/api/v1/audits?status=completed"

Audit statuses: queuedingesting samplingreplaying evaluatingaggregating completed (or failed).

GET /audits/:auditId

Get detailed audit results including recommendations and routing table.

POST /audits

Start an audit run. Requires read-write scope.

curl -X POST \
  -H "X-API-Key: plm_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "workload_id": "uuid",
    "candidate_model_ids": ["model-id-1", "model-id-2"],
    "sample_size": 200,
    "judges": { "mode": "auto", "count": 3 }
  }' \
  https://app.peerlm.com/api/v1/audits
FieldTypeRequiredDescription
workload_idstringYesWorkload with ingested logs
candidate_model_idsstring[]YesModel IDs to test against
sample_sizenumberNoPrompts to sample (default: 200)
judges.modestringNoauto, category, or manual
judges.countnumberNoNumber of judges (default: 3, max: 5)
criteriaarrayNoCustom evaluation criteria

End-to-End Example

# 1. Create a workload
curl -X POST https://app.peerlm.com/api/v1/workloads \
  -H "Content-Type: application/json" \
  -H "X-API-Key: plm_live_..." \
  -d '{"name": "my-chatbot", "current_model": "gpt-4o"}'

# 2. Ingest production logs
curl -X POST https://app.peerlm.com/api/v1/ingest \
  -H "Content-Type: application/json" \
  -H "X-API-Key: plm_live_..." \
  -d '{
    "workloadId": "wkl-uuid",
    "records": [
      {"prompt": "Summarize...", "response": "...", "model": "gpt-4o"},
      {"prompt": "Translate...", "response": "...", "model": "gpt-4o"}
    ]
  }'

# 3. Start an audit
curl -X POST https://app.peerlm.com/api/v1/audits \
  -H "Content-Type: application/json" \
  -H "X-API-Key: plm_live_..." \
  -d '{
    "workload_id": "wkl-uuid",
    "candidate_model_ids": ["model-1", "model-2"]
  }'

# 4. Check results
curl -H "X-API-Key: plm_live_..." \
  https://app.peerlm.com/api/v1/audits/audit-uuid