LoremLLM developer docs

LoremLLM has one public HTTP endpoint, POST https://www.loremllm.com/api/chat, plus an eve-protocol host per collection and an npm package that needs no server at all. The machine-readable contract is /openapi.json.

POST /api/chat

Send a JSON body with an explicit type of "lorem", "markdown" or "chat". The response is an AI SDK UI message stream (text/event-stream), so useChat from @ai-sdk/react reads it without any adapter. CORS is open, so a browser app on any origin can call it. Lorem and markdown requests need no account and no key.

# generated lorem ipsum
curl -N -X POST https://www.loremllm.com/api/chat \
  -H 'content-type: application/json' \
  -d '{"type":"lorem","units":"sentences","count":3}'

# replay a markdown string as a stream
curl -N -X POST https://www.loremllm.com/api/chat \
  -H 'content-type: application/json' \
  -d '{"type":"markdown","markdown":"# Hello\n\nStreamed word by word."}'

# best semantic match from a public collection
curl -N -X POST https://www.loremllm.com/api/chat \
  -H 'content-type: application/json' \
  -d '{"type":"chat","collectionId":"<publicId>","messages":[{"role":"user","parts":[{"type":"text","text":"Hello"}]}]}'

Request types

  • lorem — optional units (words, sentences, paragraphs), count, sentence and paragraph bounds, suffix, and a custom words vocabulary
  • markdown — required markdown string, streamed back as-is and split into word-sized chunks
  • chat — required collectionId (a collection's public id) and the AI SDK messages array; the last user message is embedded and matched against the collection. The finish event carries the matched interaction's interactionId, title and similarity as message metadata

Errors

Failures are application/problem+json (RFC 9457) with type, title, status and detail. 400 is an invalid body, 403 a private collection, 404 an unknown collection or no interaction above the collection's similarity threshold, 500 anything unexpected.

{
  "type": "about:blank",
  "title": "Bad Request",
  "status": 400,
  "detail": "Unknown request type \"foo\". Expected \"chat\", \"markdown\", or \"lorem\"."
}

Collections

A collection is a set of input/output pairs you record in the dashboard. Each input is embedded when saved; a chat request embeds the incoming question and replies with the closest output. A collection can set a minimum similarity, below which the API answers 404 instead of replying with a weak match. Only collections marked public can be queried without signing in. Creating collections requires a free account.

eve endpoint

https://www.loremllm.com/api/eve/<collectionId> is a host for the eve agent protocol. Point an eve client at it and every turn is answered with the collection's best match, e.g. POST /api/eve/<collectionId>/eve/v1/session with {"message":"Hello"}.

@loremllm/transport

For mocks that never leave the browser, install the transport and pass it to useChat. Its mockResponse async generator yields the parts the assistant message should contain; the transport chunks and streams them with configurable delays.

import { StaticChatTransport } from "@loremllm/transport";
import { useChat } from "@ai-sdk/react";

const transport = new StaticChatTransport({
  chunkDelayMs: 25,
  async *mockResponse() {
    yield { type: "text", text: "Hello! How can I help you today?" };
  },
});

const { messages, sendMessage } = useChat({ transport });

Links