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
Test
RAM authorization
|
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:
Valid values:
|
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:
Valid values:
|
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:
Valid values:
|
LLM |
| ToolCall |
boolean |
No |
Specifies whether the model supports tool calling. Valid values:
|
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.