Skip to main content
POST
/
llm-application
/
open
/
v3
/
application
/
invoke
推理接口
curl --request POST \
  --url https://open.bigmodel.cn/api/llm-application/open/v3/application/invoke \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "app_id": "<string>",
  "conversation_id": "<string>",
  "third_request_id": "<string>",
  "stream": true,
  "messages": [
    {
      "role": "<string>",
      "content": [
        {
          "type": "<string>",
          "value": "<string>",
          "key": "<string>"
        }
      ]
    }
  ],
  "role": "<string>",
  "send_log_event": true
}'
{
  "request_id": "<string>",
  "conversation_id": "<string>",
  "app_id": "<string>",
  "choices": [
    {
      "index": 123,
      "finish_reason": "<string>",
      "error_msg": {
        "code": 123,
        "msg": "<string>"
      },
      "delta": {
        "content": {
          "msg": "<string>",
          "type": "<string>",
          "code": "<string>",
          "file": "<string>",
          "url": "<string>",
          "coverUrl": "<string>"
        },
        "event": {
          "node_id": "<string>",
          "node_name": "<string>",
          "type": "<string>",
          "content": "<string>",
          "time": 123,
          "tool_calls": {
            "type": "<string>",
            "tool_calls_data": {}
          }
        },
        "tool_calls": {
          "type": "<string>",
          "tool_calls_data": {}
        }
      },
      "messages": {
        "content": {
          "msg": "<string>",
          "type": "<string>",
          "code": "<string>",
          "file": "<string>",
          "url": "<string>",
          "coverUrl": "<string>"
        },
        "event": [
          {
            "node_id": "<string>",
            "node_name": "<string>",
            "type": "<string>",
            "content": "<string>",
            "time": 123,
            "tool_calls": {
              "type": "<string>",
              "tool_calls_data": {}
            }
          }
        ]
      }
    }
  ],
  "usage": [
    {
      "model": "<string>",
      "nodeName": "<string>",
      "inputTokenCount": 123,
      "outputTokenCount": 123,
      "totalTokenCount": 123
    }
  ]
}

Authorizations

Authorization
string
header
required

使用以下格式进行身份验证:Bearer <your api key>

Body

application/json
app_id
string
required

应用id

messages
object[]
required

用户输入列表

conversation_id
string

会话id, 未传则默认创建新会话

third_request_id
string

三方请求id(调用插件时传入, 用于链路排查问题)

stream
boolean

默认true,false时为同步调用

role
string

对话类应用请求必传:user(用户输入), assistant(模型返回)

send_log_event
boolean

是否实时推送过程日志,默认false

Response

请求成功

request_id
string

请求id

conversation_id
string

会话id

app_id
string

应用id

choices
object[]

增量返回的信息

usage
object[]

本次调用的 tokens 数量统计

I