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.retrieve('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.retrieve(
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.Get(
context.TODO(),
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
cadenya.AIProviderKeyGetParams{
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.retrieve(
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
workspace_id: "workspace_01HXKD2E5NQM3T9AYWCF133E3Q"
)
puts(ai_provider_key)cadenya ai-provider-keys retrieve \
--api-key 'My API Key' \
--workspace-id workspace_01HXKD2E5NQM3T9AYWCF133E3Q \
--id aipk_01HXKD2E5NQM3T9AYWCFQ41VW3curl --request GET \
--url https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id} \
--header 'Authorization: Bearer <token>'<?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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id}")
.header("Authorization", "Bearer <token>")
.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>"
}
]
}Get an AI provider key by ID
Retrieves an AI provider key by ID from 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.retrieve('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.retrieve(
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.Get(
context.TODO(),
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
cadenya.AIProviderKeyGetParams{
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.retrieve(
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3",
workspace_id: "workspace_01HXKD2E5NQM3T9AYWCF133E3Q"
)
puts(ai_provider_key)cadenya ai-provider-keys retrieve \
--api-key 'My API Key' \
--workspace-id workspace_01HXKD2E5NQM3T9AYWCF133E3Q \
--id aipk_01HXKD2E5NQM3T9AYWCFQ41VW3curl --request GET \
--url https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id} \
--header 'Authorization: Bearer <token>'<?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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cadenya.com/v1/workspaces/{workspaceId}/ai_provider_keys/{id}")
.header("Authorization", "Bearer <token>")
.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 retrieve.
"aipk_01HXKD2E5NQM3T9AYWCFQ41VW3"
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