API reference

API reference · API

Route the test's model to a candidate on this key

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

Chat scope. Writes the key's policy: requests naming the test's model are served by the candidate, said in x-antimatter-route-warning. Audited. 409 while another switch of the test stands, or when the key's allowlist or blocklist refuses the candidate. Automatic only for a test opted in to auto savings (/v1/shadow/{id}/auto). 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
candidaterequiredstring

Example

{
  "candidate": "string"
}

Answer 200

The test, with its switch.

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