{
  "openapi": "3.1.0",
  "info": {
    "title": "pipe-broker",
    "description": "Atomic, data-in/data-out operations for multilingual translation and domain-expertise knowledge export.",
    "version": "0.1.0"
  },
  "paths": {
    "/echo": {
      "get": {
        "tags": [
          "ops"
        ],
        "summary": "Echo",
        "description": "Echo atomic op: returns the input unchanged (data in, data out).",
        "operationId": "echo_echo_get",
        "parameters": [
          {
            "name": "data",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "title": "Data"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Echo Echo Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/echo/stream": {
      "get": {
        "tags": [
          "ops"
        ],
        "summary": "Echo Stream",
        "description": "Streaming echo: sends the input back incrementally as a data stream.",
        "operationId": "echo_stream_echo_stream_get",
        "parameters": [
          {
            "name": "data",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "title": "Data"
            }
          },
          {
            "name": "chunk_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 16,
              "title": "Chunk Size"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm": {
      "post": {
        "tags": [
          "llm"
        ],
        "summary": "Llm",
        "description": "Test route: send a prompt to OpenRouter and return the completion.\n\nReads the key from $OPENROUTER_API_KEY (injected in the deployment).\nReturns a 4xx-shaped JSON error rather than a 500 when the LLM stack or\nkey is unavailable, so it's safe to probe.",
        "operationId": "llm_llm_post",
        "parameters": [
          {
            "name": "prompt",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Prompt"
            }
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "openai/gpt-4o-mini",
              "title": "Model"
            }
          },
          {
            "name": "max_tokens",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 256,
              "title": "Max Tokens"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Llm Llm Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/legal/ops": {
      "get": {
        "tags": [
          "legal"
        ],
        "summary": "Legal Ops",
        "description": "List the available atomic legal operations and rule categories.",
        "operationId": "legal_ops_legal_ops_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Legal Ops Legal Ops Get"
                }
              }
            }
          }
        }
      }
    },
    "/legal/detect": {
      "post": {
        "tags": [
          "legal"
        ],
        "summary": "Legal Detect",
        "description": "Run one atomic legal op over text for a given jurisdiction.\n\n``op`` is one of the names from ``GET /legal/ops``; ``jurisdiction`` is a\nhierarchical code like ``us``, ``us/ny``, ``in/mh`` (optionally with\nfacets appended later). Returns the detections found.",
        "operationId": "legal_detect_legal_detect_post",
        "parameters": [
          {
            "name": "text",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Text"
            }
          },
          {
            "name": "jurisdiction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "us",
              "title": "Jurisdiction"
            }
          },
          {
            "name": "op",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "detect_pii",
              "title": "Op"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Legal Detect Legal Detect Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/stt": {
      "post": {
        "tags": [
          "llm"
        ],
        "summary": "Stt",
        "description": "Transcribe an uploaded audio file to text (audio bytes in, text out).\n\nAccepts a multipart file upload; the audio format is inferred from the\nfilename extension (falls back to ``wav``). Reads the key from\n$OPENROUTER_API_KEY. Errors map like /llm (503 missing key, 502 upstream).",
        "operationId": "stt_stt_post",
        "parameters": [
          {
            "name": "model",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "openai/whisper-large-v3",
              "title": "Model"
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Language"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_stt_stt_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Stt Stt Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Body_stt_stt_post": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_stt_stt_post"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  }
}
