Create a provider key

Creates a provider credential for the active account. In an organization, Braintrust and migrated model providers (currently OpenAI, Anthropic, Google, xAI, Mixlayer, Vercel AI Gateway, Tinfoil, Amazon Bedrock, Vertex AI, Vertex AI (Claude), and generic-openai) create organization-owned connections and return connection IDs. For OpenAI, Anthropic, Google, and xAI, isDefault=true selects organization BYOK authority; false stores the connection without changing custody. Mixlayer, Vercel AI Gateway, Tinfoil, Amazon Bedrock, Vertex AI, Vertex AI (Claude), and generic-openai creates are always storage-only; use the organization-policy endpoint to select one explicitly. Personal accounts and providers that have not migrated retain provider-key ownership. Requires BYOK entitlement.

Authentication

AuthorizationBearer
API key or Clerk session token

Request

This endpoint expects an object.
apiKeystringRequired>=1 character
namestringRequired1-100 characters
providerenumRequired
isDefaultbooleanOptionalDefaults to false
settingsmap from strings to anyOptional

Response

Provider key created
providerKeyobject

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
500
Internal Server Error