🚀 Introducing Agent Gateway — governance, observability, and control for your AI agents.  Register for live webinar ↗
{
"success": true,
"data": {
"slug": "<string>"
}
}{
"success": true,
"data": {
"slug": "<string>"
}
}Documentation Index
Fetch the complete documentation index at: https://docs.portkey.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Default Auth
from portkey_ai import Portkey
client = Portkey(
api_key="<api_key>"
)
virtual_key = client.virtual_keys.create(
name="Azure-Virtual-Default",
provider="azure-openai",
note="Azure Note",
key="<api_key>",
resourceName="<resource_name>",
deploymentConfig=[
{
"apiVersion": "2024-08-01-preview",
"deploymentName": "DeploymentName",
"is_default": True,
},
{
"apiVersion": "2024-08-01-preview",
"deploymentName": "DeploymentNam2e",
"is_default": False,
},
],
)
print(virtual_key)
Azure Entra ID
from portkey_ai import Portkey
client = Portkey(
api_key="<api_key>"
)
virtual_key = client.virtual_keys.create(
name="Azure-Virtual-entra",
provider="azure-openai",
note="azure entra",
resourceName="<resource_name>",
deploymentConfig=[
{
"deploymentName": "<deployment_name>",
"is_default": True,
"apiVersion": "2024-08-01-preview",
}
],
azureAuthMode="entra",
azureEntraClientId="<client_id>",
azureEntraClientSecret="<client_secret>",
azureEntraTenantId="<tenantId>",
)
print(virtual_key)
Azure Managed Identity
from portkey_ai import Portkey
client = Portkey(
api_key="<api_key>",
)
virtual_key = client.virtual_keys.create(
name="Azure-Virtual-entra",
provider="azure-openai",
note="azure entra",
resourceName="<resource_name>",
deploymentConfig=[
{
"deploymentName": "<deployment_name>",
"is_default": True,
"apiVersion": "2024-08-01-preview",
}
],
azureAuthMode="managed",
azureManagedClientId="<client-id>" # optional
)
print(virtual_key)
AWS Assumed Role
from portkey_ai import Portkey
client = Portkey(
api_key="<api_key>",
)
virtual_key = client.virtual_keys.create(
name="bedrock-assumed",
provider="bedrock",
note="bedrock",
awsRegion="<region>",
awsAuthType="assumedRole",
awsRoleArn="arn:aws:iam::<account_id>:role/<role_name>",
awsExternalId="<external_id>",
)
print(virtual_key)
openai, azure-openai, ai21, anthropic, anyscale, azure-openai, bedrock, cohere, deepinfra, fireworks-ai, google, groq, hugging-face, jina, lingyi, mistral-ai, monsterapi, moonshot, nomic, novita-ai, open-ai, openrouter, palm, perplexity-ai, predibase, reka-ai, segmind, stability-ai, together-ai, vertex-ai, workers-ai, zhipu optional, needed when using organisation admin API keys
Show child attributes
Show child attributes
{
"credit_limit": 10,
"periodic_reset": "monthly",
"alert_threshold": 8
}
Show child attributes
Dynamically resolve secrets from secret references at runtime. Valid target_field values are "key" or "model_config.
Show child attributes
Was this page helpful?