Visitar URL original
Documentation — aimock

aimock Documentation

Complete mock infrastructure for AI application testing. One package, zero dependencies.

Quick Start

Mock LLM APIs

Programmatic usage ts
import { LLMock } from "@copilotkit/aimock";

const mock = new LLMock();
await mock.start();

mock.onMessage("hello", { content: "Hi there!" });

Quick Start: LLM →

Mock your entire stack

aimock.json config json
{
  "llm":    { "fixtures": "./fixtures/llm" },
  "mcp":    { "tools": [{ "name": "search", "result": "3 results" }] },
  "a2a":    { "agents": [{ "name": "planner" }] },
  "vector": { "collections": [{ "name": "docs", "dimension": 1536 }] }
}

Quick Start: full suite →

What's New

Citations & Generated Images New in 1.47.0

Script source citations on OpenAI, Claude and Gemini replies, and generated images on the Responses API and Gemini, in each provider's own format

Docs →
Raw Passthrough New in 1.47.0

Send provider events or JSON exactly as written, for fields aimock does not model yet, with timing, chaos and disconnects still applied

Docs →
Stream Realism New in 1.47.0

Every LLM provider stops sending and journals the request when the client hangs up, and non-streaming replies on every provider can opt in to realistic timing

Docs →
Native Catalogs & Auth Errors New in 1.46.0

Gemini and Anthropic model lists, token counts, and opt-in provider-native 401s, so you can test model pickers and bad-key handling

Docs →
Model Misbehavior

Opt-in faults that real models produce: invalid tool JSON, unknown tools, schema violations, length stops, refusals, and empty replies

Docs →
MCP Record & Replay

Record a live MCP server once, replay it offline, script tool answers per scenario, and see which fakes each test used

Docs →
Responses API Tools

Opt-in namespaced functions and custom tool calls, plus commentary / final_answer message phases (new in 1.46.0)

Docs →
OpenAI Platform APIs

Files, Batches, Fine-tuning jobs, and Vector Stores with deterministic search

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 →

Framework Guides

Switching from other tools?