Create Virtual Key

Create a Virtual Key

post
Authorizations
Body
namestringOptional
providerstring · enumOptionalPossible values:
keystringOptional
notestring | nullableOptional
apiVersionstring | nullableOptional
resourceNamestring | nullableOptional
deploymentNamestring | nullableOptional
workspace_idstring · uuidOptional

optional, needed when using organisation admin API keys

expires_atstring · date-timeOptional
Responses
200

Successful response

application/json
post
from portkey_ai import Portkey

# Initialize the Portkey client
portkey = Portkey(
    api_key="PORTKEY_API_KEY",
)

# Add a new virtual key
new_virtual_key = portkey.virtual_keys.create(
    name="openaiVKey",
    provider="openai",
    key="PROVIDER_API_KEY"
)

print(new_virtual_key)
{
  "success": true,
  "data": {
    "slug": "text"
  }
}

Last updated

Was this helpful?