Stepfun-Jieyue Xingchen

Updated at:

When you want to integrate Stepfun's multimodal reasoning capabilities into your application, directly connecting to the third-party model API requires additional authentication and adaptation work. Through Model Studio's OpenAI-compatible API, you can call Stepfun models seamlessly using your existing OpenAI SDK with minimal code changes.

When to use Stepfun

The Stepfun Step series is a multimodal reasoning model that combines advanced reasoning capabilities with support for text, image, and video input. With thinking mode enabled, it is particularly effective for complex reasoning scenarios that require step-by-step analysis, such as mathematical problem solving, logical reasoning, and detailed content analysis.

Compared to other third-party models available on Model Studio, Stepfun models excel in:

  • Complex reasoning tasks — With thinking mode enabled, the model works through problems systematically before providing an answer.
  • Multimodal understanding — Support for both image and video input in a single model call.
  • Seamless SDK integration — Full OpenAI API compatibility means you can use existing code with minimal changes.

Prerequisites

Before you begin, make sure that you have:

  • Obtained a Model Studio API key. For instructions, see the Model Studio documentation.
  • Exported the API key as the DASHSCOPE_API_KEY environment variable.
  • (If using an SDK) Installed the OpenAI SDK for your programming language.

Considerations

Before you call Stepfun models through Model Studio, consider the following:

  • Supported region — Only the China (Beijing) region supports Stepfun models. You must use an API key from the China (Beijing) region.
  • Thinking mode — The stepfun/step-3.7-flash and stepfun/step-5-preview models have thinking mode disabled by default. You can enable it by setting enable_thinking to true.
  • Reasoning content — When thinking mode is enabled, the reasoning process is returned in the reasoning_content field.
  • Reasoning depth — You can control reasoning depth through the reasoning_effort parameter. Valid values: low, medium, high. This parameter takes effect only when thinking mode is enabled.
  • Billing — In thinking mode, the chain of thought is billed as output tokens.

Call a text model

The stepfun/step-3.7-flash and stepfun/step-5-preview models are multimodal reasoning models with thinking mode disabled by default. You can enable thinking mode by setting enable_thinking to true. When enabled, the reasoning process is returned in the reasoning_content field, and you can control reasoning depth through the reasoning_effort parameter (valid values: low, medium, high). The following examples demonstrate how to call the model with thinking mode enabled and streaming responses to display the reasoning process and the final answer separately.

Python

Sample code

from openai import OpenAI
import os

# Initialize the OpenAI client
client = OpenAI(
    # If the environment variable is not configured, replace with your Model Studio API Key: api_key="sk-xxx"
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
    base_url="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
)

messages = [{"role": "user", "content": "Which is greater, 9.9 or 9.11?"}]
completion = client.chat.completions.create(
    model="stepfun/step-3.7-flash",
    messages=messages,
    stream=True,
    stream_options={
        "include_usage": True
    },
    extra_body={
        "enable_thinking": True
    }
)

reasoning_content = ""  # Full thinking process
answer_content = ""  # Full response
is_answering = False  # Indicates whether the response phase has started
print("\n" + "=" * 20 + "Thinking process" + "=" * 20 + "\n")

for chunk in completion:
    if not chunk.choices:
        print("\n" + "=" * 20 + "Token usage" + "=" * 20 + "\n")
        print(chunk.usage)
        continue

    delta = chunk.choices[0].delta

    # Collect only the thinking content
    if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
        if not is_answering:
            print(delta.reasoning_content, end="", flush=True)
        reasoning_content += delta.reasoning_content

    # Start replying when content is received
    if hasattr(delta, "content") and delta.content:
        if not is_answering:
            print("\n" + "=" * 20 + "Full response" + "=" * 20 + "\n")
            is_answering = True
        print(delta.content, end="", flush=True)
        answer_content += delta.content

The following output is returned:

====================Thinking process====================

Okay, the user is asking which is greater, 9.9 or 9.11. First I need to compare these two decimals.
9.9 can be written as 9.90, and 9.11 stays as 9.11.
Comparing the decimal parts: 90 > 11, so 9.9 > 9.11.
====================Full response====================

9.9 is greater.

Align the decimal places: 9.9 = 9.90, and 9.11 = 9.11. Comparing the decimal parts, 0.90 > 0.11, therefore **9.9 > 9.11**.
====================Token usage====================

CompletionUsage(completion_tokens=85, prompt_tokens=10, total_tokens=95, prompt_tokens_details={'cached_tokens': 0})

Node.js

Sample code

import OpenAI from 'openai';

// Initialize the OpenAI client
const openai = new OpenAI({
    // If the environment variable is not configured, replace with your Model Studio API Key: apiKey: 'sk-xxx'
    apiKey: process.env.DASHSCOPE_API_KEY,
    // China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
    baseURL: 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1'
});

let reasoningContent = ''; // Full thinking process
let answerContent = ''; // Full response
let isAnswering = false; // Indicates whether the response phase has started

