CreateConnection
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 body, which contains the parameters required to create the connection. |
|
| Accessibility |
string |
No |
The visibility of the workspace. The default value is Valid values:
|
PRIVATE |
| Configs |
object |
Yes |
Configuration properties for the connection, provided as key-value pairs. The required keys depend on the connection type. For details, see the supplementary parameter information. |
|
|
string |
No |
The value of a configuration property for the connection. |
6379 |
|
| ConnectionName |
string |
Yes |
The name of the connection. |
llm-connection |
| ConnectionType |
string |
No |
The type of the connection. Valid values:
|
DashScopeConnection |
| Description |
string |
No |
The description of the connection. |
开源大模型服务连接。 |
| Secrets |
object |
No |
Sensitive connection properties that require encryption, such as database credentials or an API key for a model service. |
|
|
string |
No |
The value of an encrypted connection property. |
Dsjk***hsl01 |
|
| WorkspaceId |
string |
No |
The ID of the workspace. To get this ID, call the |
123**45 |
| ResourceMeta |
object |
No |
Resource metadata 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 |
Additional configuration information. |
{"vpcId":"vpc-xxxx"} |
| Models |
array<object> |
No |
A list of models. This parameter applies to model service connections. |
|
|
object |
No |
A model. |
||
| Model |
string |
No |
The model identifier. This value corresponds to the |
model_001 |
| DisplayName |
string |
No |
The display name of the model. |
语言模型。 |
| ModelType |
string |
No |
The model type. Valid values:
|
LLM |
| ToolCall |
boolean |
No |
Specifies whether the model supports tool calling. Valid values:
|
true |
| SupportReasoning |
boolean |
No |
Specifies whether the model supports deep reasoning and can output the reasoning process as Valid values:
|
true |
| SupportResponseSchema |
boolean |
No |
Specifies whether the model supports structured output in the OpenAI API's JSON Schema format. Valid values:
|
true |
| SupportVision |
boolean |
No |
Specifies whether the model supports visual understanding. Valid values:
|
false |
| MaxModelLength |
integer |
No |
The context length. |
4096 |
The Configs and Secrets formats vary for each connection type:
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
Uses a custom format.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response data. |
||
| RequestId |
string |
The request ID. |
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.