staqlydocs
REST APIAPI referenceMedia

Set the workspace's OpenAI key and image model

Set the workspace's OpenAI key and image model (admin)

Every request sends Authorization: Bearer ...: the access token in local mode, an API key stk_... in cloud mode. Use Send to try it against your cloud instance with your API key.

PUT
/v1/ai

The key is checked with OpenAI (listing the model, which costs nothing), then stored encrypted. Without api_key, only the model changes.

Authorization

headerAuthorizationBearer <token>

API key (stk_...), or in the Community Edition the access token (stk_local_...)

Request Body

application/json
  1. body
provider?"openai"
Value in"openai"
model?string

Defaults to gpt-image-1

Value in"gpt-image-1""gpt-image-1-mini""dall-e-3""dall-e-2"
api_key?string

An OpenAI API key (sk-...)

Response Body

AI status

application/json
  1. response
configured*boolean
provider*"openai"
Value in"openai"
model*string
key_hint*string

The key's last four characters, e.g. ...a1b2

capabilities*
reason*string

Why AI is off or limited, in plain words; empty when everything works

models*array<string>
can_manage*boolean

The caller may set or remove the key (admin)

updated_at?string
Formatdate-time
curl -X PUT 'https://staqly.example.com/v1/ai' \  -H 'Content-Type: application/json' \  -d '{}'
{  "configured": true,  "provider": "openai",  "model": "string",  "key_hint": "string",  "capabilities": {    "generate": true,    "edit": true,    "inpaint": true,    "expand": true  },  "reason": "string",  "models": [    "string"  ],  "can_manage": true,  "updated_at": "2019-08-24T14:15:22Z"}