Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(stepfun): stop forcing non-streaming when tools are present (#19740)

Coooolfan52f317455b4c
diff --git a/locales/en-US/models.json b/locales/en-US/models.json
index 46786609dea..3de0765405b 100644
--- a/locales/en-US/models.json
+++ b/locales/en-US/models.json
@@ -1304,6 +1304,7 @@
"step-3.5-flash.description": "Stepfun’s flagship language reasoning model.This model has top-notch reasoning capabilities and fast and reliable execution capabilities.Able to decompose and plan complex tasks, call tools quickly and reliably to perform tasks, and be competent in various complex tasks such as logical reasoning, mathematics, software engineering, and in-depth research.",
"step-3.7-flash.description": "The flagship multimodal reasoning model from StepFun. Building on the high-speed reasoning and tool-calling capabilities of step-3.5-flash, it adds native multimodal input support, enabling direct understanding of images and video content without relying on visual MCPs or additional vision models. The model supports three reasoning levels (low / medium / high), making it a fast and reliable choice for agent workflows, coding tasks, and multimodal applications.",
"step-3.description": "This model has strong visual perception and complex reasoning, accurately handling cross-domain knowledge understanding, math-vision cross analysis, and a wide range of everyday visual analysis tasks.",
+ "step-5-preview.description": "StepFun’s new-generation flagship base model for real-world tasks, focused on coding and professional knowledge work. It natively supports text, image, and video input with a 1M-token context window, and is built for tasks that need to process large amounts of information, call tools, and keep pushing through to a delivered result.",
"step-image-edit-2.description": "A lightweight editing model from Stepfun’s latest iteration that supports both text-to-image generation and image editing within a single model. Despite having fewer than 6 billion parameters, it achieves state-of-the-art performance at its scale, rivaling open-source models in the 12B–20B parameter range across tiers. Each editing task takes only 1–2 seconds, redefining the experience of real-time interactive image editing.",
"step-r1-v-mini.description": "A reasoning model with strong image understanding that can process images and text, then generate text after deep reasoning. It excels at visual reasoning and delivers top-tier math, coding, and text reasoning, with a 100K context window.",
"stepfun-ai/Step-3.5-Flash.description": "Step 3.5 Flash is the most powerful open-source foundation model from StepFun, using sparse Mixture of Experts (MoE) architecture with 196B total parameters, only 11B active parameters per token. Model supports 256K context window, achieving 100-300 tok/s generation throughput through 3-way Multi-Token Prediction (MTP-3). Excellent performance on programming and Agent tasks, SWE-bench Verified reaches 74.4%.",
diff --git a/locales/zh-CN/models.json b/locales/zh-CN/models.json
index bd6b0cf97e3..1c4be337d83 100644
--- a/locales/zh-CN/models.json
+++ b/locales/zh-CN/models.json
@@ -1304,6 +1304,7 @@
"step-3.5-flash.description": "Stepfun 的旗舰语言推理模型。该模型具备顶级的推理能力和快速可靠的执行能力。能够分解和规划复杂任务,快速可靠地调用工具执行任务,并胜任逻辑推理、数学、软件工程和深入研究等各种复杂任务。",
"step-3.7-flash.description": "StepFun的旗舰多模态推理模型。基于step-3.5-flash的高速推理和工具调用能力,增加了原生多模态输入支持,能够直接理解图像和视频内容,无需依赖视觉MCP或额外的视觉模型。该模型支持三种推理级别(低/中/高),是代理工作流、编码任务和多模态应用的快速可靠选择。",
"step-3.description": "该模型具备强大的视觉感知与复杂推理能力,能准确处理跨领域知识理解、数学与视觉交叉分析及多种日常视觉分析任务。",
+ "step-5-preview.description": "StepFun 面向真实任务的新一代旗舰基模,重点覆盖编程与专业知识工作。模型原生支持文本、图片和视频输入,拥有 1M tokens 上下文窗口,适合需要处理大量信息、调用工具,并持续推进到交付结果的任务。",
"step-image-edit-2.description": "Stepfun 最新迭代的轻量级编辑模型,支持文本生成图像和图像编辑于一体。尽管参数少于 60 亿,但在其规模内实现了最先进的性能,可与 120 亿至 200 亿参数范围的开源模型相媲美。每个编辑任务仅需 1-2 秒,重新定义了实时交互式图像编辑体验。",
"step-r1-v-mini.description": "具备强图像理解能力的推理模型,可处理图像与文本,并在深度推理后生成文本。擅长视觉推理,在数学、编程与文本推理方面表现出色,支持 100K 上下文窗口。",
"stepfun-ai/Step-3.5-Flash.description": "Step 3.5 Flash 是 StepFun 最强大的开源基础模型,采用稀疏专家混合(MoE)架构,拥有 1960 亿总参数,每个令牌仅激活 110 亿参数。模型支持 256K 上下文窗口,通过三路多令牌预测(MTP-3)实现 100-300 令牌/秒的生成吞吐量。在编程和代理任务中表现卓越,SWE-bench 验证达到 74.4%。",
diff --git a/packages/model-bank/src/aiModels/stepfun.ts b/packages/model-bank/src/aiModels/stepfun.ts
index eec9ee57f13..eee91641588 100644
--- a/packages/model-bank/src/aiModels/stepfun.ts
+++ b/packages/model-bank/src/aiModels/stepfun.ts
@@ -3,6 +3,35 @@ import type { AIChatModelCard, AIImageModelCard } from '../types/aiModel';
// https://platform.stepfun.com/docs/pricing/details
const stepfunChatModels: AIChatModelCard[] = [
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ structuredOutput: true,
+ video: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_000_000,
+ description:
+ 'StepFun’s new-generation flagship base model for real-world tasks, focused on coding and professional knowledge work. It natively supports text, image, and video input with a 1M-token context window, and is built for tasks that need to process large amounts of information, call tools, and keep pushing through to a delivered result.',
+ displayName: 'Step 5 Preview',
+ enabled: true,
+ family: 'step',
+ generation: 'step-5',
+ id: 'step-5-preview',
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput_cacheRead', rate: 0.35, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 7, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 20, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['reasoningEffort'],
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
diff --git a/packages/model-runtime/src/providers/stepfun/index.test.ts b/packages/model-runtime/src/providers/stepfun/index.test.ts
index 7dd3dbc30db..1cef0d0986d 100644
--- a/packages/model-runtime/src/providers/stepfun/index.test.ts
+++ b/packages/model-runtime/src/providers/stepfun/index.test.ts
@@ -125,7 +125,7 @@ describe('LobeStepfunAI - custom features', () => {
expect(calledPayload.tools[0]).toEqual({ function: { name: 'test' }, type: 'function' });
});
- it('should set stream to false when tools are present', async () => {
+ it('should keep stream enabled when tools are present', async () => {
await instance.chat({
messages: [{ content: 'Hello', role: 'user' }],
model: 'step-1-8k',
@@ -133,16 +133,39 @@ describe('LobeStepfunAI - custom features', () => {
});
const calledPayload = (instance['client'].chat.completions.create as any).mock.calls[0][0];
- expect(calledPayload.stream).toBe(false);
+ expect(calledPayload.stream).toBe(true);
});
- it('should set stream to false when web_search is enabled', async () => {
+ it('should keep stream enabled when web_search is enabled', async () => {
await instance.chat({
enabledSearch: true,
messages: [{ content: 'Hello', role: 'user' }],
model: 'step-1-8k',
});
+ const calledPayload = (instance['client'].chat.completions.create as any).mock.calls[0][0];
+ expect(calledPayload.stream).toBe(true);
+ });
+
+ it('should honor caller-provided stream=false when tools are present', async () => {
+ await instance.chat({
+ messages: [{ content: 'Hello', role: 'user' }],
+ model: 'step-1-8k',
+ stream: false,
+ tools: [{ function: { name: 'test' }, type: 'function' }],
+ });
+
+ const calledPayload = (instance['client'].chat.completions.create as any).mock.calls[0][0];
+ expect(calledPayload.stream).toBe(false);
+ });
+
+ it('should honor caller-provided stream=false when no tools are present', async () => {
+ await instance.chat({
+ messages: [{ content: 'Hello', role: 'user' }],
+ model: 'step-1-8k',
+ stream: false,
+ });
+
const calledPayload = (instance['client'].chat.completions.create as any).mock.calls[0][0];
expect(calledPayload.stream).toBe(false);
});
diff --git a/packages/model-runtime/src/providers/stepfun/index.ts b/packages/model-runtime/src/providers/stepfun/index.ts
index 4890a656051..aac918251c8 100644
--- a/packages/model-runtime/src/providers/stepfun/index.ts
+++ b/packages/model-runtime/src/providers/stepfun/index.ts
@@ -13,7 +13,7 @@ export const params = {
baseURL: 'https://api.stepfun.com/v1',
chatCompletion: {
handlePayload: (payload) => {
- const { enabledSearch, tools, ...rest } = payload;
+ const { enabledSearch, stream, tools, ...rest } = payload;
const stepfunTools = enabledSearch
? [
@@ -29,7 +29,7 @@ export const params = {
return {
...rest,
- stream: !stepfunTools,
+ stream: stream ?? true,
tools: stepfunTools,
} as any;
},