Invoke Large Model Service
POST/v1/ai/:model/:path
When additional path segments are required to call a model, append the path parameter, for example v1/chat/completions. Refer to the documentation for each model for the exact path definitions.
Streaming Output (server-sent events)
When streaming output is enabled, explicitly set Accept: text/event-stream in the request header; otherwise the request will time out after 60 seconds.
Request
Path Parameters
The code of the model to invoke. You can use any model group provided by the following platforms:
hunyuan-exp: Hunyuan trial edition
deepseek: Trial edition
You can also specify any custom model group configured in the console.
The request path defined by the model provider, for example v1/chat/completions
- application/json
Body
required
Refer to the documentation of each model for the parameters required in the request body.
object
Responses
- 200
- 400
- 404
- default
Returned when the model call succeeds (the business result may still indicate an error)
Response Headers
X-Request-Id string
Request ID
- application/json
- text/event-stream
- Schema
- Example (from schema)
Schema
{
"created": 1723618716,
"id": "xxx",
"model": "hunyuan",
"version": "202403121316",
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "I am an AI assistant developed by Tencent. How can I help you today?"
}
}
],
"search_info": {
"mindmap": {}
},
"processes": {},
"usage": {
"prompt_tokens": 11,
"completion_tokens": 14,
"total_tokens": 25
}
}
- Schema
Schema
string
Request failed
Response Headers
X-Request-Id string
Request ID
- application/json
- Schema
- Example (from schema)
- AIModelConfigMissing
- AIModelParamInvalid
- AIModelRequestFailed
Schema
Error code
Error message
Request ID
{
"code": "string",
"message": "string",
"requestId": "string"
}
{
"code": "AI_MODEL_CONFIG_MISSING",
"message": "xxx",
"requestId": "xxx"
}
{
"code": "AI_MODEL_PARAM_INVALID",
"message": "xxx",
"requestId": "xxx"
}
{
"code": "AI_MODEL_REQUEST_FAILED",
"message": "xxx",
"requestId": "xxx"
}
Request failed
Response Headers
X-Request-Id string
Request ID
- application/json
- Schema
- Example (from schema)
- FeatureNotConfigured
- AIModelNotFound
Schema
Error code
Error message
Request ID
{
"code": "string",
"message": "string",
"requestId": "string"
}
{
"code": "ENV_FEATURE_NOT_CONFIGURED",
"message": "xxx",
"requestId": "xxx"
}
{
"code": "AI_MODEL_NOT_FOUND",
"message": "xxx",
"requestId": "xxx"
}
Common error information, see https://docs.cloudbase.net/error-code/service for details
Response Headers
X-Request-Id string
Request ID
- application/json
- Schema
- Example (from schema)
- InvalidHost
Schema
Error code
Error message
Request ID
{
"code": "string",
"message": "string",
"requestId": "string"
}
{
"code": "INVALID_HOST",
"message": "xxx",
"requestId": "xxx"
}