ModelKeys
Save the workspace's own model key for a provider
Saves or replaces the workspace’s key for provider. The key is
checked with the provider first (422 model_key_invalid if it
rejects it, 503 model_key_check_unavailable if it cannot be
reached) and is then stored encrypted; it is never returned.
Needs a paid plan: Free answers 403 model_key_plan_required.
Runs in the workspace then bill the model’s tokens to this key.
Retries: safe without an Idempotency-Key: saving the same key again leaves the same state.
PUT
/
v1
/
workspaces
/
{workspaceId}
/
model-keys
/
{provider}
Save the workspace's own model key for a provider
curl --request PUT \
--url https://api.lusor.ai/v1/workspaces/{workspaceId}/model-keys/{provider} \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"key": "<string>"
}
'const options = {
method: 'PUT',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({key: '<string>'})
};
fetch('https://api.lusor.ai/v1/workspaces/{workspaceId}/model-keys/{provider}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.lusor.ai/v1/workspaces/{workspaceId}/model-keys/{provider}"
payload = { "key": "<string>" }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"data": {
"provider": "openai",
"key_suffix": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
ApiKeyBearerAuth
Path Parameters
Body
application/json
Was this page helpful?
⌘I
Save the workspace's own model key for a provider
curl --request PUT \
--url https://api.lusor.ai/v1/workspaces/{workspaceId}/model-keys/{provider} \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"key": "<string>"
}
'const options = {
method: 'PUT',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({key: '<string>'})
};
fetch('https://api.lusor.ai/v1/workspaces/{workspaceId}/model-keys/{provider}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.lusor.ai/v1/workspaces/{workspaceId}/model-keys/{provider}"
payload = { "key": "<string>" }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"data": {
"provider": "openai",
"key_suffix": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}
