{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/argus-town/json-schema/argus-town-event-input-schema.json",
  "title": "EventInput",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/argus-town-openapi.json#/components/schemas/EventInput",
  "type": "object",
  "required": [],
  "properties": {
    "id": {
      "type": "string",
      "description": "Your id for this event, 16 to 64 characters, unique per source. Re-sending an id is a no-op. Omit it and Argus mints an `evt_` id."
    },
    "provider": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Provider slug, for example `openai`. Derived from `hostname` when omitted."
    },
    "hostname": {
      "type": "string"
    },
    "connection": {
      "type": "string",
      "description": "Attribute the event to this connection (`conn_...`). It must exist in the project."
    },
    "endpoint": {
      "type": "string"
    },
    "method": {
      "type": "string"
    },
    "model": {
      "type": "string"
    },
    "operation": {
      "type": "string"
    },
    "cost_usd": {
      "type": "number",
      "description": "What the call cost. Omit it and Argus prices the event from `model` and `units`."
    },
    "cost_provenance": {
      "type": "string",
      "enum": [
        "provider_reported",
        "app_reported"
      ]
    },
    "provider_request_id": {
      "type": "string"
    },
    "units": {
      "type": "object",
      "required": [],
      "properties": {},
      "additionalProperties": {
        "type": "number"
      },
      "description": "For example `input_tokens`, `output_tokens`, `requests`, `credits`."
    },
    "tokens_input": {
      "type": "number"
    },
    "tokens_output": {
      "type": "number"
    },
    "requests": {
      "type": "number"
    },
    "status": {
      "type": "number"
    },
    "latency_ms": {
      "type": "number"
    },
    "credits_spent": {
      "type": "number"
    },
    "credits_remaining": {
      "type": "number"
    },
    "metadata": {
      "type": "object",
      "required": [],
      "properties": {},
      "additionalProperties": {
        "type": "string"
      }
    },
    "occurred_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        }
      ],
      "description": "ISO 8601 string or epoch milliseconds. Defaults to receipt time."
    },
    "rate_limit": {
      "$ref": "#/$defs/RateLimitInput"
    },
    "rate_limits": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RateLimitInput"
      }
    },
    "pricing_override": {
      "type": "object",
      "required": [
        "rates"
      ],
      "properties": {
        "rates": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "unit",
              "nano_usd_per_unit"
            ],
            "properties": {
              "unit": {
                "type": "string"
              },
              "nano_usd_per_unit": {
                "type": "number"
              },
              "sku": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true,
  "$defs": {
    "RateLimitInput": {
      "type": "object",
      "required": [],
      "properties": {
        "limit_type": {
          "type": "string",
          "enum": [
            "rpm",
            "tpm",
            "credits"
          ]
        },
        "limit": {
          "type": "number"
        },
        "remaining": {
          "type": "number"
        },
        "reset_at": {
          "type": "number",
          "description": "Epoch milliseconds."
        }
      },
      "additionalProperties": true
    }
  }
}