What LoremLLM is

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/ai-sdk` 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 LoremLLM

  • You are building a chat UI before the backend exists — point `useChat` at `@loremllm/ai-sdk` 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 — OpenAPI 3.1 description of the public HTTP API
  • /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 — every indexable URL on the site
  • /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
stream1900 ms
  1. requestPOST /v1/chat/completions "Refund order A-1042"
  2. reasoningLook up the order, then refund it.
  3. tool calllookupOrder({ id: "A-1042" })
  4. tool result{ status: "delivered", total: 48 }
  5. tool callrefund({ id: "A-1042", amount: 48 })
  6. tool result{ ok: true }
  7. textDone. $48 is on its way back to your card.
  8. usage42 in, 18 out, $0.00
Mock LLM APIOpenAI, Anthropic, AI SDK, MCP

Mock any LLM in seconds

Give every prompt many possible answers. Smart routing picks the right one, locally or on our servers, behind an OpenAI, Anthropic or AI SDK base URL.

No model, no keySeeded, so tests never flake

Many answers per prompt

Smart routing picks one

  • Prompt has "refund"Call lookupOrder, then refund
  • "cancel my plan", or anything like itSteps 70%, retention offer 20%, escalate 10%
  • Matches /weather in (\w+)/Call getWeather with the city
  • Header loremllm-scenario: rate-limitReturn 429 after two chunks
  • Anything elseStream 40 words of lorem

Up and running in three steps

No SDK to learn. No code to change.

  1. 01

    Create a mock

    Describe replies, tool calls and failures in the dashboard or a config file.

  2. 02

    Swap the base URL

    Point your OpenAI, Anthropic or AI SDK client at your mock URL. Keep your code.

  3. 03

    Ship

    Build UIs before the backend exists. Run agent tests that never flake.

Everything an LLM client expects

Minus the model, the latency and the invoice.

Read the docs
  • Smart routing

    Give one prompt many possible results. Smart routing matches by meaning, then picks by weight. Seeded, so the same request lands on the same result every run.

    Matching
    Semantic, regex, exact
    Results
    Weighted, sequenced, pinned
    Runs
    Locally or hosted
  • Drop-in endpoints

    OpenAI, Anthropic and AI SDK compatible out of the box. Change one base URL and your client never knows the difference.

    Formats
    OpenAI, Anthropic, AI SDK
    Setup
    One base URL
    Auth
    Any key works
  • Realistic streaming

    Real server-sent events, chunk by chunk. Dial in time to first token, chunk size and speed, or add jitter on purpose.

    Transport
    SSE
    Controls
    First token, delay, size
    Patterns
    Steady, bursty, jitter
  • Tool calls

    Canned arguments, tool results and the final answer, across as many turns as your agent loop needs.

    Parts
    Call, result, answer
    Turns
    Multi turn
    Protocols
    Function calling, MCP
import { mockLLM, text, toolCall } from "@loremllm/test";

test("refunds a delivered order", async () => {
  await using llm = await mockLLM("support-bot");

  llm.on(/refund/i).replyOnce(
    toolCall("lookupOrder", { id: "A-1042" }),
  );
  llm.on({ toolResult: "lookupOrder" }).replyOnce(
    toolCall("refund", { id: "A-1042", amount: 48 }),
  );
  llm.on({ toolResult: "refund" }).reply(
    text("Done. $48 is on its way back."),
  );

  await agent.run("Refund order A-1042", {
    baseURL: `${llm.url}/v1`,
  });

  expect(llm).toHaveRequestedTool("refund", { amount: 48 });
  expect(payments.refunds).toHaveLength(1);
});
Made for agent tests@loremllm/test

Test the agent, not the model

Script the exact tool calls your code should handle, then assert on what it does with them. No flaky outputs. No tokens burned in CI.

Write your first test
Runs offlineVitest and Jest

Built for real AI apps

The parts of a model you can never get on demand. Now you can.

  • Cheap evals

    Run your agent hundreds of times against weighted outcomes. Get pass rates per branch in seconds, for $0.

  • Mock MCP servers

    Spin up a fake MCP server with tools, resources and prompts. Point any client at its URL.

  • Multi-turn scenarios

    Match on prompt text, regex or turn number, then play replies in order per conversation.

  • Structured output

    Send a JSON schema, get back valid JSON that fits it. Fixed values or generated ones.

  • Error injection

    429s, timeouts, malformed chunks and streams that die halfway. On demand, every time.

  • Reasoning and usage

    Thinking blocks, token usage and cost on every response, shaped like the real thing.

  • Record and replay

    Proxy real model traffic once, save it as a mock, replay it forever for free.

  • Request inspector

    Every request your code made, which scenario answered it, and what streamed back.

  • Team projects

    Shared projects and mock URLs the whole team, and your CI, can point at.

Questions

The short answers.

How is this different from mocking an endpoint?

A prompt can have several possible results. Smart routing matches by meaning and picks one by weight, on our servers for hosted mocks or in process for local ones. Each request is seeded, so tests stay deterministic, and you can pin any result. Run it many times instead and you get cheap evals: pass rates across every outcome, with no model spend.

Does it call a real model?

Only when you record. Everything else is a reply you scripted, stored or asked to be generated. Nothing goes to a provider.

Which clients work?

The OpenAI and Anthropic SDKs, the Vercel AI SDK, any MCP client, and anything that can make an HTTP request.

Do I need an account?

Not for the npm packages or the local server. Hosted mocks, the inspector and team projects need a free account.

Can I run it in CI?

Yes. Use the in-process packages or the local server and your tests run with no network and no key. Routing is seeded, so a request gets the same result every time.

Is it open source?

Yes. The packages, the server and this site are on GitHub.