MMSP
GitHub123
Model Message Stream Protocol

减轻开发者的心智负担,不再为协议适配交税

快速开始

只需要一份代码

import { AutoLLMClient } from "@prismshadow/mmsp";

const client = new AutoLLMClient({ model: "claude-opus-5-5" });

for await (const event of client.streamingResponseStateful({
  message: {
    role: "user",
    content_items: [{ type: "text.done", text: "What's the weather in Paris?" }],
  },
  config: { tools: [getWeather] },
})) {
  console.log(event);
}

流式事件传输

  1. deltathinking.delta"The user wants"
  2. deltathinking.delta" the weather in Paris."
  3. deltathinking.deltafidelity {"signature":"EuYBCkYIBxgC…"}
  4. deltathinking.done"The user wants the weather in Paris." fidelity {"signature":"EuYBCkYIBxgC…"}
  5. deltatool_call.deltaget_weather toolu_01A3
  6. deltatool_call.delta"{\"location\": "
  7. deltatool_call.delta"\"Paris\"}"
  8. deltatool_call.doneget_weather toolu_01A3 {"location":"Paris"}
  9. stoptool_callusage_metadata {"cached_tokens":0,"prompt_tokens":412,"thoughts_tokens":31,"response_tokens":27}

消息解析结果

  • thinking.done"The user wants the weather in Paris." fidelity {"signature":"EuYBCkYIBxgC…"}
  • tool_call.doneget_weather toolu_01A3 {"location":"Paris"}
finish_reasontool_call
usage_metadata470 tokens
缓存0
提示词412
思考31
回复27