# LoremLLM — Mock responses for LLMs

> LoremLLM mocks LLM responses: store input/output pairs in a collection and a hosted endpoint streams back the best semantic match in the AI SDK UI message format, instead of calling a real model.

LoremLLM is a set of tools for building and testing AI interfaces without paying for, or waiting on, a real language model. It is open source and built by Kaiyu Hsu.

There are two ways to use it. The `@loremllm/transport` npm package is a chat transport for the Vercel AI SDK: you describe the exact message parts the UI should receive — text, reasoning, tool calls — and `useChat` streams them back with no network request at all. The hosted API at `/api/chat` does the same over HTTP: it streams lorem ipsum, replays a markdown string, or answers from a collection of recorded interactions, picking the closest one by embedding similarity.

## When to use this

- **You are building a chat UI before the backend exists**: point `useChat` at `@loremllm/transport` or at `/api/chat` and the UI receives a realistic streamed response today
- **You need deterministic AI responses in tests or demos**: a collection maps known inputs to fixed outputs, so the same question always gets the same answer, token by token
- **You want to exercise streaming edge cases**: the transport can emit reasoning parts, tool calls and custom chunk timing that are hard to reproduce against a live model
- **You need filler text shaped like model output**: `POST /api/chat` with `{"type":"lorem"}` streams generated lorem ipsum as an AI SDK UI message stream — no account, no key
- **Not a fit**: LoremLLM does not run a language model, generate novel answers, or proxy to OpenAI or Anthropic. It replays what you stored; for real completions, call a real model provider

## How to use it

How to call it: `POST /api/chat` with a JSON body whose `type` is `"lorem"`, `"markdown"` or `"chat"`. The response is an AI SDK UI message stream (server-sent events), so `useChat` from `@ai-sdk/react` consumes it directly. Lorem and markdown requests need no account. Chat requests name a public collection by its id; collections are created in the dashboard after signing up. Errors are `application/problem+json`. The full contract is in `/openapi.json` and on `/docs`.

Reading it as an agent: send `Accept: text/markdown` to any page URL — or append `.md` to it — and the same page comes back as Markdown instead of HTML. `/llms.txt` carries this overview in one request, and `/sitemap.xml` lists every indexable URL.

## Machine-readable endpoints

- [/openapi.json](https://www.loremllm.com/openapi.json): OpenAPI 3.1 description of the public HTTP API
- [/docs](https://www.loremllm.com/docs): API reference: request types, streaming format, errors, the eve endpoint and the npm transport
- **POST /api/chat**: streams a mock response — lorem ipsum, a markdown string, or the best match from a public collection
- **/api/eve/<collectionId>**: eve-protocol host for a collection, for clients built on the eve agent framework
- [/sitemap.xml](https://www.loremllm.com/sitemap.xml): every indexable URL on the site
- [/llms.txt](https://www.loremllm.com/llms.txt): this overview, for agents
- **Markdown for any page**: send `Accept: text/markdown` to any page URL, or append `.md` to it, and the same content comes back as Markdown

## Pages

- [Docs](https://www.loremllm.com/docs): the API and the npm transport, with examples
- [About](https://www.loremllm.com/about): what this is and who builds it
- [Contact](https://www.loremllm.com/contact): email and GitHub
- [Privacy](https://www.loremllm.com/privacy): what is collected and who processes it
