{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/huggingbay-xyz/json-schema/huggingbay-xyz-route-execution-response-schema.json",
  "title": "RouteExecutionResponse",
  "description": "Execution plus the $0 meter and the honest route comparison card.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/huggingbay-xyz-run-openapi.json#/components/schemas/RouteExecutionResponse",
  "properties": {
    "schema": {
      "type": "string",
      "title": "Schema",
      "default": "bay-run.task-execution.v1"
    },
    "execution_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Execution Id"
    },
    "quote_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Quote Id"
    },
    "task_profile_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Task Profile Id"
    },
    "status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Status"
    },
    "output": {
      "title": "Output"
    },
    "actual_price_usd": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Actual Price Usd"
    },
    "actual_latency_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Actual Latency Ms"
    },
    "provider": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Provider"
    },
    "model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model"
    },
    "model_version": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model Version"
    },
    "route": {
      "additionalProperties": true,
      "type": "object",
      "title": "Route"
    },
    "fallback_route": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fallback Route"
    },
    "quality": {
      "title": "Quality"
    },
    "payment_status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Payment Status"
    },
    "payment_receipt": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Payment Receipt"
    },
    "data_retention": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "none",
            "execution_metadata",
            "task_profile"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Data Retention"
    },
    "input_hash": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Input Hash"
    },
    "replayed": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Replayed"
    },
    "execution_receipt": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Execution Receipt"
    },
    "output_retained": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Output Retained"
    },
    "learning": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Learning"
    },
    "next_call": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Call",
      "description": "Machine-readable verification call for the returned execution, when available."
    },
    "durable_free_key": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Durable Free Key",
      "description": "Email-free durable-key offer with its published daily task quota."
    },
    "route_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Route Id"
    },
    "meter": {
      "anyOf": [
        {
          "$ref": "#/$defs/MeterResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "comparison_card": {
      "anyOf": [
        {
          "$ref": "#/$defs/ComparisonCardResponse"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "additionalProperties": true,
  "type": "object",
  "required": [
    "schema",
    "execution_id",
    "quote_id",
    "status",
    "output",
    "actual_price_usd",
    "actual_latency_ms",
    "payment_status",
    "replayed"
  ],
  "$defs": {
    "ComparisonCardResponse": {
      "properties": {
        "schema": {
          "type": "string",
          "title": "Schema",
          "default": "bay-run.comparison-card.v1"
        },
        "available": {
          "type": "boolean",
          "title": "Available"
        },
        "p50_ms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "P50 Ms"
        },
        "est_usd": {
          "type": "string",
          "title": "Est Usd"
        },
        "f1": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "F1"
        },
        "f1_ci": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "F1 Ci"
        },
        "n_labels": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "N Labels"
        },
        "frontier_comparison": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Frontier Comparison"
        },
        "comparison_basis": {
          "type": "string",
          "const": "measured_route_only",
          "title": "Comparison Basis",
          "default": "measured_route_only"
        },
        "reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text"
        },
        "html": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Html"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "available",
        "est_usd"
      ],
      "title": "ComparisonCardResponse",
      "description": "Measured route-only comparison; frontier claims stay explicitly absent."
    },
    "MeterResponse": {
      "properties": {
        "schema": {
          "type": "string",
          "title": "Schema",
          "default": "bay-run.meter.v1"
        },
        "est_usd": {
          "type": "string",
          "title": "Est Usd"
        },
        "authorized_ceiling_usd": {
          "type": "string",
          "title": "Authorized Ceiling Usd"
        },
        "actual_usd": {
          "type": "string",
          "title": "Actual Usd"
        },
        "model": {
          "type": "string",
          "maxLength": 321,
          "minLength": 1,
          "title": "Model"
        },
        "region": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "title": "Region"
        },
        "retention": {
          "type": "string",
          "const": "none",
          "title": "Retention",
          "default": "none"
        },
        "no_training": {
          "type": "boolean",
          "const": true,
          "title": "No Training",
          "default": true
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "est_usd",
        "authorized_ceiling_usd",
        "actual_usd",
        "model",
        "region"
      ],
      "title": "MeterResponse",
      "description": "Display-only invoice facts; no field authorizes a charge."
    }
  }
}