API reference

API reference · API

Opt the test in to auto savings, or out

POST/v1/shadow/{id}/autoAPI key

Chat scope. {"enabled": true} lets the gateway make the switch itself once a candidate is ready, to the ready candidate with the lowest measured cost ratio, and only one below 1; shadow.auto_switched fires when it does. A test opted in while a candidate is already ready is switched at once. Each Monday the requests a standing switch moved the week before are reported in savings and as shadow.savings_report. Revert takes the opt in back. Audited. A 404 at every path while the operator has not turned shadow testing on.

Parameters

Path and query parameters
FieldTypeWhat it is
id (path)requiredstring

Request body

application/json, required

Request body fields
FieldTypeWhat it is
enabledrequiredboolean

Example

{
  "enabled": false
}

Answer 200

The test, with auto and any switch made.

Fields of the 200 answer
FieldTypeWhat it is
idstringshd_ and 24 hex digits.
object"shadow.test"
namestring
modelstring
scopestringOne of "key", "account".
key_idinteger or null
statusstringOne of "active", "stopped".
stopped_reasonstring or null
held_untilinteger or nullUnix seconds: the month's ceiling is reached, nothing runs before this.
sample_ratenumber
daily_capinteger
sampled_todayinteger
monthly_ceiling_microsinteger
month_spent_microsinteger
month_reserved_microsinteger
spent_microsinteger
compareobject
thresholdnumber
min_samplesinteger
candidatesarray of object
candidates[].modelstring
candidates[].suggestedboolean
switchobject or nullThe switch standing, if any: the candidate and the keys it routes.
switch.tostring
switch.key_idsarray of integer
switch.switched_atinteger
switch.autobooleanMade by the gateway under auto savings.
autoobjectAuto savings: whether the gateway may switch this test itself once a candidate is ready.
auto.enabledboolean
auto.enabled_atinteger or null
auto.switched_atinteger or null
auto.switched_tostring or null
auto.off_reasonstring or nullWhy it is off when it was on: turned off, reverted, or why a switch failed.
savingsarray of objectThe newest weekly reports (Monday to Monday, UTC) of what a standing switch saved: the requests it moved, read from their usage rows, what they were billed, and what they would have cost on the original at the report's measured cost ratio.
savings[].week_startinteger
savings[].fromstring
savings[].tostring
savings[].autoboolean
savings[].requestsinteger
savings[].cost_microsinteger
savings[].baseline_microsinteger
savings[].saved_microsinteger
savings[].rationumber
created_atinteger
updated_atinteger

Errors

  • 400OpenAI shaped error.
  • 401OpenAI shaped error.
  • 404OpenAI shaped error.
  • 409OpenAI shaped error.

Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.

Antimatter