> ## Documentation Index
> Fetch the complete documentation index at: https://platform.stepfun.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 推理模型接入

Step Plan 支持通过专属路径接入阶跃星辰推理大模型。所有请求统一使用 `/step_plan/v1/...` 路径前缀，域名固定为 `https://api.stepfun.com`。

## 前置条件

1. 已订阅 [Step Plan](https://platform.stepfun.com/step-plan) 套餐
2. 已获取 [API Key](https://platform.stepfun.com/interface-key)

***

## 支持的模型

| 模型 | 说明 |
| - | - |
| `step-5-preview` | 面向真实任务的新一代旗舰基模，支持文本、图片和视频输入，提供 1M tokens 上下文 |
| `step-3.7-flash` | 高速多模态推理模型，原生支持图片和视频理解，支持三档推理强度（low/medium/high），适合智能体、代码与多模态场景 |
| `step-3.5-flash-2603` | 基于 `step-3.5-flash` 针对高频 Agent 场景优化，Token 效率提升、推理速度更快，可切换至低推理模式大幅降低 Token 消耗 |
| `step-3.5-flash` | 196B 总参数 / 11B 激活参数的稀疏 MoE 架构，高速推理，专为智能体和代码任务优化 |
| `step-router-v1` | 智能路由模型，自动在 `step-5-preview` 与 `step-3.7-flash` 之间切换 |

> [!NOTE]
>
> `step-router-v1` 的字段约束（`max_tokens` 上限、不支持的内容类型等）详见 API 文档 [Messages API](https://platform.stepfun.com/docs/zh/api-reference/chat/messages-create.md) 中「step-router-v1 字段限制（仅适用于该模型）」与 [Chat Completion API](https://platform.stepfun.com/docs/zh/api-reference/chat/chat-completion-create.md) 中「Step Plan 通道：DeepSeek 引擎字段差异」。

## 接口路径

| 能力 | 请求方式 | Step Plan 路径 |
| - | - | - |
| Chat Completion（OpenAI 协议） | POST | `https://api.stepfun.com/step_plan/v1/chat/completions` |
| Messages（Anthropic 协议） | POST | `https://api.stepfun.com/step_plan/v1/messages` |

> [!NOTE]
>
> 接口参数详见 [Chat Completion API 文档](https://platform.stepfun.com/docs/zh/api-reference/chat/chat-completion-create.md) 和 [Messages API 文档](https://platform.stepfun.com/docs/zh/api-reference/chat/messages-create.md)。

> [!WARNING]
>
> Anthropic SDK 会自动在 base\_url 后拼接 `/v1/messages`，因此使用 Anthropic SDK 时 base\_url 应设为 `https://api.stepfun.com/step_plan`（不带 `/v1`）。OpenAI SDK 则使用 `https://api.stepfun.com/step_plan/v1`。

## 推理强度

支持三档推理强度的模型可在请求中指定 `low`、`medium`、`high`。Chat Completion（OpenAI 协议）使用 `reasoning_effort`；Messages（Anthropic 协议）使用 `output_config.effort`。

| 推理强度 | 适用场景 |
| - | - |
| `low` | 简单问答、摘要、改写、信息抽取 |
| `medium` | 默认推荐，适合一般推理和多步骤任务 |
| `high` | 复杂推理、数学、规划、代码分析 |

## 计费说明

调用产生的消耗从 Step Plan Credit 中扣减。套餐额度与分时段扣减规则见[套餐与计费](https://platform.stepfun.com/docs/zh/step-plan/pricing.md)。`step-router-v1` 按实际命中模型计费：命中 `step-5-preview` 按 `step-5-preview` 计费，命中 `step-3.7-flash` 按 `step-3.7-flash` 计费。

## 接入方式

### 直接调用 API

> [tab] curl
>
> ```bash theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
> curl -X POST 'https://api.stepfun.com/step_plan/v1/chat/completions' \
> -H 'Content-Type: application/json' \
> -H "Authorization: Bearer $STEP_API_KEY" \
> -d '{
>     "model": "step-5-preview",
>     "messages": [
>         {"role": "user", "content": "你好，请介绍一下你自己"}
>     ]
> }'
> ```

> [tab] Python (OpenAI SDK)
>
> ```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
> from openai import OpenAI
>
> client = OpenAI(
>     api_key="YOUR_STEP_API_KEY",
>     base_url="https://api.stepfun.com/step_plan/v1",
> )
>
> response = client.chat.completions.create(
>     model="step-5-preview",
>     messages=[
>         {"role": "user", "content": "你好，请介绍一下你自己"}
>     ],
> )
>
> print(response.choices[0].message.content)
> ```

> [tab] Python (Anthropic SDK)
>
> ```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
> from anthropic import Anthropic
>
> # 注意：Anthropic SDK 会自动拼接 /v1/messages，base_url 不带 /v1
> client = Anthropic(
>     api_key="YOUR_STEP_API_KEY",
>     base_url="https://api.stepfun.com/step_plan",
> )
>
> message = client.messages.create(
>     model="step-5-preview",
>     max_tokens=1024,
>     messages=[
>         {"role": "user", "content": "你好，请介绍一下你自己"}
>     ],
> )
>
> print(message.content[0].text)
> ```

### 切换到 Step Router V1

调用方式与上述完全一致，将 `model` 字段切换为 `step-router-v1` 即可：

> [tab] Python (OpenAI SDK)
>
> ```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
> from openai import OpenAI
>
> client = OpenAI(
>     api_key="YOUR_STEP_API_KEY",
>     base_url="https://api.stepfun.com/step_plan/v1",
> )
>
> response = client.chat.completions.create(
>     model="step-router-v1",
>     messages=[
>         {"role": "user", "content": "你好，请介绍一下你自己"}
>     ],
> )
>
> print(response.choices[0].message.content)
> ```

> [tab] Python (Anthropic SDK)
>
> ```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
> from anthropic import Anthropic
>
> client = Anthropic(
>     api_key="YOUR_STEP_API_KEY",
>     base_url="https://api.stepfun.com/step_plan",
> )
>
> message = client.messages.create(
>     model="step-router-v1",
>     max_tokens=1024,
>     messages=[
>         {"role": "user", "content": "你好，请介绍一下你自己"}
>     ],
> )
>
> print(message.content[0].text)
> ```

### 通过工具接入

推理模型可通过各类 Agent 工具和编码助手接入，只需将 Base URL 设置为 `https://api.stepfun.com/step_plan/v1`，模型选择 `step-5-preview`、`step-3.7-flash`、`step-3.5-flash-2603`、`step-3.5-flash` 或 `step-router-v1`。

详见 [快速开始](https://platform.stepfun.com/docs/zh/step-plan/quick-start.md) 以及各工具的接入指南：

> [card] [OpenClaw](https://platform.stepfun.com/docs/zh/guides/developer/integrations/openclaw.md)
>
> 指令驱动的 Agent 和初始化型工作流

> [card] [Claude Code](https://platform.stepfun.com/docs/zh/guides/developer/integrations/claude-code.md)
>
> 终端内完成编码、调试和工程协作

> [card] [Hermes Agent](https://platform.stepfun.com/docs/zh/guides/developer/integrations/hermes-agent.md)
>
> 终端或消息平台中运行的开源 AI Agent 框架

> [card] [Open Code](https://platform.stepfun.com/docs/zh/guides/developer/integrations/open-code.md)
>
> 终端内用自然语言驱动开发任务


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.