LlmStreamChat

Updated at:

Invokes a large language model in streaming mode by using the Server-Sent Events (SSE) API.

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

yundun-greenweb:LlmStreamChat

get

*All Resource

*

None None

Request syntax

POST /portal/llm/streamChat HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

Messages

any

No

The conversation messages.

[{"content":"Hello","role":"user"}]

Temperature

number

No

The temperature value for the large language model.

0.5

TopP

number

No

The top-p parameter that controls the randomness of the output generated by the large language model.

0.5

Type

string

No

The conversation type.

image

Channel

string

No

The identifier of the call channel.

guardCustomTest

Response elements

Element

Type

Description

Example

object

Schema of Response

Usage

string

The token usage.

null

Choices

array<object>

The list of model generation results.

array<object>

The model generation result.

Delta

object

The incremental content object.

Role

string

The role identifier.

assistant

Content

string

The text content generated in real time.

I am DeepSeek-V3. How can I help you?

Logprobs

string

The token probability information.

null

Index

integer

The stream sequence number.

0

FinishReason

string

For streaming output, this parameter is null during generation. If the generation ends due to a stop token, the value is stop.

stop

Model

string

The model identifier.

deepseek-v3

SystemFingerprint

string

The system fingerprint.

null

Object

string

The response type.

chat.completion.chunk

Id

string

The unique ID of the current session.

chatcmpl-777bce52-93d3-9f8c-89c3-e99884f4f57f

Created

integer

The timestamp when the session was created.

1750990728

RequestId

string

The unique request ID.

21d296d6-594e-97de-812f-925ec6e05673

Error

object

The fault message content in the streaming response.

Code

string

The error code.

data_inspection_failed

Message

string

The error message.

Input data may contain inappropriate content.

Param

string

The parameter that caused the error.

null

Type

string

The error type.

data_inspection_failed

Examples

Success response

JSON format

{
  "Usage": "null",
  "Choices": [
    {
      "Delta": {
        "Role": "assistant",
        "Content": "I am Deepseek-V3. How can I help you?"
      },
      "Logprobs": "null",
      "Index": 0,
      "FinishReason": "stop"
    }
  ],
  "Model": "deepseek-v3",
  "SystemFingerprint": "null",
  "Object": "chat.completion.chunk",
  "Id": "chatcmpl-777bce52-93d3-9f8c-89c3-e99884f4f57f",
  "Created": 1750990728,
  "RequestId": "21d296d6-594e-97de-812f-925ec6e05673",
  "Error": {
    "Code": "data_inspection_failed",
    "Message": "Input data may contain inappropriate content.",
    "Param": "null",
    "Type": "data_inspection_failed"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.