-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathindex.html
More file actions
430 lines (402 loc) · 16.8 KB
/
index.html
File metadata and controls
430 lines (402 loc) · 16.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>aimock CLI — aimock</title>
<link rel="icon" type="image/svg+xml" href="../favicon.svg" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Instrument+Sans:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="../style.css" />
<script src="/pixels.js" defer></script>
</head>
<body>
<nav class="top-nav">
<div class="nav-inner">
<div style="display: flex; align-items: center; gap: 1rem">
<button
class="sidebar-toggle"
onclick="document.querySelector('.sidebar').classList.toggle('open')"
aria-label="Toggle sidebar"
>
☰
</button>
<a href="/" class="nav-brand"> <span class="prompt">$</span> aimock </a>
</div>
<ul class="nav-links">
<li><a href="/">Home</a></li>
<li><a href="/docs" style="color: var(--accent)">Docs</a></li>
<li>
<a href="https://github.com/CopilotKit/aimock" class="gh-link" target="_blank"
><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"
/>
</svg>
GitHub</a
>
</li>
</ul>
</div>
</nav>
<div class="docs-layout">
<aside class="sidebar" id="sidebar"></aside>
<main class="docs-content">
<h1>aimock CLI</h1>
<p class="lead">
Configure all your mocks in one JSON file and serve them on a single port — LLM
providers, MCP, A2A, AG-UI, vector databases, and services.
</p>
<h2>Quick Start</h2>
<div class="cli-docker-tabs">
<div class="tab-cli">
<div class="code-block">
<div class="code-block-header">Run aimock <span class="lang-tag">shell</span></div>
<pre><code>$ npx @copilotkit/aimock --config aimock.json --port 4010</code></pre>
</div>
</div>
<div class="tab-docker">
<div class="code-block">
<div class="code-block-header">Run aimock <span class="lang-tag">shell</span></div>
<pre><code><span class="cm"># --config is an aimock-CLI feature, not available in the published image.</span>
<span class="cm"># Run aimock on your host via npx (or install @copilotkit/aimock in your</span>
<span class="cm"># own container image) to use the config-driven CLI:</span>
$ npx @copilotkit/aimock --config aimock.json --port 4010 --host 0.0.0.0
<span class="cm"># If you only need flag-driven fixture serving, the published image works:</span>
$ docker run -d -p 4010:4010 \
-v ./fixtures:/fixtures \
ghcr.io/copilotkit/aimock \
-f /fixtures -h 0.0.0.0</code></pre>
</div>
</div>
</div>
<p style="color: var(--text-dim); font-size: 0.9em">
<strong>Note:</strong> The published Docker image (<code>ghcr.io/copilotkit/aimock</code>)
runs the flag-driven <code>llmock</code> CLI (ENTRYPOINT <code>node dist/cli.js</code>),
which does not support <code>--config</code> or the <code>convert</code> subcommand. For
config-driven mode, run aimock on your host via <code>npx</code> or install
<code>@copilotkit/aimock</code> inside your own image.
</p>
<h2>Config File Format</h2>
<p>
The config file is a JSON object describing which services to run and how to configure
them. The <code>llm</code> section configures the core LLMock server. Additional services
are mounted at path prefixes.
</p>
<div class="code-block">
<div class="code-block-header">aimock.json <span class="lang-tag">json</span></div>
<pre><code>{
<span class="prop">"llm"</span>: {
<span class="prop">"fixtures"</span>: <span class="str">"./fixtures"</span>,
<span class="prop">"latency"</span>: <span class="num">0</span>,
<span class="prop">"chunkSize"</span>: <span class="num">20</span>,
<span class="prop">"logLevel"</span>: <span class="str">"info"</span>,
<span class="prop">"validateOnLoad"</span>: <span class="kw">true</span>,
<span class="prop">"metrics"</span>: <span class="kw">true</span>,
<span class="prop">"strict"</span>: <span class="kw">false</span>
},
<span class="prop">"services"</span>: {
<span class="prop">"/mcp"</span>: {
<span class="prop">"type"</span>: <span class="str">"mcp"</span>,
<span class="prop">"tools"</span>: <span class="str">"./mcp-tools.json"</span>
},
<span class="prop">"/a2a"</span>: {
<span class="prop">"type"</span>: <span class="str">"a2a"</span>,
<span class="prop">"agents"</span>: <span class="str">"./a2a-agents.json"</span>
}
}
}</code></pre>
</div>
<h3>Config Fields</h3>
<table class="endpoint-table">
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>llm</code></td>
<td>object</td>
<td>
LLMock configuration. Accepts <code>fixtures</code>, <code>latency</code>,
<code>chunkSize</code>, <code>logLevel</code>, <code>validateOnLoad</code>,
<code>metrics</code>, <code>strict</code>, <code>chaos</code>,
<code>streamingProfile</code>, <code>record</code>.
</td>
</tr>
<tr>
<td><code>services</code></td>
<td>object</td>
<td>
Map of mount paths to service configs. Each key is a URL path prefix (e.g.
<code>/mcp</code>), each value describes the service type and its options.
</td>
</tr>
</tbody>
</table>
<h3>Recording Config (<code>llm.record</code>)</h3>
<p>
When <code>llm.record</code> is present, aimock proxies unmatched requests to real
providers and saves the responses as fixtures. See
<a href="/record-replay">Record & Replay</a> for full details.
</p>
<table class="endpoint-table">
<thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>providers</code></td>
<td>object</td>
<td>—</td>
<td>
Map of provider names to upstream URLs or API keys (e.g.
<code>{ "openai": "sk-..." }</code>)
</td>
</tr>
<tr>
<td><code>fixturePath</code></td>
<td>string</td>
<td><code>./fixtures/recorded</code></td>
<td>Directory where recorded fixtures are saved</td>
</tr>
<tr>
<td><code>proxyOnly</code></td>
<td>boolean</td>
<td><code>false</code></td>
<td>Proxy without saving fixtures to disk or caching in memory</td>
</tr>
<tr>
<td><code>recordFullModelVersion</code></td>
<td>boolean</td>
<td><code>false</code></td>
<td>
Record the exact model string without stripping date/version suffixes. Use when
tests depend on exact model version matching. See
<a href="/record-replay#model-aware-recording">Model-Aware Recording</a>
</td>
</tr>
</tbody>
</table>
<div class="code-block">
<div class="code-block-header">
Recording config example <span class="lang-tag">json</span>
</div>
<pre><code>{
<span class="prop">"llm"</span>: {
<span class="prop">"fixtures"</span>: <span class="str">"./fixtures"</span>,
<span class="prop">"record"</span>: {
<span class="prop">"providers"</span>: {
<span class="prop">"openai"</span>: <span class="str">"https://api.openai.com"</span>,
<span class="prop">"anthropic"</span>: <span class="str">"https://api.anthropic.com"</span>
},
<span class="prop">"fixturePath"</span>: <span class="str">"./fixtures/recorded"</span>,
<span class="prop">"recordFullModelVersion"</span>: <span class="kw">false</span>
}
}
}</code></pre>
</div>
<h2>CLI Flags</h2>
<table class="endpoint-table">
<thead>
<tr>
<th>Option</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--config</code></td>
<td><code>aimock.json</code></td>
<td>Path to JSON config file</td>
</tr>
<tr>
<td><code>--port</code></td>
<td><code>4010</code></td>
<td>Port to listen on (overrides config)</td>
</tr>
<tr>
<td><code>--host</code></td>
<td><code>127.0.0.1</code></td>
<td>Host to bind to (overrides config)</td>
</tr>
<tr>
<td><code>--help</code></td>
<td>—</td>
<td>Show help</td>
</tr>
</tbody>
</table>
<h2>Single-Port Routing</h2>
<p>
All services share one port. Requests are routed by path prefix. LLM endpoints live at the
root, mounted services at their configured prefix:
</p>
<table class="endpoint-table">
<thead>
<tr>
<th>Path</th>
<th>Service</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>/v1/chat/completions</code></td>
<td>LLMock (OpenAI Chat Completions)</td>
</tr>
<tr>
<td><code>/v1/messages</code></td>
<td>LLMock (Anthropic Claude)</td>
</tr>
<tr>
<td><code>/v1/embeddings</code></td>
<td>LLMock (Embeddings)</td>
</tr>
<tr>
<td><code>/mcp/*</code></td>
<td>MCP mock service</td>
</tr>
<tr>
<td><code>/a2a/*</code></td>
<td>A2A mock service</td>
</tr>
<tr>
<td><code>/health</code></td>
<td>Unified health check (all services)</td>
</tr>
<tr>
<td><code>/metrics</code></td>
<td>Prometheus metrics (if enabled)</td>
</tr>
</tbody>
</table>
<p>
Path stripping is automatic — a request to <code>/mcp/tools/list</code> arrives at
the MCP service as <code>/tools/list</code>.
</p>
<h2>Docker Usage</h2>
<div class="cli-docker-tabs">
<div class="tab-cli">
<div class="code-block">
<div class="code-block-header">
Run with config <span class="lang-tag">shell</span>
</div>
<pre><code>$ npx @copilotkit/aimock --config aimock.json --host 0.0.0.0</code></pre>
</div>
</div>
<div class="tab-docker">
<div class="code-block">
<div class="code-block-header">
Run with config (local / npx) <span class="lang-tag">shell</span>
</div>
<pre><code><span class="cm"># --config isn't available in the published Docker image's llmock entrypoint.</span>
<span class="cm"># Run aimock locally with npx to load config.json:</span>
$ npx @copilotkit/aimock --config aimock.json --host 0.0.0.0</code></pre>
</div>
</div>
</div>
<h2>Fixture Converters</h2>
<p>Convert fixtures from other mock tools to aimock format.</p>
<h3>Usage</h3>
<div class="code-block">
<div class="code-block-header">Convert fixtures <span class="lang-tag">shell</span></div>
<pre><code>npx @copilotkit/aimock convert <format> <input> [output]</code></pre>
</div>
<h3>Supported Formats</h3>
<table class="endpoint-table">
<thead>
<tr>
<th>Format</th>
<th>Source</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>vidaimock</code></td>
<td>VidaiMock Tera templates</td>
<td>
Converts <code>.tera</code> / <code>.json</code> / <code>.txt</code> templates to
aimock fixture JSON
</td>
</tr>
<tr>
<td><code>mockllm</code></td>
<td>mock-llm YAML config</td>
<td>
Converts mock-llm YAML configs to aimock fixture JSON. Also extracts MCP tools if
present.
</td>
</tr>
</tbody>
</table>
<h3>Examples</h3>
<div class="code-block">
<div class="code-block-header">
Converter examples <span class="lang-tag">shell</span>
</div>
<pre><code><span class="cm"># Convert a directory of VidaiMock templates</span>
$ npx @copilotkit/aimock convert vidaimock ./templates/ ./fixtures/converted.json
<span class="cm"># Convert a mock-llm YAML config</span>
$ npx @copilotkit/aimock convert mockllm ./config.yaml ./fixtures/converted.json
<span class="cm"># Print to stdout (omit output path)</span>
$ npx @copilotkit/aimock convert vidaimock ./templates/</code></pre>
</div>
<h2>Docker Compose</h2>
<p style="color: var(--text-dim); font-size: 0.9em">
The published image's ENTRYPOINT runs the flag-driven
<code>llmock</code> CLI — it supports <code>-f/--fixtures</code>,
<code>-p/--port</code>, <code>-h/--host</code>, and the chaos / record flags, but not
<code>--config</code>. Use the compose snippet below for flag-driven fixture serving. For
full config-driven mode (LLM + MCP + A2A + AG-UI on one port), either build your own image
with <code>@copilotkit/aimock</code> installed, or run
<code>npx @copilotkit/aimock --config ...</code> on the host.
</p>
<div class="code-block">
<div class="code-block-header">docker-compose.yml <span class="lang-tag">yaml</span></div>
<pre><code><span class="prop">services</span>:
<span class="prop">aimock</span>:
<span class="prop">image</span>: <span class="str">ghcr.io/copilotkit/aimock:latest</span>
<span class="prop">command</span>: <span class="str">["-f", "/app/fixtures", "-h", "0.0.0.0"]</span>
<span class="prop">ports</span>:
- <span class="str">"4010:4010"</span>
<span class="prop">volumes</span>:
- <span class="str">./fixtures:/app/fixtures:ro</span>
<span class="prop">app</span>:
<span class="prop">build</span>: <span class="str">.</span>
<span class="prop">environment</span>:
<span class="prop">OPENAI_BASE_URL</span>: <span class="str">http://aimock:4010/v1</span>
<span class="prop">depends_on</span>:
- <span class="str">aimock</span></code></pre>
</div>
</main>
<aside class="page-toc" id="page-toc"></aside>
</div>
<footer class="docs-footer">
<div class="footer-inner">
<div class="footer-left"><span>$</span> aimock · MIT License</div>
<ul class="footer-links">
<li><a href="https://github.com/CopilotKit/aimock" target="_blank">GitHub</a></li>
<li>
<a href="https://www.npmjs.com/package/@copilotkit/aimock" target="_blank">npm</a>
</li>
</ul>
</div>
</footer>
<script src="../sidebar.js"></script>
<script src="../cli-tabs.js"></script>
</body>
</html>