import Cadenya from '@cadenya/cadenya';
const client = new Cadenya({
apiKey: process.env['CADENYA_API_KEY'], // This is the default and can be omitted
});
const aiProviderKey = await client.aiProviderKeys.update('aipk_01HXKD2E5NQM3T9AYWCFQ41VW3', {
workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q',
});
console.log(aiProviderKey.metadata);import os
from cadenya import Cadenya
client = Cadenya(
api_key=os.environ.get("CADENYA_API_KEY"), # This is the default and can be omitted
)
ai_provider_key = client.ai_provider_keys.update(
id="aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
workspace_id="workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
)
print(ai_provider_key.metadata)package main
import (
"context"
"fmt"
"go.cadenya.com/cadenya-go"
"go.cadenya.com/cadenya-go/option"
)
func main() {
client := cadenya.NewClient(
option.WithAPIKey("My API Key"),
)
aiProviderKey, err := client.AIProviderKeys.Update(
context.TODO(),
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
cadenya.AIProviderKeyUpdateParams{
WorkspaceID: cadenya.String("workspace_01HXKD2E5NQM3T9AYWCF133E3Q"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", aiProviderKey.Metadata)
}
require "cadenya"
cadenya = Cadenya::Client.new(api_key: "My API Key")
ai_provider_key = cadenya.ai_provider_keys.update(
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
workspace_id: "workspace_01HXKD2E5NQM3T9AYWCF133E3Q"
)
puts(ai_provider_key)cadenya ai-provider-keys update \
--api-key 'My API Key' \
--workspace-id workspace_01HXKD2E5NQM3T9AYWCF133E3Q \
--id aipk_01HXKD2E5NQM3T9AYWCFQ41VW3curl --request PATCH \
--url https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"spec": {
"credentials": {
"type": "apiKey",
"apiKey": {
"apiKey": "<string>"
}
},
"config": {
"type": "openrouter",
"openrouter": {
"region": "<string>"
}
}
},
"updateMask": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'spec' => [
'credentials' => [
'type' => 'apiKey',
'apiKey' => [
'apiKey' => '<string>'
]
],
'config' => [
'type' => 'openrouter',
'openrouter' => [
'region' => '<string>'
]
]
],
'updateMask' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"spec\": {\n \"credentials\": {\n \"type\": \"apiKey\",\n \"apiKey\": {\n \"apiKey\": \"<string>\"\n }\n },\n \"config\": {\n \"type\": \"openrouter\",\n \"openrouter\": {\n \"region\": \"<string>\"\n }\n }\n },\n \"updateMask\": \"<string>\"\n}")
.asString();{
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"spec": {
"credentials": {
"type": "apiKey",
"apiKey": {
"apiKey": "<string>"
}
},
"config": {
"type": "openrouter",
"openrouter": {
"region": "<string>"
}
}
},
"info": {
"enabledModelCount": 123,
"disabledModelCount": 123,
"isPromotional": true
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Update an AI provider key
Updates an AI provider key’s name or key value in the workspace
import Cadenya from '@cadenya/cadenya';
const client = new Cadenya({
apiKey: process.env['CADENYA_API_KEY'], // This is the default and can be omitted
});
const aiProviderKey = await client.aiProviderKeys.update('aipk_01HXKD2E5NQM3T9AYWCFQ41VW3', {
workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q',
});
console.log(aiProviderKey.metadata);import os
from cadenya import Cadenya
client = Cadenya(
api_key=os.environ.get("CADENYA_API_KEY"), # This is the default and can be omitted
)
ai_provider_key = client.ai_provider_keys.update(
id="aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
workspace_id="workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
)
print(ai_provider_key.metadata)package main
import (
"context"
"fmt"
"go.cadenya.com/cadenya-go"
"go.cadenya.com/cadenya-go/option"
)
func main() {
client := cadenya.NewClient(
option.WithAPIKey("My API Key"),
)
aiProviderKey, err := client.AIProviderKeys.Update(
context.TODO(),
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
cadenya.AIProviderKeyUpdateParams{
WorkspaceID: cadenya.String("workspace_01HXKD2E5NQM3T9AYWCF133E3Q"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", aiProviderKey.Metadata)
}
require "cadenya"
cadenya = Cadenya::Client.new(api_key: "My API Key")
ai_provider_key = cadenya.ai_provider_keys.update(
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
workspace_id: "workspace_01HXKD2E5NQM3T9AYWCF133E3Q"
)
puts(ai_provider_key)cadenya ai-provider-keys update \
--api-key 'My API Key' \
--workspace-id workspace_01HXKD2E5NQM3T9AYWCF133E3Q \
--id aipk_01HXKD2E5NQM3T9AYWCFQ41VW3curl --request PATCH \
--url https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"spec": {
"credentials": {
"type": "apiKey",
"apiKey": {
"apiKey": "<string>"
}
},
"config": {
"type": "openrouter",
"openrouter": {
"region": "<string>"
}
}
},
"updateMask": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'spec' => [
'credentials' => [
'type' => 'apiKey',
'apiKey' => [
'apiKey' => '<string>'
]
],
'config' => [
'type' => 'openrouter',
'openrouter' => [
'region' => '<string>'
]
]
],
'updateMask' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"spec\": {\n \"credentials\": {\n \"type\": \"apiKey\",\n \"apiKey\": {\n \"apiKey\": \"<string>\"\n }\n },\n \"config\": {\n \"type\": \"openrouter\",\n \"openrouter\": {\n \"region\": \"<string>\"\n }\n }\n },\n \"updateMask\": \"<string>\"\n}")
.asString();{
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"spec": {
"credentials": {
"type": "apiKey",
"apiKey": {
"apiKey": "<string>"
}
},
"config": {
"type": "openrouter",
"openrouter": {
"region": "<string>"
}
}
},
"info": {
"enabledModelCount": 123,
"disabledModelCount": 123,
"isPromotional": true
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The workspace the key belongs to.
"workspace_01HXKD2E5NQM3T9AYWCF133E3Q"
The key to update.
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3"
Body
UpdateResourceMetadata contains the user-provided fields for updating a workspace-scoped resource. Read-only fields (id, account_id, workspace_id, profile_id, created_at) are excluded since they are set by the server.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Fields to update.
Response
OK
AIProviderKey is a credential for an AI provider, scoped to a workspace. Most keys are customer-provided (BYOK); Cadenya also provisions promotional keys (see AIProviderKeyInfo.is_promotional), which cannot be modified or deleted by account administrators. The secret value is never returned in responses.
Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Server-populated info (e.g. how many models route through this key). Populated on reads when requested; see ListAIProviderKeysRequest.include_info.
Show child attributes
Show child attributes