{
  "openapi": "3.1.0",
  "info": {
    "title": "TokenFlow capability discovery",
    "version": "1.0.0",
    "description": "Read-only product discovery. Inference retains its native protocols. Published static contracts are available when runtime observations are unknown. Tenant authentication does not accept stale identity."
  },
  "servers": [
    {
      "url": "https://api.tokenflow.dev"
    }
  ],
  "paths": {
    "/v1/public/capabilities": {
      "get": {
        "operationId": "publicListCapabilities",
        "summary": "List published capabilities without credentials",
        "security": [],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "llm",
                "asr",
                "tts"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor bound to catalogue version and kind; restart on stale_cursor."
          }
        ],
        "responses": {
          "200": {
            "description": "no-store observation; not a reservation or execution guarantee",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityList"
                }
              }
            }
          },
          "400": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/public/capabilities/{id}": {
      "get": {
        "operationId": "publicInspectCapability",
        "summary": "Inspect one published capability without credentials",
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "no-store observation; not a reservation or execution guarantee",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Capability"
                }
              }
            }
          },
          "400": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/capabilities": {
      "get": {
        "operationId": "tenantListCapabilities",
        "summary": "List published capabilities with this tenant’s access and quota",
        "security": [
          {
            "tenantKey": []
          }
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "llm",
                "asr",
                "tts"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor bound to catalogue version and kind; restart on stale_cursor."
          }
        ],
        "responses": {
          "200": {
            "description": "no-store observation; not a reservation or execution guarantee",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityList"
                }
              }
            }
          },
          "400": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/capabilities/{id}": {
      "get": {
        "operationId": "tenantInspectCapability",
        "summary": "Inspect one published capability with this tenant’s access and quota",
        "security": [
          {
            "tenantKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "no-store observation; not a reservation or execution guarantee",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Capability"
                }
              }
            }
          },
          "400": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem Details with code and retryable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "tenantKey": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Capability": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "publication",
          "schema_version",
          "contract_hash",
          "summary",
          "protocols",
          "guaranteed",
          "documented",
          "billing",
          "availability",
          "effective",
          "runtime_revision",
          "next"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "llm",
              "asr",
              "tts"
            ]
          },
          "publication": {
            "const": "public"
          },
          "schema_version": {
            "const": 1
          },
          "contract_hash": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "protocols": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Protocol"
            }
          },
          "guaranteed": {
            "type": "object"
          },
          "documented": {
            "type": "object"
          },
          "billing": {
            "type": "object",
            "description": "meter, pricing status, units and billing basis; quote_required is not zero price."
          },
          "external_limits": {
            "type": [
              "object",
              "null"
            ]
          },
          "availability": {
            "$ref": "#/components/schemas/Observation"
          },
          "effective": {
            "type": [
              "object",
              "null"
            ]
          },
          "runtime_revision": {
            "type": [
              "string",
              "null"
            ]
          },
          "access": {
            "type": "object",
            "description": "Tenant-only; allowed/denied/unknown with reason."
          },
          "quota": {
            "type": "object",
            "description": "Tenant-only; known/unknown. Values use the meter unit (ASR milliseconds), null limit means unlimited; absent limit means unknown."
          },
          "next": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "method",
                "path",
                "content_type",
                "body"
              ]
            }
          }
        }
      },
      "Protocol": {
        "type": "object",
        "required": [
          "id",
          "method",
          "path",
          "content_type",
          "modes",
          "schema_scope",
          "input_schema",
          "constraints",
          "example"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "method": {
            "const": "POST"
          },
          "path": {
            "type": "string"
          },
          "content_type": {
            "type": "string"
          },
          "modes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "schema_scope": {
            "enum": [
              "supported_subset",
              "complete_fields"
            ]
          },
          "input_schema": {
            "type": "object"
          },
          "constraints": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "example": {
            "type": "object"
          }
        }
      },
      "Observation": {
        "type": "object",
        "required": [
          "status",
          "reason",
          "source_observed_at",
          "fetched_at",
          "valid_until"
        ],
        "properties": {
          "status": {
            "enum": [
              "available",
              "unavailable",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "source_observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "fetched_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "CapabilityList": {
        "type": "object",
        "required": [
          "items",
          "next_cursor",
          "catalog_hash"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Capability"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "catalog_hash": {
            "type": "string"
          }
        }
      },
      "Problem": {
        "type": "object",
        "required": [
          "status",
          "code",
          "detail",
          "retryable"
        ],
        "properties": {
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