async function main() {
    try {
        const messages = [{ role: 'user', content: 'Which is greater, 9.9 or 9.11?' }];

        const stream = await openai.chat.completions.create({
            model: 'stepfun/step-3.7-flash',
            messages,
            stream: true,
            stream_options: {
                include_usage: true
            },
            enable_thinking: true
        });

        console.log('\n' + '='.repeat(20) + 'Thinking process' + '='.repeat(20) + '\n');

        for await (const chunk of stream) {
            if (!chunk.choices?.length) {
                console.log('\n' + '='.repeat(20) + 'Token usage' + '='.repeat(20) + '\n');
                console.log(chunk.usage);
                continue;
            }

            const delta = chunk.choices[0].delta;

            // Collect only the thinking content
            if (delta.reasoning_content !== undefined && delta.reasoning_content !== null) {
                if (!isAnswering) {
                    process.stdout.write(delta.reasoning_content);
                }
                reasoningContent += delta.reasoning_content;
            }

            // Start replying when content is received
            if (delta.content !== undefined && delta.content) {
                if (!isAnswering) {
                    console.log('\n' + '='.repeat(20) + 'Full response' + '='.repeat(20) + '\n');
                    isAnswering = true;
                }
                process.stdout.write(delta.content);
                answerContent += delta.content;
            }
        }
    } catch (error) {
        console.error('Error:', error);
    }
}

main();

The following output is returned:

====================Thinking process====================

Okay, the user is asking which is greater, 9.9 or 9.11. First I need to compare these two decimals.
9.9 can be written as 9.90, and 9.11 stays as 9.11.
Comparing the decimal parts: 90 > 11, so 9.9 > 9.11.
====================Full response====================

9.9 is greater.

Align the decimal places: 9.9 = 9.90, and 9.11 = 9.11. Comparing the decimal parts, 0.90 > 0.11, therefore **9.9 > 9.11**.
====================Token usage====================

{ prompt_tokens: 10, completion_tokens: 85, total_tokens: 95, prompt_tokens_details: { cached_tokens: 0 } }

HTTP

Sample code

curl

# China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "stepfun/step-3.7-flash",
    "messages": [
        {
            "role": "user",
            "content": "Which is greater, 9.9 or 9.11?"
        }
    ],
    "stream": true,
    "stream_options": {
        "include_usage": true
    },
    "enable_thinking": true
}'

The following output is returned:

====================Thinking process====================

Okay, the user is asking which is greater, 9.9 or 9.11. First I need to compare these two decimals.
9.9 can be written as 9.90, and 9.11 stays as 9.11.
Comparing the decimal parts: 90 > 11, so 9.9 > 9.11.
====================Full response====================

9.9 is greater.

Align the decimal places: 9.9 = 9.90, and 9.11 = 9.11. Comparing the decimal parts, 0.90 > 0.11, therefore **9.9 > 9.11**.
====================Token usage====================

{ prompt_tokens: 10, completion_tokens: 85, total_tokens: 95, prompt_tokens_details: { cached_tokens: 0 } }

Call multimodal models

Both stepfun/step-3.7-flash and stepfun/step-5-preview support image and video input in addition to text. You can provide media through a public URL or Base64 encoding.

Image understanding

The model can recognize and analyze image content. For image file limitations, see File limitations.

Python

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
    base_url="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="stepfun/step-3.7-flash",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What scene is depicted in the image?"},
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg",
                        "detail": "high"
                    }
                }
            ]
        }
    ]
)

# Print the thinking process
if hasattr(completion.choices[0].message, 'reasoning_content') and completion.choices[0].message.reasoning_content:
    print("\n" + "=" * 20 + "Thinking process" + "=" * 20 + "\n")
    print(completion.choices[0].message.reasoning_content)

# Print the response content
print("\n" + "=" * 20 + "Full response" + "=" * 20 + "\n")
print(completion.choices[0].message.content)

Node.js

import OpenAI from 'openai';

const openai = new OpenAI({
    apiKey: process.env.DASHSCOPE_API_KEY,
    // China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
    baseURL: 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1'
});

const completion = await openai.chat.completions.create({
    model: 'stepfun/step-3.7-flash',
    messages: [
        {
            role: 'user',
            content: [
                { type: 'text', text: 'What scene is depicted in the image?' },
                {
                    type: 'image_url',
                    image_url: {
                        url: 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg',
                        detail: 'high'
                    }
                }
            ]
        }
    ]
});

// Print the thinking process
if (completion.choices[0].message.reasoning_content) {
    console.log('\n' + '='.repeat(20) + 'Thinking process' + '='.repeat(20) + '\n');
    console.log(completion.choices[0].message.reasoning_content);
}

// Print the response content
console.log('\n' + '='.repeat(20) + 'Full response' + '='.repeat(20) + '\n');
console.log(completion.choices[0].message.content);

HTTP

curl

# China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "stepfun/step-3.7-flash",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What scene is depicted in the image?"
                },
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg",
                        "detail": "high"
                    }
                }
            ]
        }
    ]
}'

Video understanding

The model can analyze video content. For video file limitations, see File limitations.

