Skip to main content
POST
What an A/B test does is explained in A/B tests.
Changes live routing: the AI gateway splits the calls that send the A/B test’s strategy/<slug> between its variants as soon as it is saved.

Parameters

Passed in the request body.
string
The email of the member of your organization recorded as the version’s author. Defaults to the person who created the API key, or to the project’s creator for a key without one. The response’s recorded_for_email says which email was recorded.
object
required
The A/B test. Each target in it is a routing strategy of the project that is not archived, {"type": "strategy", "strategy_slug", "version"} (version null for whichever version is live when the call arrives, a number for that version), or one deployment, {"type": "model", "model", "provider", "region"}, named as a gateway request names it: the AI gateway’s GET /v1/models lists them.
integer
Omit it to create an A/B test. To save the next version, pass the test’s slug in the document and the version you read as live here: the save is refused with a 409 stale_version when another version has gone live since.
The response also carries blockers (what prevents the usual next step), in plain words. It is empty when the usual workflow applies.