All Products
Search
Document Center

Platform For AI:CreateConnection

Last Updated:Oct 17, 2025

Creates a connection to link PAI cloud services with your models, databases, and other services. This is useful for scenarios such as LangStudio and multimodal dataset retrieval.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

paiworkspace:CreateConnection

create

*All Resource

*

None None

Request syntax

POST /api/v1/connections HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request struct. It contains the parameters required to create the connection.

Accessibility

string

No

The visibility of the connection in the workspace. Valid values:

  • PRIVATE (default): The connection is visible only to you and administrators in the workspace.

  • PUBLIC: The connection is visible to all users in the workspace.

Valid values:

  • PUBLIC :

    PUBLIC

  • PRIVATE :

    PRIVATE

PRIVATE

Configs

object

Yes

The configuration of the connection. This is a key-value object. The keys in this object vary depending on the connection type. For more information, see the supplementary information about request parameters.

string

No

The value of a connection configuration parameter.

6379

ConnectionName

string

Yes

The name of the connection.

llm-connection

ConnectionType

string

No

The type of the connection. Valid values:

  • DashScopeConnection: A connection to a Model Studio service.

  • OpenLLMConnection: A connection to an open source model.

  • MilvusConnection: A connection to Milvus.

  • OpenSearchConnection: A connection to OpenSearch.

  • LindormConnection: A connection to Lindorm.

  • ElasticsearchConnection: A connection to Elasticsearch.

  • HologresConnection: A connection to Hologres.

  • RDSConnection: A connection to RDS.

  • CustomConnection: A custom connection.

Valid values:

  • ElasticsearchConnection :

    ElasticsearchConnection

  • MilvusConnection :

    MilvusConnection

  • OpenSearchConnection :

    OpenSearchConnection

  • HologresConnection :

    HologresConnection

  • DashScopeConnection :

    DashScopeConnection

  • LindormConnection :

    LindormConnection

  • RDSConnection :

    RDSConnection

  • OpenLLMConnection :

    OpenLLMConnection

  • CustomConnection :

    CustomConnection

DashScopeConnection

Description

string

No

The description of the connection.

开源大模型服务连接。

Secrets

object

No

Sensitive connection information that requires encryption, such as database credentials or API keys for a model service.

string

No

The value of an encrypted connection configuration parameter.

Dsjk***hsl01

WorkspaceId

string

No

The ID of the workspace. For more information, see ListWorkspaces.

123**45

ResourceMeta

object

No

Resource information for the connection. This parameter is typically used for database connection types.

InstanceName

string

No

The instance name.

测试实例。

InstanceId

string

No

The instance ID.

ld-uf69****9nqjjes

Extra

string

No

Extra configuration information.

{"vpcId":"vpc-xxxx"}

Models

array<object>

No

A list of models. This parameter applies to model service connection types.

object

No

A model.

Model

string

No

The model identifier.

model_001

DisplayName

string

No

The display name of the model.

语言模型。

ModelType

string

No

The model type. Valid values:

  • LLM: Large language model

  • Embedding: Embedding model

  • ReRank: ReRank model

Valid values:

  • Embedding :

    Embedding

  • LLM :

    LLM

  • ReRank :

    ReRank

LLM

ToolCall

boolean

No

Specifies whether the model supports tool calling. Valid values:

  • true: The model supports tool calling.

  • false: The model does not support tool calling.

true

The Configs and Secrets formats for different ConnectionType values are as follows:

  • DashScopeConnection/OpenLLMConnection

{
    "Secrets": {
        "api_key": "xxx"
    },
    "Configs": {
        "base_url": "cn-hangzhou.aigc.aliyuncs.com/api/v1/services/xxx"
    }
}
  • OpenSearchConnection/LindormConnection/ElasticsearchConnection

{
    "Secrets": {
        "password": "xxx"
    },
    "Configs": {
        "uri": "xxx",
        "username": "xxx"
    }
}
  • MilvusConnection

{
    "Secrets": {
        "password": "xxx"
    },
    "Configs": {
        "uri": "xxx",
        "username": "xxx"
    }
}
  • HologresConnection

{
    "Secrets": {
        "password": "xxx"
    },
    "Configs": {
        "database": "xx",
        "port": "xx",
        "host": "xx",
        "user": "xx"
    }
}
  • RDSConnection

{
    "Secrets": {
        "password": "xxx"
    },
    "Configs": {
        "database": "xxx",
        "port": "xxx",
        "host": "xxx",
        "type": "db_type",
        "username": "xxx"
    }
}
  • CustomConnection

Custom format

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The unique ID of the request.

5A14FA81-DD4E-******-6343FE44B941

ConnectionId

string

The connection ID.

conn-pai9m***mi47

Examples

Success response

JSON format

{
  "RequestId": "5A14FA81-DD4E-******-6343FE44B941",
  "ConnectionId": "conn-pai9m***mi47"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.