API Key acquisition and usage
Memory API uses API Key authentication. Pass the key via the
Configure as an environment variable:
Each request carries the
Authorization header.
Get credentials
- Open the console: Open the Bailian console and log in with your Alibaba Cloud account.
-
Get API Key: Obtain
DASHSCOPE_API_KEYfrom the console, starting withsk-. See Get API Key. -
Get workspace ID: On the Workspace Management page, copy the value in the API Host column. The
llm-xxxxxxxxxxxxpart is your workspace ID. See Get the workspace-dedicated domain. Replace{WorkspaceId}in the request URL with this ID, and use an API key that belongs to the same workspace.
Usage
Configure as an environment variable:
Authorization header:
Permissions
- Alibaba Cloud primary account: can call all endpoints directly
- RAM sub-accounts: require appropriate permissions
- API Key scope is configured in the console
Security best practices
- Never in repos: use environment variables
- Per-app keys: use separate keys for each app
- Rotate regularly: change keys periodically