Opsmeter logo
Opsmeter
AI Cost & Inference Control
Integration docs

Developer Docs

Ship telemetry fast with LLM cost tracking and OpenAI cost monitoring. Request-level budget alerts are available on Pro+ plans.

Updated for 2026API v1GitHub

Data modes, demo endpoint, and cleanup

Every ingest row can be classified by dataMode and environment. If you do not send them, Opsmeter defaults to dataMode=real and environment=prod.

If you omit these fields, the Dashboard default filters can mix production and non-production rows. For clean metrics hygiene, mark all non-production traffic as test or demo.

FieldAllowed valuesRecommended default
dataModerealtestdemoreal
environmentprodstagingdevprod

Recommended combinations

Production traffic: dataMode=real, environment=prod

QA/Test traffic: dataMode=test, environment=staging|dev

Demo seed/button: dataMode=demo, environment=dev

A1

Classification fields

Use these fields to isolate production metrics from test/demo traffic.

{
  "externalRequestId": "req_2026_02_07_001",
  "provider": "openai",
  "model": "gpt-4o-mini",
  "promptVersion": "summarizer_v3",
  "endpointTag": "checkout.ai_summary",
  "inputTokens": 120,
  "outputTokens": 45,
  "totalTokens": 165,
  "latencyMs": 820,
  "status": "success",
  "dataMode": "real",
  "environment": "prod"
}
A2

Try demo data endpoint

POST /v1/ingest/demo always writes demo rows with dataMode=demo. Use it for workspace walkthroughs, then clean up from Overview: Manage demo data opens /settings#data-hygiene, and Clear my test data removes only your own test rows.

curl -X POST "https://api.opsmeter.io/v1/ingest/demo" \
  -H "X-API-Key: $AI_COST_API_KEY"

# all generated rows are stored as dataMode=demo
A3

Cleanup endpoints

Delete demo/test rows on demand: DELETE /v1/ingest/demo-data and DELETE /v1/ingest/test-data with scope=workspace|mine. Workspace scope requires Owner/Admin, mine scope is available for all roles.

# Owner/Admin: clear all demo rows in workspace
curl -X DELETE "https://api.opsmeter.io/v1/ingest/demo-data?scope=workspace" \
  -H "Authorization: Bearer $JWT"

# Any role: clear only my test rows
curl -X DELETE "https://api.opsmeter.io/v1/ingest/test-data?scope=mine" \
  -H "Authorization: Bearer $JWT"
A4

Analytics/export default behavior

Overview, top lists, prompt versions, exports, and budget signals are real-only by default. Include non-real traffic by sending explicit filters.

Retention still applies on top of these filters. See Retention & data lifecycle for raw-vs-summary rules and export truncation behavior.

# Dashboard/export defaults
# - dataMode omitted => real-only
# - environment omitted => all
# - exports include retention metadata headers:
#   X-Retention-Truncated, X-Retention-Available-From-Utc
# Include non-real data explicitly when needed:
GET /v1/dashboard/top-users?range=7d&dataMode=all&environment=staging

Demo data lifecycle

In Overview, click Try demo data to seed sample rows.

Analyze with filters using dataMode and environment.

From Overview, use Manage demo data (goes to /settings#data-hygiene) or Clear my test data.

Role access:Clear my test data = all roles. Workspace demo data cleanup = Owner/Admin.