Save a provider's key — checked with the provider, then written to the key file (never read back)
const url = 'http://localhost:8300/v1/studio/admin/provider-keys/example';const options = { method: 'PUT', headers: { 'x-api-key': '<x-api-key>', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"key":"example","preset":"example","provider":"example","force":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url http://localhost:8300/v1/studio/admin/provider-keys/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "key": "example", "preset": "example", "provider": "example", "force": false }'. Admin only (403). The body names one source, as Fetch does: preset (studio takes its kind, base_url and compat from the presets file) or provider (a saved provider’s row); never a URL from the browser (a base_url is 422). Studio asks pipelines.providers.key.write (30 s, else 503): pipelines lists GET <base_url>/models with the key in memory (the host rule and the remote switch as for any call, 15 s), and check is ok (written), refused (401 or 403: nothing written), unreachable (anything else: nothing written; detail is our own short reason) or skipped (force: true: written without a call). The key is trimmed, then 1-1024 printable ASCII characters only (0x21-0x7E: no spaces, no …, curly quote, non-breaking or zero-width space), written into the first key folder only (temp file and rename, owner-only) and never returned or logged. 404 malformed name, unknown preset or provider; 422 a bad key (the detail names the rule, never the value; a character outside 0x21-0x7E is always the key has a character keys never have (like … or a curly quote): copy it again from the provider), both or neither source, an unknown field; 409 keys are set in files on this deployment (not writable) or a folder of that name.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”: a key to check and save. Exactly one source: preset or provider (never a URL)
object
The key; trimmed, then 1-1024 printable ASCII characters only (0x21-0x7E, no spaces; anything else is 422 with a fixed text, never the key or the character). Never returned, logged or stored outside the key file
Check with this preset’s URL
Check with this saved provider’s URL
Save anyway: write without a check (check skipped)
: a key to check and save. Exactly one source: preset or provider (never a URL)
object
The key; trimmed, then 1-1024 printable ASCII characters only (0x21-0x7E, no spaces; anything else is 422 with a fixed text, never the key or the character). Never returned, logged or stored outside the key file
Check with this preset’s URL
Check with this saved provider’s URL
Save anyway: write without a check (check skipped)
Responses
Section titled “Responses”The check and the status after it
The check’s verdict and the key file’s status after it (never the key)
object
Written: true for check ok and skipped
Ok: /models answered; refused: 401 or 403; unreachable: anything else (network, timeout, 429, 5xx, another 4xx, the host rule, remote models off); skipped: force
Refused or unreachable: our own short text, never the provider’s
Example
{ "path": "deploy/secrets/providers/deepseek", "check": "ok"}Missing or invalid x-api-key (Kong), or missing/invalid/expired/revoked bearer token
object
Example generated
{ "detail": "example"}Valid token without the admin role: “admin role required”
object
Example generated
{ "detail": "example"}Not found
object
Example generated
{ "detail": "example"}The resource’s state forbids this
object
Example generated
{ "detail": "example"}Invalid input
object
Example generated
{ "detail": "example"}Retryable
object
Example generated
{ "detail": "example"}