acus9345

Mock LLM Server — Testing skill for Claude Code

Testing community

Fake OpenAI- and Anthropic-compatible API with scripted replies, tool calls, errors and streaming, for testing agents without API keys.

How to install Mock LLM Server

This entry records only its repository, not the path inside it, so there is no exact command to give. Open acus9345/mock-llm-server and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Mock LLM Server does

Fake OpenAI- and Anthropic-compatible API with scripted replies, tool calls, errors and streaming, for testing agents without API keys.

Alternatives in Testing

  • Skill Debug — Debug issues methodically — use when stuck on errors, test failures, or unexpected behavior 2.8k ★
  • Test TDD — Run when user calls /test-tdd 957 ★
  • Robotics Agent Skills — Agent skills that make AI coding assistants write production-grade robotics software 170 ★

README

mock-llm-server

A fake OpenAI-, Anthropic- and Gemini-compatible API that returns scripted replies, tool calls, reasoning, errors and streams, so you can unit test agents without API keys. Zero dependencies.

[![npm](https://img.shields.io/npm/v/mock-llm-server)](https://www.npmjs.com/package/mock-llm-server) [![CI](https://github.com/acus9345/mock-llm-server/actions/workflows/ci.yml/badge.svg)](https://github.com/acus9345/mock-llm-server/actions/workflows/ci.yml) [![license](https://img.shields.io/npm/l/mock-llm-server)](LICENSE)

  • Real wire formats: OpenAI Chat Completions, Responses and Embeddings, Anthropic Messages and token counting, Gemini generateContent, streaming, token counting and embeddings. Tested against the official openai, @anthropic-ai/sdk and @google/genai packages, including their streaming helpers.
  • Streaming and tool calls: text arrives word by word over SSE, and tool-call arguments arrive in pieces, just like the real APIs.
  • Reasoning: Anthropic thinking blocks, OpenAI reasoning summaries, Gemini thought parts and DeepSeek-style reasoning_content.
  • Failures: HTTP errors in each provider's format, plus streams that break partway or drop the connection.
  • Script it your way: a queue of replies, rules that match the user's message, or functions that see the whole request.
  • Inspect what was sent: every request is recorded with its system prompt, flattened messages and tool names.
  • Any language: run it as a CLI and script it over HTTP from Python, Go or anything else.

Install

npm install --save-dev mock-llm-server

Quick start

import OpenAI from "openai";
import { startMockLLM } from "mock-llm-server";

const mock = await startMockLLM();
const openai = new OpenAI({ baseURL: mock.openaiBaseURL, apiKey: "test" });

mock.reply("Paris is the capital of France.");

const res = await openai.chat.completions.create({
  model: "gpt-5",
  messages: [{ role: "user", content: "What is t