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
| Field | Type | What it is |
|---|---|---|
| keyIdrequired | integer | A live key on this account. |
| semantic | boolean | |
| threshold | number | Cosine similarity, 0.8 to 0.9999. Default 0.97. |
Example
{
"keyId": 0,
"semantic": false,
"threshold": 0
}Answer 200
The settings now in force.
| Field | Type | What it is |
|---|---|---|
| keyId | integer | |
| semantic | boolean | |
| threshold | number | |
| note | string |
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.