Ship telemetry fast, keep attribution stable, and move from ingest to governance without changing your app network path.
Start with direct ingest, validate one stable payload shape, then harden budgets, retries, and incident workflows.
Implementation rhythm
Use quickstart for initial payloads, then operations docs to harden production workflows.
Every ingest row can be classified by dataMode and environment. If you do not send them, Opsmeter.io 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.
| Field | Allowed values | Recommended default |
|---|---|---|
dataMode | realtestdemo | real |
environment | prodstagingdev | prod |
Recommended combinations
Production traffic: dataMode=real, environment=prod
QA/Test traffic: dataMode=test, environment=staging|dev
Demo seed/button: dataMode=demo, environment=dev
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"
}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 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"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=stagingDemo 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.