open source · MIT

Test your LLM integrations
without exposing your API key

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

Change one line, keep your code

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!"

Built for real integration tests

Not a stub — a faithful contract, verified in CI against the official SDK.

OpenAI-compatible contract

Responses match the official API shapes, validated in CI with the official openai SDK as the client.

Streaming (SSE)

stream: true works on chat completions and the Responses API, with the real typed event stream.

Deterministic & stateless

Same request, same bytes. Snapshot-friendly, and identical on a laptop, in CI, or behind a load balancer.

Real error flows

Invalid keys, unknown models and validation errors return the exact OpenAI error envelope — test your error handling too.

Controllable replies

Need a specific answer? Send it in a request header. Nothing to register, nothing to clean up.

Zero setup

One Docker command, or bun install && bun start. Mock keys ship in the repo.

Provider support

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.

ProviderPrefixStatus
OpenAI/openai/v1✅ Supported
Anthropic/anthropic🔜 Planned
Gemini (AI Studio)/gemini🔜 Planned
Gemini Enterprise (Vertex AI)🔜 Planned
Azure OpenAI🔜 Planned

Get started

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