{"openapi":"3.1.0","info":{"title":"pavlo.sh API","version":"1.0.0","summary":"Public API of Pavlo Golovatyy's site: articles and a token counter.","description":"Read-only access to articles on production AI and LLM engineering, and a cl100k_base token counter. No authentication. Errors are JSON objects with a stable `code`, a `message`, and a `hint`.","contact":{"name":"Pavlo Golovatyy","url":"https://pavlo.sh/contact","email":"ciao@pavlo.sh"}},"externalDocs":{"description":"Developer resources","url":"https://pavlo.sh/developers"},"servers":[{"url":"https://pavlo.sh"}],"tags":[{"name":"posts","description":"Blog articles"},{"name":"tokenizer","description":"Token counting"}],"paths":{"/api":{"get":{"operationId":"getApiIndex","summary":"List API endpoints","responses":{"200":{"description":"API name, links, and endpoint list.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/posts":{"get":{"operationId":"listPosts","tags":["posts"],"summary":"List all articles, newest first","responses":{"200":{"description":"All published articles.","content":{"application/json":{"schema":{"type":"object","required":["count","posts"],"properties":{"count":{"type":"integer"},"posts":{"type":"array","items":{"$ref":"#/components/schemas/PostSummary"}}}}}}}}}},"/api/posts/{slug}":{"get":{"operationId":"getPost","tags":["posts"],"summary":"Get one article with its markdown body","parameters":[{"name":"slug","in":"path","required":true,"description":"Article slug, as returned by listPosts.","schema":{"type":"string"},"example":"why-tokens-matter"}],"responses":{"200":{"description":"The article.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Post"}}}},"404":{"description":"No article with that slug (code `post_not_found`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/tokenizer":{"get":{"operationId":"countTokensQuery","tags":["tokenizer"],"summary":"Count cl100k_base tokens in short text","parameters":[{"name":"text","in":"query","required":true,"description":"Text to tokenize.","schema":{"type":"string"},"example":"Hello, agents"}],"responses":{"200":{"description":"Token count, decoded token strings, and token ids.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenizerResult"}}}},"400":{"description":"Missing `text` (code `missing_text`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Tokenizer unavailable (code `tokenizer_unavailable`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"countTokens","tags":["tokenizer"],"summary":"Count cl100k_base tokens","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string"}}},"example":{"text":"Hello, agents"}}}},"responses":{"200":{"description":"Token count, decoded token strings, and token ids.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenizerResult"}}}},"400":{"description":"Body is not JSON (`invalid_json`) or lacks a string `text` (`missing_text`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Tokenizer unavailable (code `tokenizer_unavailable`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["status","code","message","hint","docs"],"properties":{"status":{"type":"integer","description":"HTTP status code."},"code":{"type":"string","description":"Stable machine-readable error code.","examples":["not_found","post_not_found","missing_text","invalid_json","method_not_allowed"]},"message":{"type":"string","description":"What went wrong."},"hint":{"type":"string","description":"How to fix the request."},"docs":{"type":"string","format":"uri"}}}}},"PostSummary":{"type":"object","required":["slug","title","summary","publishedAt","url","markdownUrl","apiUrl"],"properties":{"slug":{"type":"string"},"title":{"type":"string"},"summary":{"type":"string"},"publishedAt":{"type":"string","format":"date"},"url":{"type":"string","format":"uri"},"markdownUrl":{"type":"string","format":"uri"},"apiUrl":{"type":"string","format":"uri"}}},"Post":{"allOf":[{"$ref":"#/components/schemas/PostSummary"},{"type":"object","required":["content"],"properties":{"content":{"type":"string","description":"Article body in markdown."}}}]},"TokenizerResult":{"type":"object","required":["tokenCount","tokens","ids"],"properties":{"tokenCount":{"type":"integer"},"tokens":{"type":"array","items":{"type":"string"}},"ids":{"type":"array","items":{"type":"integer"}}}}}}}