API reference

API reference · Routing

Turn the semantic cache on for one key

PUT/api/router/cacheSigned in session

The semantic cache is off unless a key turns it on, because it costs an embedding call per miss and can answer a neighbouring question. The similarity threshold is clamped to 0.8 or higher.

Request body

application/json, required

Request body fields
FieldTypeWhat it is
keyIdrequiredintegerA live key on this account.
semanticboolean
thresholdnumberCosine similarity, 0.8 to 0.9999. Default 0.97.

Example

{
  "keyId": 0,
  "semantic": false,
  "threshold": 0
}

Answer 200

The settings now in force.

Fields of the 200 answer
FieldTypeWhat it is
keyIdinteger
semanticboolean
thresholdnumber
notestring

Errors

  • 400OpenAI shaped error.
  • 401OpenAI shaped error.
  • 404OpenAI 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