Controlled LLM Access API (api/llm.php)

Standalone Qwiki includes a dedicated, key-authenticated REST endpoint (api/llm.php) tailored for Large Language Models, coding agents, and RAG pipelinesβ€”keeping access scoped, token-efficient, and strictly compliant with document lifecycle and visibility rules.

LLM and AI Agent Access Keys modal showing scoped key creation and OpenAPI schema discovery

Minting Scoped qwk_llm_... Tokens

Open admin β–Ύ βž” πŸ€– LLM & API Access (or βš™οΈ Settings βž” πŸ“‘ Feeds & Integrations βž” Manage Keys):

  • Key Name: Human-readable label (e.g., "Cursor Docs Agent", "Support RAG").
  • Category Scope: Restrict access to a single category branch (and its nested folders) or leave blank for all permitted categories.
  • Allowed Document Types: Choose which formats the key may retrieve (markdown, html, pdf, gdoc).
  • Optional Expiration: Set an expiration timestamp, or revoke/reactivate keys at any time.
Note

Draft, In Review, and Archived documents are always excluded from api/llm.php responses, even for active keys.

Operation Modes (?mode=...)

Pass your token via Authorization: Bearer qwk_llm_..., X-API-Key: qwk_llm_..., or ?key=qwk_llm_...:

Mode Query Parameters Response & Use Case
schema / openapi None (no key required) Returns the live OpenAPI 3.0 specification for tool calling and agent registration.
tree (default) Optional category, format=json or format=llms.txt (markdown/md) Lists permitted documents with token estimates, or renders a standard llms.txt Markdown index. Supports ETag / If-None-Match (304 Not Modified).
doc / document slug, optional offset, limit, format=raw/markdown, include_comments=1, include_talk=1 Retrieves document content (with character offset/limit slicing for tight context windows) and optional comment/talk threads.
search q, optional limit (1–50, default 10) Keyword search across permitted documents within the key's category and format scope.
comments slug, optional format=json or format=markdown Retrieves threaded chapter comments.
talk slug, optional format=json or format=markdown Retrieves Wikipedia-style editorial Talk Page discussions.

Quick Verification with curl

# Fetch llms.txt index
curl -sS -H "Authorization: Bearer $QWIKI_LLM_KEY" \
  "https://home.qwiki.wiki/manual/api/llm.php?mode=tree&format=llms.txt"

# Fetch a single chapter with Talk Page context as raw Markdown
curl -sS -H "Authorization: Bearer $QWIKI_LLM_KEY" \
  "https://home.qwiki.wiki/manual/api/llm.php?mode=doc&slug=ai-llm-access-api&format=raw&include_talk=1"