Project llm-mock-server
Type Aliases§
- FormatName
The LLM API wire format that was detected for a request.
- LogLevel
Log verbosity, from
"none"(silent) through to"all"(everything).- Match
Determines whether a rule matches an incoming request.
- Reply
A reply is either a plain string (turns into
{ text: "..." }) or a full reply object.- Resolver
A reply value or a function that produces one. Async functions are supported.
- SequenceEntry
A single entry in a reply sequence. Can be a plain reply or a reply with per-step options.
Functions§
- createMock
Create a server and start it in one go.
Classes§
- MockServer
Mock LLM server that handles OpenAI Chat Completions, Anthropic Messages, and OpenAI Responses API formats. Register rules with
when(), point your SDK aturl, and go.- RequestHistory
Records every request the server handles. Iterable and has fluent query methods for test assertions.
Interfaces§
- ErrorReply
An HTTP error response. The server returns this status code with a format-appropriate body.
- Handler
The shape of a handler file's default export. You can export a single handler or an array of them.
- MatchObject
A structured matcher. Every field you set must match for the rule to fire.
- Message
A single conversation message, normalised across all supported formats.
- MockRequest
A normalised view of an incoming request, regardless of the original wire format. This is what rule matchers and resolvers receive.
- MockServerOptions
Options for constructing a
MockServeror callingcreateMock().- PendingRule
Returned by
when(). Call.reply()or.replySequence()on it to complete the rule.- RecordedRequest
A recorded request with the rule that matched and when it happened.
- ReplyObject
A structured reply. Text, reasoning, tool calls, usage, and errors are all optional.
- ReplyOptions
Per-rule streaming options. Merged with server-level defaults, with per-rule values winning.
- RuleHandle
A handle to a registered rule. All methods return
thisfor chaining.- RuleSummary
A summary of a registered rule, for inspection via
server.rules.- ToolCall
A tool call in the mock response.
- ToolDef
A tool definition from the request's
toolsarray, normalised across formats.