aimock: Comprehensive Mocking for AI Application Testing
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
aimock is a powerful tool designed for comprehensive testing of AI applications by mocking various AI APIs and services. It offers a unified solution to simulate interactions with LLM APIs, vector databases, and other AI infrastructure, ensuring deterministic and efficient testing workflows. With features like record and replay, chaos testing, and seamless framework integrations, aimock significantly simplifies the development and validation of robust AI systems.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
aimock is a robust and comprehensive mocking infrastructure designed for testing AI applications. It allows developers to mock virtually everything an AI app interacts with, including LLM APIs, Multi-Cloud Protocol (MCP) tools, Agent-to-Agent (A2A) protocols, AG-UI event streams, vector databases, search services, and more. This powerful tool provides a unified solution in a single package, running on one port, with zero external dependencies, making it an ideal choice for creating deterministic and efficient testing environments for complex AI systems.
Installation
Getting started with aimock is straightforward. You can install it via npm:
npm install @copilotkit/aimock
Examples
Here's a quick example demonstrating how to use aimock to mock an OpenAI API call in your tests. Remember to set environment variables before importing or constructing your AI provider client to ensure your tests interact with aimock instead of real APIs.
// 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();
Why Use aimock?
aimock stands out as an essential tool for AI development and testing due to several key features:
- Comprehensive API Mocking: It supports a vast array of AI services, including OpenAI (Chat, Responses, Realtime), Claude, Gemini, Bedrock, Azure, Vertex AI, Ollama, Cohere, OpenRouter, ElevenLabs TTS, image generation, image editing, text-to-speech, audio transcription, video generation, and more.
- Record & Replay: Capture real API interactions and replay them deterministically. This feature includes timing-aware recording and replay, allowing for accurate simulation of response timings.
- Chaos Testing: Introduce controlled failures such as 500 errors, malformed JSON, or mid-stream disconnects to test the resilience of your AI application.
- Zero Dependencies: Built entirely from Node.js builtins, aimock is lightweight and avoids dependency conflicts.
- Multi-turn Conversations: Easily record and replay complex multi-turn interactions with tool calls.
- Framework Integrations: Seamlessly integrate with popular AI agent frameworks like LangChain, CrewAI, PydanticAI, LlamaIndex, Google ADK, and Microsoft Agent Framework.
- Developer-Friendly Tools: Offers a powerful CLI, Docker and Helm support for CI/CD, GitHub Action, and Vitest/Jest plugins for streamlined testing workflows.
- Drift Detection: Validate against real APIs daily to detect any unexpected changes.
Links
Related repositories
Similar repositories that may be relevant next.

LangTest: A Comprehensive Library for Safe & Effective Language Models
June 30, 2026
LangTest is an open-source Python library dedicated to ensuring the safety and effectiveness of language models. It offers a comprehensive framework for testing model quality, covering robustness, bias, fairness, and accuracy across various NLP tasks and LLM providers. With LangTest, developers can generate and execute over 60 distinct test types with just one line of code, promoting responsible AI development.

Giskard-OSS: Open-Source Evaluation & Testing Library for LLM Agents
January 30, 2026
Giskard-OSS is an open-source Python library designed for evaluating and testing AI systems, particularly LLM-based applications and traditional ML models. It automatically detects performance, bias, and security issues, offering comprehensive tools for ensuring the reliability and safety of AI. The library includes a powerful RAG Evaluation Toolkit (RAGET) for in-depth assessment of Retrieval Augmented Generation applications.
Source repository
Open the original repository on GitHub.