Python

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
    base_url="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="stepfun/step-3.7-flash",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241115/cqqkru/1.mp4"
                    }
                },
                {
                    "type": "text",
                    "text": "What is the content of this video?"
                }
            ]
        }
    ]
)

print(completion.choices[0].message.content)

Node.js

import OpenAI from 'openai';

const openai = new OpenAI({
    apiKey: process.env.DASHSCOPE_API_KEY,
    // China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
    baseURL: "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1"
});

async function main() {
    const response = await openai.chat.completions.create({
        model: "stepfun/step-3.7-flash",
        messages: [
            {
                role: "user",
                content: [
                    {
                        type: "video_url",
                        video_url: {
                            url: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241115/cqqkru/1.mp4"
                        }
                    },
                    {
                        type: "text",
                        text: "What is the content of this video?"
                    }
                ]
            }
        ]
    });

    console.log(response.choices[0].message.content);
}

main();

HTTP

curl

# China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
    "model": "stepfun/step-3.7-flash",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241115/cqqkru/1.mp4"
                    }
                },
                {
                    "type": "text",
                    "text": "What is the content of this video?"
                }
            ]
        }
    ]
}'

File limitations

Image files

The following constraints apply to image input for the stepfun/step-3.7-flash model:

  • Supported image formats — JPG/JPEG, PNG, WEBP, and static GIF.
  • Image size — Each image must not exceed 10 MB.
  • Multi-image input — A single request supports up to 50 images. The combined size of all images must not exceed 20 MB.
  • Image resolution — The recommended maximum width or height is 4096 pixels. Higher resolutions increase inference costs (network transfer time, time to first token, and charges).
  • Image transmission — Supports HTTP or HTTPS public URLs and Base64 encoding.

Video files

The following constraints apply to video input for the stepfun/step-3.7-flash model:

  • Video size — Maximum 128 MB.
  • Video duration — No hard time limit. The recommended maximum is 5 minutes.
  • Audio understanding — The model does not support audio understanding for video files.

Feature support

The following table lists the features supported by the stepfun/step-3.7-flash model through Model Studio:

Feature

Support

Notes

Multi-turn conversation

Supported

In thinking mode, the reasoning_content field must be retained in each assistant message. Otherwise, an error occurs.

Function calling

Supported

Does not support the tool_choice parameter.

Context cache

Supported

Implicit cache (cache token). Automatically enabled.

Structured output

Supported

The response_format parameter does not support json_schema.

Streaming

Not supported

Batch

Not supported

Multimodal input

Supported

Supports image (URL or Base64) and video (URL) input.

Unsupported parameters

The stepfun/step-3.7-flash model does not support the following parameters:

tool_choice, thinking_budget, top_k, modalities, repetition_penalty, vl_high_resolution_images, preserve_thinking, enable_search, search_options, seed, logprobs, top_logprobs, n

Parameter differences

Some parameters that are supported have different value ranges or behavior compared to standard Model Studio:

Parameter

Model Studio

Step

temperature

Range: [0, 2)

Range: [0, 2). Default value: 1.0.

top_p

Range: (0, 1.0]

Range: (0, 1.0]. Default value: 0.95.

max_tokens

Does not limit chain-of-thought length. Limits only the output length.

Limits the combined length of the thinking process and final output.

reasoning_effort

Controls reasoning depth for DeepSeek-V4 series models. Valid values: high, max.

Valid values: low, medium, high. Controls reasoning depth. Takes effect only when thinking mode is enabled.

stream_options

The include_usage attribute defaults to false and can be set to true.

The include_usage attribute is forced to true and cannot be disabled.

detail

Not supported.

Valid values: low, high. Default value: low.

frequency_penalty

Not supported.

Range: 0.0 to 1.0. Default value: 0.

Models and billing

The Step series models are multimodal reasoning models provided by Stepfun. They support text, image, and video input, and support enabling thinking mode through enable_thinking.

Billing is based on input and output tokens. In thinking mode, the chain of thought is billed as output tokens.

For model context length and pricing information, see the Model Studio console.

Error codes

Stepfun models are provided directly by Stepfun. Their error codes differ from the standard Model Studio error codes. Refer to the following table when calling Stepfun models:

Error code

Cause

Solution

400 — Format error

The request parameter format is incorrect. This may include: the image cannot be downloaded, the image count exceeds the limit, the input type is not supported by the model, or the parameter value is invalid.

Check the request body, model capabilities, and parameter ranges.

401 — Authentication failed

The API key is missing or invalid.

Verify the API key and request header format.

402 — Insufficient balance

The account balance is insufficient.

Check your account balance and top up in time.

429 — Rate limit exceeded

Requests are too frequent and exceed the rate limit.

Implement exponential backoff and retry logic, or reduce the request frequency.

451 — Content blocked

The request or response content failed the content review.

Modify the request content to avoid unsafe or sensitive input.

500 — Server error

An internal server error occurred.

Retry later. If the issue persists, contact support.

503 — Service unavailable

The server is overloaded.

Retry later.