Skip to Content
LoremLLM

@loremllm/anthropic

Run a mock behind the Anthropic SDK, in process.

npm install -D @loremllm/anthropic
import Anthropic from "@anthropic-ai/sdk";
import { createAnthropicMock } from "@loremllm/anthropic";
import { supportBot } from "./mocks";

const mock = createAnthropicMock(supportBot);

const anthropic = new Anthropic({ apiKey: "test", fetch: mock.fetch });

It supports the Messages API with streaming, tool use, extended thinking and token counting, the same as the Anthropic endpoint.

mock.requests and mock.reset() work as in @loremllm/openai.