Call the Messages API to get the model-generated response data. This endpoint is compatible with the Anthropic Messages API format — you can use the Anthropic SDK directly or the same JSON shape.
This page lists only the currently confirmed supported fields. Do not pass fields that are not listed here.
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.
effortstring Controls how much reasoning the model performs. Models supporting three reasoning levels accept low, medium, high; step-3.5-flash-2603 accepts only low and high.
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.
Content-Type: text/event-streamStreaming 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.
from anthropic import Anthropicclient = Anthropic(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai")message = client.messages.create( model="step-3.5-flash", max_tokens=1024, system="You are an AI chat assistant provided by StepFun. You are fluent in English, Chinese, and many other languages. You answer user questions quickly and accurately while protecting user data.", messages=[ { "role": "user", "content": "Introduce yourself in one sentence." } ],)print(message)
import Anthropic from "@anthropic-ai/sdk";const client = new Anthropic({ apiKey: "STEP_API_KEY", baseURL: "https://api.stepfun.ai"});async function main() { const message = await client.messages.create({ model: "step-3.5-flash", max_tokens: 1024, system: "You are an AI chat assistant provided by StepFun. You are fluent in English, Chinese, and many other languages. You answer user questions quickly and accurately while protecting user data.", messages: [ { role: "user", content: "Introduce yourself in one sentence." } ] }); console.log(JSON.stringify(message));}main();
curl https://api.stepfun.ai/v1/messages \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $STEP_API_KEY" \ -d '{ "model": "step-3.5-flash", "max_tokens": 1024, "system": "You are an AI chat assistant provided by StepFun. You are fluent in English, Chinese, and many other languages. You answer user questions quickly and accurately while protecting user data.", "messages": [ { "role": "user", "content": "Introduce yourself in one sentence." } ]}'
{ "id": "msg_01XFDUDYJgAACzvnptvVoYEL", "type": "message", "role": "assistant", "stop_reason": "end_turn", "usage": { "input_tokens": 35, "output_tokens": 20 }, "content": [ { "type": "text", "text": "I'm an AI chat assistant by StepFun, ready to answer your questions in English, Chinese, and other languages quickly and accurately." } ]}
python
js
curl
from anthropic import Anthropicclient = Anthropic(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai")with client.messages.stream( model="step-3.5-flash", max_tokens=1024, messages=[ { "role": "user", "content": "Introduce yourself in one sentence." } ],) as stream: for text in stream.text_stream: print(text, end="", flush=True)print()
import Anthropic from "@anthropic-ai/sdk";const client = new Anthropic({ apiKey: "STEP_API_KEY", baseURL: "https://api.stepfun.ai"});async function main() { const stream = client.messages.stream({ model: "step-3.5-flash", max_tokens: 1024, messages: [ { role: "user", content: "Introduce yourself in one sentence." } ] }); for await (const event of stream) { if ( event.type === "content_block_delta" && event.delta.type === "text_delta" ) { process.stdout.write(event.delta.text); } } console.log();}main();