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
1
Open the console
Open the Bailian console and log in with your Alibaba Cloud account.
2
Get API Key
Obtain
DASHSCOPE_API_KEY from the console, starting with sk-. See Get API Key.3
Get workspace ID
Copy your workspace ID (in the format
llm-xxxxxxxxxxxx) from the Workspace Management page. See Obtain APP ID and Workspace ID. 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