StackMap
Subscribe
Explore / aimock
CopilotKit

aimock

Mock everything an AI app talks to: 13 providers across 15 API surfaces plus MCP, A2A, AG-UI, vector DBs, search and rerank on one local port — with record-and-replay fixtures.

895 64 TypeScript MITupdated yesterday
View on GitHubDispute this mapping →
Curator's take

The missing piece for testing agent code without burning tokens: point your SDK's base URL at one port and OpenAI, Claude, Gemini, Bedrock, Azure, Vertex, Ollama, Cohere and OpenRouter answer deterministically — streaming, tool rounds and multi-turn traces matched by turn index, tool result or custom predicate. Record real traffic once, replay it forever. Two real gotchas: set the base-URL env before constructing the client, because many SDKs cache it and will quietly hit the real API and bill you; and replay preserves TTFT and average pace, not per-token fidelity. It mocks transport shape, never model behaviour — it proves your plumbing, not your prompts.

Mapped by ShipWithAI editors · links verified
README.md

aimock

Mock infrastructure for AI application testing — point your SDK at one local port and every provider, protocol, and service answers deterministically.

Quick start · The suite · Record & replay · Docs

npm Unit Tests Drift Tests License: MIT

https://github.com/user-attachments/assets/76815122-574a-48e1-b275-edae0a014667

One package, one port, zero dependencies. LLM APIs, image generation and editing, text-to-speech, transcription, audio translation and generation, video generation, embeddings, MCP tools, A2A agents, AG-UI event streams, vector databases, search, rerank, and moderation — no keys, no network, no surprise bills.

Quick Start

npm install @copilotkit/aimock
// The class is still named `LLMock` for back-compat after the v1.7.0 package
// rename from `@copilotkit/llmock` to `@copilotkit/aimock`.
import { LLMock } from "@copilotkit/aimock";

const mock = new LLMock({ port: 0 });
mock.onMessage("hello", { content: "Hi there!" });
await mock.start();

// Set env BEFORE importing/constructing the OpenAI (or other provider) client.
// Many SDKs cache the base URL at construction time — if the client is built
// before these are set, it will talk to the real API (surprise bills) instead
// of aimock.
process.env.OPENAI_BASE_URL = `${mock.url}/v1`;
process.env.OPENAI_API_KEY = "mock"; // SDK requires a value, even when base URL is mocked

// ... run your tests ...

await mock.stop();

The aimock Suite

aimock mocks everything your AI app talks to:

Tool What it mocks Docs
LLMock OpenAI (Chat/Responses/Realtime GA+Beta), Claude, Gemini (REST/Live/Interactions/Embeddings), Bedrock, Azure, Vertex AI, Ollama (chat/embeddings), Cohere (chat/embed), OpenRouter (chat/router), ElevenLabs TTS Providers
MCPMock MCP tools, resources, prompts with session management MCP
A2AMock Agent-to-agent protocol with SSE streaming A2A
AGUIMock AG-UI agent-to-UI event streams for frontend testing AG-UI
VectorMock Pinecone, Qdrant, ChromaDB compat

Continue your stack

What teams reach for next — and why each earns a place beside aimock. Ranked by curator confidence.