{
  "openapi": "3.1.0",
  "info": {
    "title": "Dragos Roua blog API",
    "version": "1.0.0",
    "summary": "Ask questions grounded in the public blog wiki, and check that the ask service is up.",
    "description": "POST /ask answers from the blog wiki and streams Server-Sent Events. GET /health reports that the worker is up. Markdown copies of individual posts are a separate resource at /{slug}.md and use x402 (0.01 USDC on Base)."
  },
  "servers": [
    {
      "url": "https://dragosroua.com"
    }
  ],
  "paths": {
    "/ask": {
      "post": {
        "operationId": "askBlog",
        "summary": "Ask the blog",
        "description": "Send a question. The response is text/event-stream. Each event is data: {\"content\":\"...\"} and the stream ends with data: [DONE]. Message length is capped at 600 characters. The worker rate-limits by IP.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["message"],
                "properties": {
                  "message": {
                    "type": "string",
                    "maxLength": 600
                  },
                  "history": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "required": ["role", "content"],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": ["user", "assistant"]
                        },
                        "content": {
                          "type": "string",
                          "maxLength": 500
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SSE stream of answer fragments.",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Missing message, message too long, or rejected input."
          },
          "429": {
            "description": "Rate limit exceeded."
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "askHealth",
        "summary": "Ask-service health",
        "responses": {
          "200": {
            "description": "Worker is up.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["ok"],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "posts": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
