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/workloadsPOST /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| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name for the workload |
current_model | string | No | The 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/ingestRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
workloadId | string | No | Existing workload ID |
workloadName | string | No | Auto-creates workload if needed |
records | array | Yes | Log records (max 500 per batch) |
sampleRate | number | No | Server-side sampling rate 0-1 (default: 1) |
Record Fields
| Field | Type | Required |
|---|---|---|
prompt | string | Yes |
response | string | No |
model | string | No |
systemPrompt | string | No |
tokensIn / tokensOut | number | No |
latencyMs | number | No |
id | string | No |
metadata | object | No |
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: queued → ingesting → sampling → replaying → evaluating → aggregating → 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| Field | Type | Required | Description |
|---|---|---|---|
workload_id | string | Yes | Workload with ingested logs |
candidate_model_ids | string[] | Yes | Model IDs to test against |
sample_size | number | No | Prompts to sample (default: 200) |
judges.mode | string | No | auto, category, or manual |
judges.count | number | No | Number of judges (default: 3, max: 5) |
criteria | array | No | Custom 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