For AI agents, the documentation index lists all pages. Append .md to a documentation URL for Markdown, or request text/markdown.

Skip to Content
spare inference

Routing presets

Create, read, replace, disable and delete routing presets from code.

1 min readEdit this page
GET
/v1/namespaces/me/routing-presets

Every routing preset in your workspace, enabled or not. Needs a key with the routing_preset:read scope.

Authorization

x-api-key<token>

x-api-key: <key>. Anthropic SDKs send this.

In: header

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/namespaces/me/routing-presets"
{  "data": [    {      "disabled_at": "2019-08-24T14:15:22Z",      "id": "string",      "model": "string",      "name": "string",      "params": {},      "routing": {        "ignore": [          "string"        ],        "only": [          "string"        ],        "sort": "string"      },      "system_prompt": "string"    }  ]}
POST
/v1/namespaces/me/routing-presets

A named set of request defaults (model, system prompt, parameters) and provider rules. Call it by sending "model": "@<name>". Needs a key with the routing_preset:write scope.

Authorization

x-api-key<token>

x-api-key: <key>. Anthropic SDKs send this.

In: header

Request Body

application/json

Routing preset request body.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/namespaces/me/routing-presets" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{  "disabled_at": "2019-08-24T14:15:22Z",  "id": "string",  "model": "string",  "name": "string",  "params": {},  "routing": {    "ignore": [      "string"    ],    "only": [      "string"    ],    "sort": "string"  },  "system_prompt": "string"}
GET
/v1/namespaces/me/routing-presets/{id}

One routing preset by id. Needs a key with the routing_preset:read scope.

Authorization

x-api-key<token>

x-api-key: <key>. Anthropic SDKs send this.

In: header

Path Parameters

id*string

Surrogate id of the routing_presets row.

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/namespaces/me/routing-presets/string"
{  "disabled_at": "2019-08-24T14:15:22Z",  "id": "string",  "model": "string",  "name": "string",  "params": {},  "routing": {    "ignore": [      "string"    ],    "only": [      "string"    ],    "sort": "string"  },  "system_prompt": "string"}
PUT
/v1/namespaces/me/routing-presets/{id}

Replaces the whole spec; fields you leave out are cleared. Leave out name to keep it. Needs a key with the routing_preset:write scope.

Authorization

x-api-key<token>

x-api-key: <key>. Anthropic SDKs send this.

In: header

Path Parameters

id*string

Surrogate id of the routing_presets row.

Request Body

application/json

Routing preset replacement.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/v1/namespaces/me/routing-presets/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "disabled_at": "2019-08-24T14:15:22Z",  "id": "string",  "model": "string",  "name": "string",  "params": {},  "routing": {    "ignore": [      "string"    ],    "only": [      "string"    ],    "sort": "string"  },  "system_prompt": "string"}
POST
/v1/namespaces/me/routing-presets/{id}/disable

Stops applying the preset without deleting it. Safe to repeat. Needs a key with the routing_preset:write scope.

Authorization

x-api-key<token>

x-api-key: <key>. Anthropic SDKs send this.

In: header

Path Parameters

id*string

Surrogate id of the routing_presets row.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/namespaces/me/routing-presets/string/disable"
{  "disabled_at": "2019-08-24T14:15:22Z",  "id": "string",  "model": "string",  "name": "string",  "params": {},  "routing": {    "ignore": [      "string"    ],    "only": [      "string"    ],    "sort": "string"  },  "system_prompt": "string"}
POST
/v1/namespaces/me/routing-presets/{id}/enable

Applies the preset again from the next request. Safe to repeat. Needs a key with the routing_preset:write scope.

Authorization

x-api-key<token>

x-api-key: <key>. Anthropic SDKs send this.

In: header

Path Parameters

id*string

Surrogate id of the routing_presets row.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/namespaces/me/routing-presets/string/enable"
{  "disabled_at": "2019-08-24T14:15:22Z",  "id": "string",  "model": "string",  "name": "string",  "params": {},  "routing": {    "ignore": [      "string"    ],    "only": [      "string"    ],    "sort": "string"  },  "system_prompt": "string"}
DELETE
/v1/namespaces/me/routing-presets/{id}

Requests that name it afterwards fail. Needs a key with the routing_preset:write scope.

Authorization

x-api-key<token>

x-api-key: <key>. Anthropic SDKs send this.

In: header

Path Parameters

id*string

Surrogate id of the routing_presets row.

Response Body

application/json

application/json

application/json

application/json

curl -X DELETE "https://example.com/v1/namespaces/me/routing-presets/string"
{  "deleted": true}

How is this guide?