Skip to main content
POST
https://api.keywordsai.co
/
api
/
providers
import requests

url = "https://api.keywordsai.co/api/providers/"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
payload = {
    "provider_id": "my-azure-provider",
    "provider_name": "My Azure Provider",
    "api_key": "your-api-key",
    "extra_kwargs": {
        "base_url": "https://my-azure-endpoint.openai.azure.com"
    }
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
{
  "id": "my-azure-provider",
  "provider_id": "my-azure-provider",
  "provider_name": "My Azure Provider",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}
Create a new custom provider or update an existing one (upsert by provider_id). Custom providers allow you to configure custom LLM API endpoints with your own credentials.
Upsert behavior: If a provider with the same provider_id already exists in your organization, it will be updated with the new values.
Write-only fields: The api_key and extra_kwargs fields are accepted in requests but never returned in responses for security reasons.

Request body

provider_id
string
required
Unique provider identifier within your organization.
"provider_id": "my-azure-provider"
provider_name
string
required
Human-readable provider name.
"provider_name": "My Azure Provider"
api_key
string
API key for the provider (write-only, never returned in responses).
"api_key": "your-api-key-here"
extra_kwargs
object
Additional provider configuration (write-only, never returned in responses).
  • base_url (string): Custom API base URL
  • timeout (integer): Request timeout in seconds
  • temperature (float): Default temperature setting
  • max_tokens (integer): Default max tokens
{
  "extra_kwargs": {
    "base_url": "https://my-azure-endpoint.openai.azure.com",
    "timeout": 60
  }
}

Response

Returns the created or updated provider object (without sensitive fields).
{
  "id": "my-azure-provider",
  "provider_id": "my-azure-provider",
  "provider_name": "My Azure Provider",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}
import requests

url = "https://api.keywordsai.co/api/providers/"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
payload = {
    "provider_id": "my-azure-provider",
    "provider_name": "My Azure Provider",
    "api_key": "your-api-key",
    "extra_kwargs": {
        "base_url": "https://my-azure-endpoint.openai.azure.com"
    }
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())