Testing with stub responses

To test your product without calling real models, ask the operator to turn on a stub for your product, optionally for one subject (exact, or ending in *). With no stub set up, nothing changes.

The stub replaces the models, not the service. Your key, the limits, the ladder, the status codes and the accounting stay real.

A stub response is always recognizable: stub: true, model and pool start with stub-, tokens are null, and the text starts with [stub] unless the operator supplied a ready answer. If your prompt carries a JSON Schema in the system message, the stub answers with the smallest valid instance.

Modes#

  • always: the models are never asked.
  • fallback: the stub answers only after the real ladder returned 503. The real attempts stay in attempts and the stub's rungs are numbered after them.

In always mode, a marker in the last message that has one picks the scenario. An unknown marker is 400, so a typo cannot turn a test green.

MarkerScenarioYour product sees
[stub:429]The first pool is exhaustedAn answer with rung: 1
[stub:500]Server error, retried with backoffrung: 1, tries: 3
[stub:slow]The model times outrung: 1 after about 4.5 seconds
[stub:retired]A counterfeit 200rung: 1
[stub:rejected]The request shape is refusedrung: 1 without retries
[stub:empty]An empty textcontent: null
[stub:all-fail]Every rung fails503 all_rungs_failed
[stub:budget]The models are not asked429 budget_exhausted, the counter is not touched

With tools, the first turn answers with a call to the first declared tool, with arguments built from its schema. A turn that ends with a tool message answers with text.