{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Native OpenPI checkpoint inference config",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version"],
  "properties": {
    "schema_version": { "const": 1 },
    "model_type": { "enum": ["pi0", "pi05"] },
    "action_horizon": { "type": "integer", "minimum": 1 },
    "action_dim": { "type": "integer", "minimum": 1 },
    "model_action_dim": { "type": "integer", "minimum": 1 },
    "state_dim": { "type": "integer", "minimum": 1 },
    "cameras": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 },
      "minItems": 3,
      "maxItems": 3,
      "description": "Input names in base_0_rgb, left_wrist_0_rgb, right_wrist_0_rgb slot order."
    },
    "state_input": { "type": "string", "minLength": 1 },
    "discrete_state_input": { "type": "boolean" },
    "image_enabled": {
      "type": "array",
      "items": { "type": "boolean" },
      "minItems": 3,
      "maxItems": 3,
      "contains": { "const": true }
    },
    "image_shape": {
      "type": "array",
      "prefixItems": [
        { "type": "integer", "minimum": 1 },
        { "type": "integer", "minimum": 1 },
        { "const": 3 }
      ],
      "minItems": 3,
      "maxItems": 3
    },
    "control_rate_hz": { "type": "number", "exclusiveMinimum": 0 },
    "model_processor": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "input_scale",
        "input_offset",
        "input_bounds",
        "delta_action_mask",
        "output_clip",
        "reference_revision"
      ],
      "properties": {
        "input_scale": { "$ref": "#/$defs/numberArray" },
        "input_offset": { "$ref": "#/$defs/numberArray" },
        "input_bounds": { "$ref": "#/$defs/boundsArray" },
        "delta_action_mask": { "$ref": "#/$defs/booleanArray" },
        "output_clip": { "$ref": "#/$defs/boundsArray" },
        "reference_revision": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
      }
    }
  },
  "$defs": {
    "numberArray": {
      "type": "array",
      "items": { "type": "number" },
      "minItems": 1
    },
    "booleanArray": {
      "type": "array",
      "items": { "type": "boolean" },
      "minItems": 1
    },
    "boundsArray": {
      "type": "array",
      "items": {
        "oneOf": [
          { "type": "null" },
          {
            "type": "array",
            "items": { "type": "number" },
            "minItems": 2,
            "maxItems": 2
          }
        ]
      },
      "minItems": 1
    }
  }
}
