@@ -70,6 +70,72 @@ <h2>How It Works</h2>
7070 < li > Subsequent identical requests match the newly recorded fixture</ li >
7171 </ ol >
7272
73+ < h2 > Proxy-Only Mode</ h2 >
74+ < p >
75+ Use < code > --proxy-only</ code > instead of < code > --record</ code > when you want unmatched
76+ requests to always reach the real provider — no fixture files are written to disk
77+ and no responses are cached in memory. Matched fixtures still work normally.
78+ </ p >
79+ < p >
80+ This is ideal for < strong > demos and live environments</ strong > where you have canned
81+ fixtures for repeatable demo scenarios you want to show off, but also want regular
82+ interactions to work normally by proxying to the real provider. Without
83+ < code > --proxy-only</ code > , the first real API call would get recorded and cached, and
84+ subsequent identical requests would get the stale recorded response instead of hitting the
85+ live provider.
86+ </ p >
87+
88+ < div class ="cli-docker-tabs ">
89+ < div class ="tab-cli ">
90+ < div class ="code-block ">
91+ < div class ="code-block-header ">
92+ Proxy-only mode < span class ="lang-tag "> shell</ span >
93+ </ div >
94+ < pre > < code > $ npx aimock --fixtures ./fixtures \
95+ --proxy-only \
96+ --provider-openai https://api.openai.com</ code > </ pre >
97+ </ div >
98+ </ div >
99+ < div class ="tab-docker ">
100+ < div class ="code-block ">
101+ < div class ="code-block-header ">
102+ Proxy-only mode < span class ="lang-tag "> shell</ span >
103+ </ div >
104+ < pre > < code > $ docker run -d -p 4010:4010 \
105+ -v ./fixtures:/fixtures \
106+ ghcr.io/copilotkit/aimock \
107+ npx aimock -f /fixtures \
108+ --proxy-only \
109+ --provider-openai https://api.openai.com</ code > </ pre >
110+ </ div >
111+ </ div >
112+ </ div >
113+
114+ < table class ="endpoint-table ">
115+ < thead >
116+ < tr >
117+ < th > Mode</ th >
118+ < th > Unmatched request</ th >
119+ < th > Writes to disk</ th >
120+ < th > Caches in memory</ th >
121+ </ tr >
122+ </ thead >
123+ < tbody >
124+ < tr >
125+ < td > < code > --record</ code > </ td >
126+ < td > Proxy → save → replay next time</ td >
127+ < td > Yes</ td >
128+ < td > Yes</ td >
129+ </ tr >
130+ < tr >
131+ < td > < code > --proxy-only</ code > </ td >
132+ < td > Proxy → relay → proxy again next time</ td >
133+ < td > No</ td >
134+ < td > No</ td >
135+ </ tr >
136+ </ tbody >
137+ </ table >
138+
73139 < h2 > Quick Start</ h2 >
74140
75141 < div class ="cli-docker-tabs ">
@@ -107,7 +173,11 @@ <h2>CLI Flags</h2>
107173 < tbody >
108174 < tr >
109175 < td > < code > --record</ code > </ td >
110- < td > Enable record mode (proxy-on-miss)</ td >
176+ < td > Enable record mode (proxy, save, and cache on miss)</ td >
177+ </ tr >
178+ < tr >
179+ < td > < code > --proxy-only</ code > </ td >
180+ < td > Proxy mode (forward on miss, no saving or caching)</ td >
111181 </ tr >
112182 < tr >
113183 < td > < code > --strict</ code > </ td >
@@ -166,6 +236,7 @@ <h2>Programmatic API</h2>
166236 < span class ="prop "> anthropic</ span > : < span class ="str "> "https://api.anthropic.com"</ span > ,
167237 },
168238 < span class ="prop "> fixturePath</ span > : < span class ="str "> "./fixtures/recorded"</ span > ,
239+ < span class ="prop "> proxyOnly</ span > : < span class ="kw "> true</ span > , < span class ="cmt "> // omit to record fixtures</ span >
169240});
170241
171242< span class ="cmt "> // Make requests — unmatched ones are proxied and recorded</ span >
0 commit comments