aimock Documentation
Complete mock infrastructure for AI application testing. One package, zero dependencies.
Quick Start
Mock LLM APIs
import { LLMock } from "@copilotkit/aimock";
const mock = new LLMock();
await mock.start();
mock.onMessage("hello", { content: "Hi there!" });
Mock your entire stack
{
"llm": { "fixtures": "./fixtures/llm" },
"mcp": { "tools": [{ "name": "search", "result": "3 results" }] },
"a2a": { "agents": [{ "name": "planner" }] },
"vector": { "collections": [{ "name": "docs", "dimension": 1536 }] }
}
What's New
List and look up Gemini and Anthropic models in their native formats (the Anthropic
list is opt-in), and estimate prompt size with count_tokens /
countTokens
Opt in to provider-native 401 bodies and required-header checks, so you can test how
your app handles a bad key or a missing anthropic-version
Opt-in faults that real models produce: invalid tool JSON, unknown tools, schema violations, length stops, refusals, and empty replies
Docs →Record a live MCP server once, replay it offline, script tool answers per scenario, and see which fakes each test used
Docs →Anthropic streams stop and journal when the client disconnects, and non-streaming OpenAI replies can opt in to streaming-profile timing
Docs →
Opt-in namespaced functions and custom tool calls, plus commentary /
final_answer message phases (new in 1.46.0)
Files, Batches, Fine-tuning jobs, and Vector Stores with deterministic search
Docs →Mock, record, and replay OpenAI GPT-Live sessions, with message, audio, and lifetime limits
Docs →The Suite
| Mock | What it does | Docs |
|---|---|---|
| LLM Providers | OpenAI, Claude, Gemini, Gemini Interactions, Bedrock, Azure, Vertex AI, Ollama, Cohere, OpenRouter | Docs → |
| Multimedia | Image generation, TTS, transcription, video | Docs → |
| MCP Protocol | Tools, resources, prompts, session management | Docs → |
| A2A Protocol | Agent cards, message routing, SSE streaming | Docs → |
| AG-UI Protocol | Event streams for CopilotKit frontends | Docs → |
| Vector DBs | Pinecone, Qdrant, ChromaDB | Docs → |
| Files | Upload, list, retrieve, download and delete, byte-exact | Docs → |
| Services | Search, rerank, moderation | Docs → |