{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/paywithlocus-com/json-schema/paywithlocus-com-pricing-explain-schema.json",
  "title": "PricingExplain",
  "description": "The base-cost to effective-price translation for one endpoint, including which configuration level supplied each markup. Money fields are exact decimal strings, and are null for endpoints priced live per call.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/paywithlocus-com-openapi.json#/components/schemas/PricingExplain",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "provider",
    "endpoint",
    "slug",
    "method",
    "dynamic",
    "estimated",
    "enabled",
    "creditsPerDollar",
    "markupBps",
    "markupSource",
    "flatSource",
    "overridden",
    "baseUsd",
    "baseCredits",
    "markupUsd",
    "flatMarkupUsd",
    "marginUsd",
    "marginCredits",
    "effectiveUsd",
    "effectiveCredits",
    "humanSummary"
  ],
  "properties": {
    "provider": {
      "type": "string"
    },
    "endpoint": {
      "type": "string"
    },
    "slug": {
      "type": "string",
      "description": "provider/endpoint"
    },
    "method": {
      "type": "string",
      "description": "Upstream HTTP method."
    },
    "dynamic": {
      "type": "boolean",
      "description": "true when the endpoint is metered and priced per call."
    },
    "estimated": {
      "type": "boolean",
      "description": "true when baseUsd is an estimate rather than a fixed price."
    },
    "enabled": {
      "type": "boolean"
    },
    "creditsPerDollar": {
      "type": "integer"
    },
    "markupBps": {
      "type": "integer"
    },
    "markupSource": {
      "type": "string",
      "enum": [
        "endpoint",
        "provider",
        "global"
      ]
    },
    "flatSource": {
      "type": "string",
      "enum": [
        "endpoint",
        "provider",
        "global"
      ]
    },
    "overridden": {
      "type": "boolean",
      "description": "true when either markup comes from a provider or endpoint override rather than the tenant default."
    },
    "baseUsd": {
      "oneOf": [
        {
          "$ref": "#/$defs/DecimalString"
        },
        {
          "type": "null"
        }
      ]
    },
    "baseCredits": {
      "oneOf": [
        {
          "$ref": "#/$defs/DecimalString"
        },
        {
          "type": "null"
        }
      ]
    },
    "markupUsd": {
      "oneOf": [
        {
          "$ref": "#/$defs/DecimalString"
        },
        {
          "type": "null"
        }
      ],
      "description": "Percentage portion: base times bps/10000, ceiling at 6dp."
    },
    "flatMarkupUsd": {
      "allOf": [
        {
          "$ref": "#/$defs/DecimalString"
        }
      ]
    },
    "marginUsd": {
      "oneOf": [
        {
          "$ref": "#/$defs/DecimalString"
        },
        {
          "type": "null"
        }
      ]
    },
    "marginCredits": {
      "oneOf": [
        {
          "$ref": "#/$defs/DecimalString"
        },
        {
          "type": "null"
        }
      ]
    },
    "effectiveUsd": {
      "oneOf": [
        {
          "$ref": "#/$defs/DecimalString"
        },
        {
          "type": "null"
        }
      ]
    },
    "effectiveCredits": {
      "oneOf": [
        {
          "$ref": "#/$defs/DecimalString"
        },
        {
          "type": "null"
        }
      ]
    },
    "humanSummary": {
      "type": "string",
      "description": "One-sentence plain-language explanation of the price."
    }
  },
  "$defs": {
    "DecimalString": {
      "type": "string",
      "pattern": "^\\d+(?:\\.\\d{1,6})?$",
      "description": "Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply."
    }
  }
}