{
  "openapi": "3.0.3",
  "info": {
    "title": "BlorpAg",
    "version": "1.0.0",
    "description": "Bounded text utilities, paid per request over x402 (USDC on Base). Discovery and catalog stay free."
  },
  "servers": [
    {
      "url": "https://x402.valintix.com"
    }
  ],
  "paths": {
    "/v1/summarize": {
      "post": {
        "summary": "Bounded extractive summary of the input text (1..8 sentences). Without a reachable gateway the text never leaves this container.",
        "operationId": "summarize",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "additionalProperties": false,
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Input text, 1..4000 characters"
                  },
                  "max_sentences": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 8,
                    "default": 4
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "operation",
                    "summary",
                    "mode",
                    "input_chars",
                    "sentences_in",
                    "sentences_out",
                    "bounded"
                  ],
                  "properties": {
                    "operation": {
                      "type": "string",
                      "enum": [
                        "summarize"
                      ]
                    },
                    "summary": {
                      "type": "string",
                      "description": "Summary truncated to 2000 characters"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "extractive",
                        "local_model"
                      ],
                      "description": "extractive = no model used; local_model = gateway answered"
                    },
                    "input_chars": {
                      "type": "integer"
                    },
                    "sentences_in": {
                      "type": "integer"
                    },
                    "sentences_out": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "null when mode is local_model"
                    },
                    "bounded": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "max_input_chars",
                        "max_output_chars"
                      ],
                      "properties": {
                        "max_input_chars": {
                          "type": "integer"
                        },
                        "max_output_chars": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "payment required: sign the payment and retry with the X-Payment header"
          },
          "400": {
            "description": "invalid request"
          }
        }
      }
    },
    "/v1/transform": {
      "post": {
        "summary": "Deterministic, bounded text transforms (case, whitespace, lines). No model involved, no outbound request.",
        "operationId": "transform",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "additionalProperties": false,
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Input text, 1..4000 characters"
                  },
                  "operations": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "lower",
                        "upper",
                        "trim",
                        "collapse_whitespace",
                        "dedupe_lines",
                        "sort_lines"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 6
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "operation",
                    "text",
                    "operations_applied",
                    "truncated",
                    "input_chars",
                    "output_chars",
                    "bounded",
                    "allowed_operations"
                  ],
                  "properties": {
                    "operation": {
                      "type": "string",
                      "enum": [
                        "transform"
                      ]
                    },
                    "text": {
                      "type": "string",
                      "description": "Transformed text, truncated to 2000 characters"
                    },
                    "operations_applied": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "truncated": {
                      "type": "boolean",
                      "description": "true when the untruncated result exceeded max_output_chars"
                    },
                    "input_chars": {
                      "type": "integer"
                    },
                    "output_chars": {
                      "type": "integer"
                    },
                    "bounded": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "max_input_chars",
                        "max_output_chars"
                      ],
                      "properties": {
                        "max_input_chars": {
                          "type": "integer"
                        },
                        "max_output_chars": {
                          "type": "integer"
                        }
                      }
                    },
                    "allowed_operations": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "payment required: sign the payment and retry with the X-Payment header"
          },
          "400": {
            "description": "invalid request"
          }
        }
      }
    }
  },
  "x-x402": {
    "scheme": "exact",
    "network": "eip155:8453",
    "asset": "USDC",
    "price_usdc": {
      "summarize": 0.01,
      "transform": 0.01
    },
    "docs": "https://x402.valintix.com/.well-known/x402"
  }
}
