Create or replace credentials for a provider
curl --request PUT \
--url https://api.example.com/v1/providers/{provider} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"api_key": "sk-ant-...",
"base_url": "https://api.anthropic.com",
"access_key_id": "<string>",
"secret_access_key": "<string>",
"region": "us-east-1",
"service_account_json": "<string>"
}
'import requests
url = "https://api.example.com/v1/providers/{provider}"
payload = {
"api_key": "sk-ant-...",
"base_url": "https://api.anthropic.com",
"access_key_id": "<string>",
"secret_access_key": "<string>",
"region": "us-east-1",
"service_account_json": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
api_key: 'sk-ant-...',
base_url: 'https://api.anthropic.com',
access_key_id: '<string>',
secret_access_key: '<string>',
region: 'us-east-1',
service_account_json: '<string>'
})
};
fetch('https://api.example.com/v1/providers/{provider}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/providers/{provider}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'api_key' => 'sk-ant-...',
'base_url' => 'https://api.anthropic.com',
'access_key_id' => '<string>',
'secret_access_key' => '<string>',
'region' => 'us-east-1',
'service_account_json' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/providers/{provider}"
payload := strings.NewReader("{\n \"api_key\": \"sk-ant-...\",\n \"base_url\": \"https://api.anthropic.com\",\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"us-east-1\",\n \"service_account_json\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/v1/providers/{provider}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"api_key\": \"sk-ant-...\",\n \"base_url\": \"https://api.anthropic.com\",\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"us-east-1\",\n \"service_account_json\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/providers/{provider}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_key\": \"sk-ant-...\",\n \"base_url\": \"https://api.anthropic.com\",\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"us-east-1\",\n \"service_account_json\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"keyHint": "3456",
"updatedAt": "2023-11-07T05:31:56Z"
}Providers
Connect / Rotate Provider Credentials
PUT
/
v1
/
providers
/
{provider}
Create or replace credentials for a provider
curl --request PUT \
--url https://api.example.com/v1/providers/{provider} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"api_key": "sk-ant-...",
"base_url": "https://api.anthropic.com",
"access_key_id": "<string>",
"secret_access_key": "<string>",
"region": "us-east-1",
"service_account_json": "<string>"
}
'import requests
url = "https://api.example.com/v1/providers/{provider}"
payload = {
"api_key": "sk-ant-...",
"base_url": "https://api.anthropic.com",
"access_key_id": "<string>",
"secret_access_key": "<string>",
"region": "us-east-1",
"service_account_json": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
api_key: 'sk-ant-...',
base_url: 'https://api.anthropic.com',
access_key_id: '<string>',
secret_access_key: '<string>',
region: 'us-east-1',
service_account_json: '<string>'
})
};
fetch('https://api.example.com/v1/providers/{provider}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/providers/{provider}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'api_key' => 'sk-ant-...',
'base_url' => 'https://api.anthropic.com',
'access_key_id' => '<string>',
'secret_access_key' => '<string>',
'region' => 'us-east-1',
'service_account_json' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/providers/{provider}"
payload := strings.NewReader("{\n \"api_key\": \"sk-ant-...\",\n \"base_url\": \"https://api.anthropic.com\",\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"us-east-1\",\n \"service_account_json\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/v1/providers/{provider}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"api_key\": \"sk-ant-...\",\n \"base_url\": \"https://api.anthropic.com\",\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"us-east-1\",\n \"service_account_json\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/providers/{provider}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_key\": \"sk-ant-...\",\n \"base_url\": \"https://api.anthropic.com\",\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"us-east-1\",\n \"service_account_json\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"keyHint": "3456",
"updatedAt": "2023-11-07T05:31:56Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Available options:
anthropic, openai, bedrock, vertex Body
application/json
anthropic | openai — the API key
Example:
"sk-ant-..."
anthropic | openai — optional custom base URL
Example:
"https://api.anthropic.com"
bedrock — AWS access key id
bedrock — AWS secret access key
bedrock — AWS region, or vertex — optional GCP region
Example:
"us-east-1"
vertex — GCP service-account JSON, as a string
⌘I