aip_sdk.create_secret
aip_sdk.create_secret(name: str, value: str, *, description: str | None = None, workspace_id: str | None = None, client: APIClient | None = None) -> WorkspaceSecret
Store a new secret in a workspace.
The name is what an op declares and reads as an environment variable, so it must start
with an uppercase letter and hold only uppercase letters, digits and underscores. It
must not start with AIP_, or name a variable the op runtime already sets.
Parameters
namestr: Secret name, unique within the workspace.valuestr: The value to store. Encrypted by the platform before storage, and never returned by a listing or lookup.descriptionstr | None: What the secret is for. Readable by everyone who can see the workspace, so keep the value's own details out of it.workspace_idstr | None: Workspace to store it in. Defaults to the session's workspace.clientAPIClient | None: Optional pre-configured API client.
Returns
WorkspaceSecretWorkspaceSecret: the stored secret, without its value.
Raises
DuplicateSecretError: If the workspace already has a secret with this name.ForbiddenError: If you are not an admin of this workspace.UnprocessableEntityError: If the name or value is rejected, or the platform has no encryption key configured.NoWorkspaceSelectedError: If no workspace is passed and none is set for the session.AuthError: If credentials are missing or invalid.APIError: If the request otherwise fails.
Example:
secret = aip.create_secret(
"OPENAI_API_KEY",
os.environ["OPENAI_API_KEY"],
description="Shared evaluation key",
workspace_id="ws-abc123",
)