Skip to main content
API Key Management

Create API Key

Create a UAC API key.

Prerequisites

You have obtained the AccessKey of an Alibaba Cloud account or a RAM user, and the identity has been granted the RAM permissions required to call this operation. We recommend that you set the AccessKey as the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET instead of hard-coding it.

Request description

  • HTTP method:POST
  • Request URL

    Region

    Endpoint

    Singapore

    POST https://modelstudio.ap-southeast-1.aliyuncs.com/tokenplan/api-keys

  • Authentication This operation is an Alibaba Cloud OpenAPI operation that uses AccessKey-based signatures (the ACS3-HMAC-SHA256 algorithm). The Authorization: Bearer {API_KEY} scheme is not supported. A request must carry the common headers x-acs-action: CreateTokenPlanKey, x-acs-version: 2026-02-10, x-acs-date, x-acs-content-sha256, x-acs-signature-nonce, and Authorization. We recommend that you call this operation with an Alibaba Cloud SDK or OpenAPI Explorer so that you do not have to calculate the signature yourself.

Request parameters

All parameters are passed in the query string.

Parameter

Type

Required

Description

AccountId

string

Yes

Account ID.

Description

string

No

Key description.

Response parameters

Parameter

Type

Description

Success

boolean

Whether the request was successful.

Code

string

Error code (empty on success).

Message

string

Error message (empty on success).

Data

object

Business data.

ApiKeyId

string

API key ID (system generated).

SourceId

string

Source ID returned by BaiLian.

PlainApiKey

string

Plaintext API key returned by BaiLian (only returned once during creation).

MaskedApiKey

string

Masked API key returned by BaiLian (e.g., sk_***cdef).

Description

string

Key description.

CreatedAt

string

Key creation time.

Request example

This operation uses Alibaba Cloud OpenAPI signatures. In the following example, ${SIGNATURE} must be calculated with the ACS3-HMAC-SHA256 algorithm, and x-acs-date and x-acs-signature-nonce must be replaced with actual values.
curl -X POST "https://modelstudio.ap-southeast-1.aliyuncs.com/tokenplan/api-keys?AccountId=acc_123456789&Description=API%20key%20description" \
    --header "x-acs-action: CreateTokenPlanKey" \
    --header "x-acs-version: 2026-02-10" \
    --header "x-acs-date: 2026-01-01T12:00:00Z" \
    --header "x-acs-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" \
    --header "x-acs-signature-nonce: 3e3b2a9f0c7d4f8e9a1b2c3d4e5f6a7b" \
    --header "Authorization: ACS3-HMAC-SHA256 Credential=${ALIBABA_CLOUD_ACCESS_KEY_ID},SignedHeaders=host;x-acs-action;x-acs-content-sha256;x-acs-date;x-acs-signature-nonce;x-acs-version,Signature=${SIGNATURE}"

Response example

{
  "Success": true,
  "Data": {
    "ApiKeyId": "ak-123456",
    "SourceId": "123",
    "PlainApiKey": "sk-ws.abc123456",
    "MaskedApiKey": "sk_***6",
    "Description": "APIKEY描述",
    "CreatedAt": "2025-07-18T03:19:17Z"
  }
}

Error codes

If the call fails, an error message is returned. For more error codes and solutions, see Error codes.
Text Generation
Image Generation
  • FAQ
Video Generation
World models
Audio
  • Audio generation
Realtime API
Text Embedding
TokenPlan
Model Production