Skip to main content

Documentation Index

Fetch the complete documentation index at: https://platform.stepfun.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Prerequisites

Stepfun models support both personal and enterprise use. Create an API key in the console and call with that key. For quick evaluation, you can also try models directly in the Experience Center.

Model selection

Stepfun offers multiple model families. Choose the counterpart that best matches what you use today.

Text models

  • Step 2: trillion-parameter model, strong at reasoning, Chinese tasks, and creative generation.
  • Step 1: hundred-billion-parameter model, strong at reasoning, multi-turn instruction following, and long context.
  • Step 1 Flash: high-speed language model for general tasks with low latency and fast output.

Vision understanding models

  • Step 1V: hundred-billion-parameter vision model with strong multi-turn instruction following and precise recognition.

Image generation

  • Step 1X: text-to-image model for general scenarios with accurate rendering.

API compatibility

Stepfun models are compatible with the OpenAI API spec. You can call them directly via the OpenAI SDK. If your app already uses an OpenAI SDK, migration requires minimal changes. Supported OpenAI-compatible APIs:

SDK migration guide

OpenAI Python SDK

Replace api_key with your Stepfun API key and add base_url="https://api.stepfun.ai/v1". Set the model name to a Stepfun model.
copy
# Before
client = OpenAI(
    api_key="OPENAI_KEY"
)

# After
client = OpenAI(
    api_key="STEP_API_KEY",
    base_url="https://api.stepfun.ai/v1"
)

OpenAI TypeScript SDK

Replace apiKey with your Stepfun API key and add baseURL: "https://api.stepfun.ai/v1". Set the model name to a Stepfun model.
copy
// Before
const openai = new OpenAI({
	apiKey: 'OPENAI_KEY',
})

// After
const openai = new OpenAI({
	apiKey: 'STEP_API_KEY',
	baseURL: 'https://api.stepfun.ai/v1',
})

LangChain

When using LangChain, update openai_api_key, openai_api_base, and model_name in ChatOpenAI to switch to Stepfun.
copy
from langchain.chat_models import ChatOpenAI
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
from os import getenv
from dotenv import load_dotenv

load_dotenv()

template = """You are the Stepfun assistant. Think step by step and answer based on the user's question: {question}"""

prompt = PromptTemplate(template=template, input_variables=["question"])

# Before
# llm = ChatOpenAI(
#   openai_api_key=getenv("OPENAI_KEY"),
#   model_name="gpt-4o"
# )

# After
llm = ChatOpenAI(
  openai_api_key=getenv("STEP_API_KEY"),
  openai_api_base="https://api.stepfun.ai/v1",
  model_name="step-1v-8k"
)

llm_chain = LLMChain(prompt=prompt, llm=llm)

question = "How can Stepfun models help employees be more productive?"

print(llm_chain.run(question))

LangChain.js

For LangChain.js, update modelName, openAIApiKey, and basePath when initializing ChatOpenAI.
// Before
const chat = new ChatOpenAI({
	modelName: 'gpt-4o',
	openAIApiKey: $OPENAI_KEY,
})

// After

const chat = new ChatOpenAI(
	{
		modelName: 'step-1v-8k',
		openAIApiKey: $STEP_API_KEY,
	},
	{
		basePath: 'https://api.stepfun.ai/v1',
	},
)