Endpoint
POST https://api.stepfun.ai/v1/responses
Request Parameters
-
modelstringrequired
Name of the model to use. Currently onlystep-3.7-flashis supported. -
inputstring or object arrayrequired
Input content. Either a plain text string, or an ordered array of messages / events.
Image and video URLs must be publicly reachable from the server; if the server cannot fetch the URL, a parameter error will be returned. For image input, base64 data URLs are recommended to avoid authentication, hotlink protection, or network access failures on external URLs.
instructionsstringoptional
Top-level system instructions.streambooloptional
Whether to enable SSE streaming. Default isfalse.temperaturefloatoptional
Sampling temperature, between 0.0 and 2.0.top_pfloatoptional
Nucleus sampling parameter.max_output_tokensintoptional
Maximum number of output tokens for this response.
max_output_tokens limits both the reasoning process and the final output. When using medium / high reasoning effort, JSON Schema, video, or other complex inputs, reserve a larger output budget; if the budget is insufficient, the response may return status="incomplete", and output may contain only a reasoning item without a final message.-
reasoningobjectoptional
Reasoning configuration. -
toolsobject arrayoptional
List of tool definitions. Currently onlyfunction-type tools are supported. -
tool_choicestring or objectoptional
Tool-call strategy. Currently only the string"auto"is supported (the model decides whether to call a tool). -
textobjectoptional
Text output format configuration.
Response Format
Non-streaming response
Whenstream=false (default), a single Response object is returned.
Properties
-
idstring
Unique response ID, in the formresp_xxx. -
objectstring
Alwaysresponse. -
created_atint
Creation time as a Unix timestamp (seconds). -
completed_atint or null
Completion time as a Unix timestamp (seconds). -
statusstring
Response status. One ofcompleted,incomplete, orfailed. -
errorobject or null
Error information. Non-null only whenstatus=failed. -
incomplete_detailsobject or null
Incomplete details. Non-null only whenstatus=incomplete; commonly{ "reason": "max_output_tokens" }. -
modelstring
The model ID actually used. -
outputobject array
Array of output items. Each element may be of one of the following types: -
usageobject
Token usage statistics. -
instructionsstring or null
Echoes the top-level instructions from the request. -
max_output_tokensint or null
Echoes the request parameter. -
reasoningobject or null
Echoes the reasoning configuration. -
temperaturefloat or null
Echoes the sampling temperature. -
top_pfloat or null
Echoes the nucleus sampling parameter. -
textobject
Echoes the text output format configuration. -
tool_choicestring or object
Echoes the tool-call strategy. -
toolsobject array
Echoes the tool definitions.
Example
Streaming response
Whenstream=true, Server-Sent Events (SSE) data is returned. Each event consists of an event: line and a data: line.
Each event’s data object contains type and sequence_number. type matches the event name; sequence_number starts from 0 and increments, allowing clients to process events in order.
Event types
| Event | Triggered when |
|---|---|
response.created | Response is created |
response.in_progress | Generation begins |
response.output_item.added | A new output item is created |
response.reasoning_part.added | A reasoning content part begins |
response.reasoning_text.delta | Reasoning text delta |
response.reasoning_text.done | Reasoning text finishes |
response.reasoning_part.done | Reasoning content part finishes |
response.content_part.added | A text content part begins |
response.output_text.delta | Text delta |
response.output_text.done | Text part finishes |
response.content_part.done | Content part finishes |
response.function_call_arguments.delta | Tool argument delta |
response.function_call_arguments.done | Tool arguments finish |
response.output_item.done | Output item finishes |
response.completed | Response completes |
response.incomplete | Ended due to output truncation |
response.failed | Generation failed |
error | Transport-layer error |
Example
Text streaming:Examples
- Basic text
- Multi-turn + function calling
- Multimodal image
- Multimodal video
- Structured output
- Streaming
- Reasoning effort
- python
- js
- curl