A self-hosted, OpenAI-compatible mock server. Same endpoints, same response shapes,
same streaming — with deterministic replies and no real key required. Change the
baseURL, keep your code.
$docker run --rm -p 3000:3000 ghcr.io/axium-lab/llm-mock
The official openai SDK talks to llm-mock exactly as it talks to the real API. No mocking libraries, no request interception.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "http://localhost:3000/openai/v1", // the only change in your app
apiKey: "sk-mock-key-01", // any mock key, no real secret
});
const completion = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(completion.choices[0].message.content); // "Echo: Hello!"
Not a stub — a faithful contract, verified in CI against the official SDK.
Responses match the official API shapes, validated in CI with the official openai SDK as the client.
stream: true works on chat completions and the Responses API, with the real typed event stream.
Same request, same bytes. Snapshot-friendly, and identical on a laptop, in CI, or behind a load balancer.
Invalid keys, unknown models and validation errors return the exact OpenAI error envelope — test your error handling too.
Need a specific answer? Send it in a request header. Nothing to register, nothing to clean up.
One Docker command, or bun install && bun start. Mock keys ship in the repo.
Multi-provider by design: each provider mounts under its own URL prefix and implements its own API contract. Here's where each one stands today.
| Provider | Prefix | Status |
|---|---|---|
| OpenAI | /openai/v1 | ✅ Supported |
| Anthropic | /anthropic | 🔜 Planned |
| Gemini (AI Studio) | /gemini | 🔜 Planned |
| Gemini Enterprise (Vertex AI) | — | 🔜 Planned |
| Azure OpenAI | — | 🔜 Planned |
Prebuilt multi-arch image on GHCR, or run from source with Bun.
# Docker
docker run --rm -p 3000:3000 ghcr.io/axium-lab/llm-mock
# From source
git clone https://github.com/axium-lab/llm-mock.git
cd llm-mock
bun install
bun start