{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": { "type": "grafana", "uid": "-- Grafana --" },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": { "type": "prometheus", "uid": "${datasource}" },
      "fieldConfig": {
        "defaults": { "custom": { "drawStyle": "line" }, "unit": "ops" },
        "overrides": []
      },
      "gridPos": { "h": 8, "w": 24, "x": 0, "y": 0 },
      "id": 1,
      "options": { "legend": { "displayMode": "list", "placement": "bottom" } },
      "targets": [
        {
          "datasource": { "type": "prometheus", "uid": "${datasource}" },
          "expr": "sum(rate(praxis_ai_tokens_total{kind=\"total\"}[5m])) by (tenant)",
          "legendFormat": "{{tenant}}",
          "refId": "A"
        }
      ],
      "title": "Token rate by tenant",
      "type": "timeseries"
    },
    {
      "datasource": { "type": "prometheus", "uid": "${datasource}" },
      "fieldConfig": { "defaults": {}, "overrides": [] },
      "gridPos": { "h": 8, "w": 24, "x": 0, "y": 8 },
      "id": 2,
      "options": { "legend": { "displayMode": "list", "placement": "bottom" } },
      "targets": [
        {
          "datasource": { "type": "prometheus", "uid": "${datasource}" },
          "expr": "sum(rate(praxis_ai_tokens_total{kind=~\"input|output\"}[5m])) by (tenant, kind)",
          "legendFormat": "{{tenant}} {{kind}}",
          "refId": "A"
        }
      ],
      "title": "Input vs output by tenant",
      "type": "timeseries"
    },
    {
      "datasource": { "type": "prometheus", "uid": "${datasource}" },
      "fieldConfig": { "defaults": {}, "overrides": [] },
      "gridPos": { "h": 8, "w": 24, "x": 0, "y": 16 },
      "id": 3,
      "options": { "legend": { "displayMode": "list", "placement": "bottom" } },
      "targets": [
        {
          "datasource": { "type": "prometheus", "uid": "${datasource}" },
          "expr": "sum(rate(praxis_ai_tokens_total{kind=\"total\"}[5m])) by (tenant, model)",
          "legendFormat": "{{tenant}} {{model}}",
          "refId": "A"
        }
      ],
      "title": "Token rate by tenant and model",
      "type": "timeseries"
    }
  ],
  "schemaVersion": 38,
  "tags": ["praxis-ai", "poc"],
  "templating": {
    "list": [
      {
        "current": {},
        "hide": 0,
        "includeAll": false,
        "label": "Datasource",
        "name": "datasource",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "type": "datasource"
      }
    ]
  },
  "time": { "from": "now-1h", "to": "now" },
  "timezone": "browser",
  "title": "Praxis AI Token Usage",
  "uid": "praxis-ai-token-usage-poc",
  "version": 1
}
