This page lists only the currently confirmed supported fields. Do not pass fields that are not listed here.
Endpoint
POST https://api.stepfun.ai/v1/messages
When using the Anthropic SDK, set
base_url to https://api.stepfun.ai — the SDK will automatically append /v1/messages, you don’t need to include /v1 manually.Request Parameters
modelstringrequired
Model name. Use the public model name your account has access to, e.g.step-3.7-flashorstep-3.5-flash.messagesobject arrayrequired
Conversation history; at least one message.max_tokensintrequired
Maximum number of tokens to generate; must be greater than 0.systemstring or arrayoptional
System prompt. Either a string or an array of text blocks.toolsobject arrayoptional
List of tool definitions.output_configobjectoptional
Structured output configuration.streambooleanoptional
Whether to stream the response; default is non-streaming.temperaturefloatoptional
Sampling temperature, between 0 and 2.top_pfloatoptional
Nucleus sampling parameter, greater than 0 and at most 1.top_kintoptional
top-k parameter, between 0 and 500.stop_sequencesstring arrayoptional
Stop sequences — generation stops when any of these appear in the output.
Response
Non-streaming response
Content-Type: application/json
idstring
Unique message ID.typestring
Object type, alwaysmessage.rolestring
Role name, alwaysassistant.contentobject array
List of content blocks. Typicallytext; in tool-calling scenarios may includetool_use.stop_reasonstring
Why generation stopped. One ofend_turn,tool_use,max_tokens.usageobject
Token usage statistics — at leastinput_tokensandoutput_tokens.
Streaming response
Content-Type: text/event-stream
Streaming uses standard SSE format. Each event has an event: line and a data: line; data: is JSON.
Common event types: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop, ping.
When streaming tool-call arguments, content_block_delta.delta.type may be input_json_delta.
Examples
- Basic chat
- Streaming response
- Using output_config.effort
- python
- js
- curl