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.Show child attributes
- Plain text input
string
Equivalent to a single text message withrole=user. - Message / event array
object array
Each element may be one of the following types:Show child attributes
- Text message
objectShow child attributes
rolestring
Message role. Valid values:user,assistant,system.contentstring or object array
Message content. Either a plain text string, or an array of content blocks for multimodal input.Show child attributes
- Plain text content
string - Content block array
object arrayShow child attributes
- Text block
objectShow child attributes
typestring
Alwaysinput_text.textstring
Text content.
- Image block
objectShow child attributes
typestring
Alwaysinput_image.image_urlstring or object
Image source. Either a string, or an object{ "url": "...", "detail": "high" }. Base64 data URLs (formatdata:image/jpeg;base64,${base64_string}) are recommended; otherwise the external URL must be publicly reachable from the server.
- Video block
objectShow child attributes
typestring
Alwaysinput_video.video_urlstring or object
Video source. Either a string, or an object{ "url": "...", "detail": "low" }. The video URL must be publicly reachable from the server.
- Text block
- Plain text content
- Function call
object(returned by the model in a previous turn; must be passed back verbatim in multi-turn conversations)Show child attributes
typestring
Alwaysfunction_call.idstring
Unique ID for the function call, generated by the server.call_idstring
Correlation ID used to pair with the subsequentfunction_call_output.namestring
Tool name.argumentsstring
Arguments as a JSON string.
- Function call output
object(returned by the client after executing the tool)Show child attributes
typestring
Alwaysfunction_call_output.call_idstring
Thecall_idof the matchingfunction_call.outputstring
Tool execution result (JSON string recommended).
- Text message
- Plain text input
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.Show child attributes
effortstringoptional
Reasoning effort level. Valid values:low/medium/high.
-
toolsobject arrayoptional
List of tool definitions. Currently onlyfunction-type tools are supported.Show child attributes
typestring
Alwaysfunction.namestring
Function name. Letters, digits, and_-are recommended.descriptionstringoptional
Function description — helps the model decide whether to call the tool.parametersobject
JSON Schema describing the function arguments.strictbooleanoptional
Whether to enable strict mode. When enabled, the model’s output arguments will strictly match the schema inparameters.
-
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.Show child attributes
formatobjectShow child attributes
typestring
One oftext,json_object, orjson_schema.namestringoptional
Required whentype=json_schema. The schema’s identifier name.strictbooleanoptional
Available whentype=json_schema. When enabled, the model’s output will strictly match the schema.schemaobjectoptional
Required whentype=json_schema. An object following the JSON Schema specification.
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:Show child attributes
- Reasoning item
objectShow child attributes
typestring
Alwaysreasoning.idstring
Reasoning item ID.statusstring or null
Reasoning item status; may becompletedupon streaming completion.summaryobject array
Reasoning summary list; usually an empty array.contentobject or null
Reasoning content; usuallynull.encrypted_contentstring or null
Encrypted reasoning content; usuallynull.
- Text message
objectShow child attributes
typestring
Alwaysmessage.idstring
Message ID.rolestring
Alwaysassistant.statusstring
Alwayscompleted.contentobject arrayShow child attributes
typestring
Alwaysoutput_text.textstring
Text content generated by the model.annotationsobject array
List of annotations. Empty array when there are no annotations.
- Function call
objectShow child attributes
typestring
Alwaysfunction_call.idstring
Unique function-call ID.call_idstring
Correlation ID. Must be passed back with thefunction_call_output.namestring
Name of the tool being called.argumentsstring
Arguments as a JSON string.statusstring
Alwayscompleted.
- Reasoning item
-
usageobject
Token usage statistics.Show child attributes
input_tokensint
Input token count.input_tokens_detailsobjectShow child attributes
cached_tokensint
Input tokens served from cache.
output_tokensint
Output token count.output_tokens_detailsobjectShow child attributes
reasoning_tokensint
Output tokens used for reasoning.tool_output_tokensint
Output tokens used for tool output.
total_tokensint
Total token count.
-
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.Show child attributes
formatobjectShow child attributes
typestring
One oftext,json_object, orjson_schema.namestring
Present whentype=json_schema. The schema’s identifier name.strictboolean
Present whentype=json_schema.schemaobject
Present whentype=json_schema. An object following the JSON Schema specification.
-
tool_choicestring or object
Echoes the tool-call strategy. -
toolsobject array
Echoes the tool definitions.
Example
{
"id": "resp_xxxxxxxxxxxxxxxx",
"object": "response",
"created_at": 1772624997,
"completed_at": 1772624998,
"model": "step-3.7-flash",
"status": "completed",
"error": null,
"incomplete_details": null,
"output": [
{
"type": "reasoning",
"id": "rs_xxxxxxxxxxxxxxxx",
"summary": [],
"content": null,
"encrypted_content": null,
"status": null
},
{
"type": "message",
"id": "msg_xxxxxxxxxxxxxxxx",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Quantum computing is a new computational paradigm that leverages principles of quantum mechanics (such as superposition and entanglement) to process information.",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 14,
"input_tokens_details": { "cached_tokens": 0 },
"output_tokens": 52,
"output_tokens_details": { "reasoning_tokens": 0, "tool_output_tokens": 0 },
"total_tokens": 66
},
"instructions": null,
"max_output_tokens": null,
"reasoning": { "effort": "medium", "summary": null },
"temperature": 1.0,
"top_p": 1.0,
"text": { "format": { "type": "text" } },
"tool_choice": "auto",
"tools": []
}
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:event: response.created
data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_xxx","object":"response","created_at":1772624997,"model":"step-3.7-flash","status":"in_progress","output":[]}}
event: response.in_progress
data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_xxx","status":"in_progress"}}
event: response.output_item.added
data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_xxx","type":"reasoning","summary":[],"content":null,"encrypted_content":null,"status":"in_progress"}}
event: response.reasoning_part.added
data: {"type":"response.reasoning_part.added","sequence_number":3,"output_index":0,"item_id":"rs_xxx","content_index":0,"part":{"type":"reasoning_text","text":""}}
event: response.reasoning_text.delta
data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"item_id":"rs_xxx","content_index":0,"delta":"User asked for a greeting."}
event: response.reasoning_text.done
data: {"type":"response.reasoning_text.done","sequence_number":5,"output_index":0,"item_id":"rs_xxx","content_index":0,"text":"User asked for a greeting."}
event: response.reasoning_part.done
data: {"type":"response.reasoning_part.done","sequence_number":6,"output_index":0,"item_id":"rs_xxx","content_index":0,"part":{"type":"reasoning_text","text":"User asked for a greeting."}}
event: response.output_item.done
data: {"type":"response.output_item.done","sequence_number":7,"output_index":0,"item":{"id":"rs_xxx","type":"reasoning","summary":[],"content":null,"encrypted_content":null,"status":"completed"}}
event: response.output_item.added
data: {"type":"response.output_item.added","sequence_number":8,"output_index":1,"item":{"id":"msg_xxx","type":"message","role":"assistant","status":"in_progress","content":[]}}
event: response.content_part.added
data: {"type":"response.content_part.added","sequence_number":9,"item_id":"msg_xxx","output_index":1,"content_index":0,"part":{"type":"output_text","text":"","annotations":[]}}
event: response.output_text.delta
data: {"type":"response.output_text.delta","sequence_number":10,"item_id":"msg_xxx","output_index":1,"content_index":0,"delta":"Hello"}
event: response.output_text.done
data: {"type":"response.output_text.done","sequence_number":11,"item_id":"msg_xxx","output_index":1,"content_index":0,"text":"Hello"}
event: response.content_part.done
data: {"type":"response.content_part.done","sequence_number":12,"item_id":"msg_xxx","output_index":1,"content_index":0,"part":{"type":"output_text","text":"Hello","annotations":[]}}
event: response.output_item.done
data: {"type":"response.output_item.done","sequence_number":13,"output_index":1,"item":{"id":"msg_xxx","type":"message","role":"assistant","status":"completed","content":[{"type":"output_text","text":"Hello","annotations":[]}]}}
event: response.completed
data: {"type":"response.completed","sequence_number":14,"response":{"id":"resp_xxx","object":"response","status":"completed","output":[{"id":"rs_xxx","type":"reasoning","summary":[],"content":null,"encrypted_content":null,"status":"completed"},{"id":"msg_xxx","type":"message","role":"assistant","status":"completed","content":[{"type":"output_text","text":"Hello","annotations":[]}]}],"usage":{"input_tokens":10,"output_tokens":2,"total_tokens":12}}}
event: response.output_item.added
data: {"type":"response.output_item.added","sequence_number":0,"output_index":0,"item":{"id":"fc_xxx","type":"function_call","call_id":"call_xxx","name":"get_weather","arguments":"","status":"in_progress"}}
event: response.function_call_arguments.delta
data: {"type":"response.function_call_arguments.delta","sequence_number":1,"item_id":"fc_xxx","output_index":0,"delta":"{\"city\":\"Beijing\"}"}
event: response.function_call_arguments.done
data: {"type":"response.function_call_arguments.done","sequence_number":2,"item_id":"fc_xxx","output_index":0,"arguments":"{\"city\":\"Beijing\"}","name":"get_weather"}
event: response.output_item.done
data: {"type":"response.output_item.done","sequence_number":3,"output_index":0,"item":{"id":"fc_xxx","type":"function_call","call_id":"call_xxx","name":"get_weather","arguments":"{\"city\":\"Beijing\"}","status":"completed"}}
event: response.completed
data: {"type":"response.completed","sequence_number":4,"response":{"id":"resp_xxx","object":"response","status":"completed","output":[{"id":"fc_xxx","type":"function_call","call_id":"call_xxx","name":"get_weather","arguments":"{\"city\":\"Beijing\"}","status":"completed"}]}}
Examples
- Basic text
- Multi-turn + function calling
- Multimodal image
- Multimodal video
- Structured output
- Streaming
- Reasoning effort
- python
- js
- curl
from openai import OpenAI
client = OpenAI(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai/v1")
response = client.responses.create(
model="step-3.7-flash",
input="Briefly introduce quantum computing in one sentence",
)
print(response.output_text)
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "STEP_API_KEY",
baseURL: "https://api.stepfun.ai/v1"
});
const response = await openai.responses.create({
model: "step-3.7-flash",
input: "Briefly introduce quantum computing in one sentence",
});
console.log(response.output_text);
curl https://api.stepfun.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $STEP_API_KEY" \
-d '{
"model": "step-3.7-flash",
"input": "Briefly introduce quantum computing in one sentence"
}'
First turn: the model issues a
function_call based on the tool definition. Second turn: the client passes both the previous function_call and the locally executed function_call_output back, and the model produces the final answer based on the tool result.- python
- js
- curl
from openai import OpenAI
client = OpenAI(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai/v1")
tools = [{
"type": "function",
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string", "description": "City name"}},
"required": ["city"],
},
"strict": True,
}]
# First turn: the model issues a function_call
r1 = client.responses.create(
model="step-3.7-flash",
input=[{"role": "user", "content": "What's the weather in Beijing today?"}],
tools=tools,
tool_choice="auto",
)
fc = next(o for o in r1.output if o.type == "function_call")
# Client executes the tool (mocked here for demonstration)
tool_result = '{"temperature":22,"weather":"sunny","humidity":45}'
# Second turn: pass function_call and function_call_output back
r2 = client.responses.create(
model="step-3.7-flash",
input=[
{"role": "user", "content": "What's the weather in Beijing today?"},
{
"type": "function_call",
"id": fc.id,
"call_id": fc.call_id,
"name": fc.name,
"arguments": fc.arguments,
},
{
"type": "function_call_output",
"call_id": fc.call_id,
"output": tool_result,
},
],
tools=tools,
)
print(r2.output_text)
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "STEP_API_KEY",
baseURL: "https://api.stepfun.ai/v1"
});
const tools = [{
type: "function",
name: "get_weather",
description: "Get the current weather for a city",
parameters: {
type: "object",
properties: { city: { type: "string", description: "City name" } },
required: ["city"]
},
strict: true
}];
// First turn: the model issues a function_call
const r1 = await openai.responses.create({
model: "step-3.7-flash",
input: [{ role: "user", content: "What's the weather in Beijing today?" }],
tools,
tool_choice: "auto"
});
const fc = r1.output.find(o => o.type === "function_call");
// Client executes the tool (mocked here for demonstration)
const toolResult = '{"temperature":22,"weather":"sunny","humidity":45}';
// Second turn: pass function_call and function_call_output back
const r2 = await openai.responses.create({
model: "step-3.7-flash",
input: [
{ role: "user", content: "What's the weather in Beijing today?" },
{
type: "function_call",
id: fc.id,
call_id: fc.call_id,
name: fc.name,
arguments: fc.arguments
},
{
type: "function_call_output",
call_id: fc.call_id,
output: toolResult
}
],
tools
});
console.log(r2.output_text);
# First turn: the model issues a function_call
curl https://api.stepfun.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $STEP_API_KEY" \
-d '{
"model": "step-3.7-flash",
"input": [{ "role": "user", "content": "What'\''s the weather in Beijing today?" }],
"tools": [{
"type": "function",
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string", "description": "City name" } },
"required": ["city"]
},
"strict": true
}],
"tool_choice": "auto"
}'
# Second turn: pass function_call and function_call_output back (use the call_id returned by the previous turn)
curl https://api.stepfun.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $STEP_API_KEY" \
-d '{
"model": "step-3.7-flash",
"input": [
{ "role": "user", "content": "What'\''s the weather in Beijing today?" },
{
"type": "function_call",
"id": "fc_xxxxxxxxxxxxxxxx",
"call_id": "call_xxxxxxxxxxxxxxxx",
"name": "get_weather",
"arguments": "{\"city\":\"Beijing\"}"
},
{
"type": "function_call_output",
"call_id": "call_xxxxxxxxxxxxxxxx",
"output": "{\"temperature\":22,\"weather\":\"sunny\",\"humidity\":45}"
}
],
"tools": [{
"type": "function",
"name": "get_weather",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"]
},
"strict": true
}]
}'
Base64 data URLs are recommended:You can also use the object form to specify
- python
- js
- curl
import base64, requests
from openai import OpenAI
client = OpenAI(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai/v1")
# Load the image into memory — demo only; adapt to reading from disk as needed
r = requests.get("https://www.stepfun.com/assets/section-1-CTe4nZiO.webp")
r.raise_for_status()
image_data_url = "data:image/webp;base64," + base64.b64encode(r.content).decode("ascii")
response = client.responses.create(
model="step-3.7-flash",
input=[{
"role": "user",
"content": [
{"type": "input_text", "text": "Describe the content of this image"},
{"type": "input_image", "image_url": image_data_url},
],
}],
)
print(response.output_text)
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "STEP_API_KEY",
baseURL: "https://api.stepfun.ai/v1"
});
// Load the image into memory — demo only; adapt to reading from disk as needed
async function loadImage(url) {
const res = await fetch(url);
const blob = await res.blob();
const buffer = Buffer.from(await blob.arrayBuffer());
return "data:" + blob.type + ";base64," + buffer.toString("base64");
}
const imageDataUrl = await loadImage("https://www.stepfun.com/assets/section-1-CTe4nZiO.webp");
const response = await openai.responses.create({
model: "step-3.7-flash",
input: [{
role: "user",
content: [
{ type: "input_text", text: "Describe the content of this image" },
{ type: "input_image", image_url: imageDataUrl }
]
}]
});
console.log(response.output_text);
# Load the image into memory — demo only; adapt to reading from disk as needed
image_base64="data:image/webp;base64,"$(curl -s "https://www.stepfun.com/assets/section-1-CTe4nZiO.webp" | base64)
curl https://api.stepfun.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $STEP_API_KEY" \
-d "{
\"model\": \"step-3.7-flash\",
\"input\": [
{
\"role\": \"user\",
\"content\": [
{ \"type\": \"input_text\", \"text\": \"Describe the content of this image\" },
{ \"type\": \"input_image\", \"image_url\": \"${image_base64}\" }
]
}
]
}"
detail:{
"type": "input_image",
"image_url": { "url": "data:image/jpeg;base64,...", "detail": "high" }
}
Video is passed via URL; the URL must be publicly reachable from the server:
- python
- js
- curl
from openai import OpenAI
client = OpenAI(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai/v1")
response = client.responses.create(
model="step-3.7-flash",
input=[{
"role": "user",
"content": [
{"type": "input_text", "text": "Summarize the main content of this video"},
{"type": "input_video", "video_url": {"url": "https://example.com/demo.mp4", "detail": "low"}},
],
}],
)
print(response.output_text)
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "STEP_API_KEY",
baseURL: "https://api.stepfun.ai/v1"
});
const response = await openai.responses.create({
model: "step-3.7-flash",
input: [{
role: "user",
content: [
{ type: "input_text", text: "Summarize the main content of this video" },
{ type: "input_video", video_url: { url: "https://example.com/demo.mp4", detail: "low" } }
]
}]
});
console.log(response.output_text);
curl https://api.stepfun.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $STEP_API_KEY" \
-d '{
"model": "step-3.7-flash",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "Summarize the main content of this video" },
{ "type": "input_video", "video_url": {"url": "https://example.com/demo.mp4", "detail": "low"} }
]
}
]
}'
- python
- js
- curl
from openai import OpenAI
client = OpenAI(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai/v1")
response = client.responses.create(
model="step-3.7-flash",
input="Analyze the sentiment of this sentence: This movie is fantastic, highly recommended!",
text={
"format": {
"type": "json_schema",
"name": "sentiment_analysis",
"strict": True,
"schema": {
"type": "object",
"properties": {
"sentiment": {"type": "string", "enum": ["positive", "negative", "neutral"]},
"confidence": {"type": "number"},
"keywords": {"type": "array", "items": {"type": "string"}},
},
"required": ["sentiment", "confidence", "keywords"],
"additionalProperties": False,
},
}
},
)
print(response.output_text)
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "STEP_API_KEY",
baseURL: "https://api.stepfun.ai/v1"
});
const response = await openai.responses.create({
model: "step-3.7-flash",
input: "Analyze the sentiment of this sentence: This movie is fantastic, highly recommended!",
text: {
format: {
type: "json_schema",
name: "sentiment_analysis",
strict: true,
schema: {
type: "object",
properties: {
sentiment: { type: "string", enum: ["positive", "negative", "neutral"] },
confidence: { type: "number" },
keywords: { type: "array", items: { type: "string" } }
},
required: ["sentiment", "confidence", "keywords"],
additionalProperties: false
}
}
}
});
console.log(response.output_text);
curl https://api.stepfun.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $STEP_API_KEY" \
-d '{
"model": "step-3.7-flash",
"input": "Analyze the sentiment of this sentence: This movie is fantastic, highly recommended!",
"text": {
"format": {
"type": "json_schema",
"name": "sentiment_analysis",
"strict": true,
"schema": {
"type": "object",
"properties": {
"sentiment": { "type": "string", "enum": ["positive", "negative", "neutral"] },
"confidence": { "type": "number" },
"keywords": { "type": "array", "items": { "type": "string" } }
},
"required": ["sentiment", "confidence", "keywords"],
"additionalProperties": false
}
}
}
}'
- python
- js
- curl
from openai import OpenAI
client = OpenAI(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai/v1")
stream = client.responses.create(
model="step-3.7-flash",
input="Write a haiku about spring",
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)
print()
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "STEP_API_KEY",
baseURL: "https://api.stepfun.ai/v1"
});
const stream = await openai.responses.create({
model: "step-3.7-flash",
input: "Write a haiku about spring",
stream: true
});
for await (const event of stream) {
if (event.type === "response.output_text.delta") {
process.stdout.write(event.delta);
}
}
process.stdout.write("\n");
curl https://api.stepfun.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $STEP_API_KEY" \
-d '{
"model": "step-3.7-flash",
"input": "Write a haiku about spring",
"stream": true
}'
- python
- js
- curl
from openai import OpenAI
client = OpenAI(api_key="STEP_API_KEY", base_url="https://api.stepfun.ai/v1")
response = client.responses.create(
model="step-3.7-flash",
input="Prove: the remainder of any perfect square modulo 4 can only be 0 or 1",
reasoning={"effort": "high"},
)
print(response.output_text)
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "STEP_API_KEY",
baseURL: "https://api.stepfun.ai/v1"
});
const response = await openai.responses.create({
model: "step-3.7-flash",
input: "Prove: the remainder of any perfect square modulo 4 can only be 0 or 1",
reasoning: { effort: "high" }
});
console.log(response.output_text);
curl https://api.stepfun.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $STEP_API_KEY" \
-d '{
"model": "step-3.7-flash",
"input": "Prove: the remainder of any perfect square modulo 4 can only be 0 or 1",
"reasoning": { "effort": "high" }
}'