Prerequisites
- Node.js, npm,
curl, and Python 3 installed. The shell commands below use Bash or zsh; on Windows, run them in WSL. - An active Step Plan subscription with available quota and access to the selected model.
- An API key from the StepFun platform API keys page.
Connection requirements
- Codex CLI 0.154.0 supports the Responses API with
wire_api = "responses". Step Plan exposes/step_plan/v1/responses, so no protocol-conversion proxy is needed. Chat Completions is not supported by this Codex version. - User configuration belongs in
$CODEX_HOME/config.toml.CODEX_HOMEdefaults to~/.codex. Supply the API key through an environment variable or.envin that directory, not inconfig.toml. - Codex’s built-in catalog primarily supplies metadata for OpenAI models. The
model_catalog_jsonconfiguration below defines Step model names, context windows, and input capabilities so the models appear in/model. A dedicated Step profile limits the catalog override to Step sessions.
Install Codex CLI
Install Codex CLI 0.154.0:codex-cli 0.154.0.
Configure Step Plan
Set the configuration directory
Preserve an existingCODEX_HOME value, or use the default directory if it is unset:
CODEX_HOME again before starting Codex.
Add the provider
Merge this configuration into$CODEX_HOME/config.toml, preserving existing settings. If [model_providers.stepfun] already exists, update that table instead of adding a duplicate.
Define the provider in user-level configuration. Codex ignores
model_provider and model_providers in a project’s .codex/config.toml. The built-in identifiers openai, ollama, and lmstudio are reserved.
Set the API key
ReplaceYOUR_STEP_API_KEY with your key and use either method below.
Set an environment variable in the terminal that starts Codex:
$CODEX_HOME/.env, which Codex loads at startup:
.env stores the API key in plain text. Do not commit or share the file.
Create the model catalog
- Download the default agent instructions for Codex CLI 0.154.0. The catalog uses this content as
base_instructions:
- Confirm that the file is not empty:
- Generate
$CODEX_HOME/step-catalog.json:
step-5-preview, step-3.7-flash, and step-3.5-flash. Add or remove entry(...) items to match your account’s access. Catalog fields depend on the Codex version; check compatibility when upgrading.
Create a Step profile
Create$CODEX_HOME/step.config.toml. Use this command for a new file; if the file already exists, merge the settings instead of overwriting it.
model_catalog_json contains an absolute path:
--profile step layers step.config.toml over the base config.toml and uses the provider defined there. Because model_catalog_json replaces the startup model catalog, keep it in the dedicated profile. Starting Codex without --profile step leaves this profile unloaded.
Start Codex CLI
- Confirm that the required files exist:
- Start Codex from your project directory:
- Confirm that the model is
step-5-previewand the provider isstepfun. Open/modelto check that the Step models from the catalog are available.
YOUR_SESSION_ID with the session ID:
/model switches models within the current provider. To use another provider, start a separate session with its profile.
Connect StepSearch MCP
StepSearch providesweb_search and web_fetch for web searches and page retrieval. Add it through the Step Plan endpoint when you need these tools.
- Confirm that
STEP_API_KEYis configured, then register the server:
- Check the registered server:
- Restart
codex --profile step. Use/mcpto check the connection and tools, then run a search or page-retrieval task and inspect the tool call and returned result.
codex mcp add uses the current CODEX_HOME; the resulting configuration is not limited to the step profile. Use a dedicated configuration directory to keep MCP settings separate. The Step profile disables built-in web search with web_search = "disabled" and uses StepSearch MCP for search tools.
Verify the integration
Test a conversation
EnterReply only with OK. in an interactive session. Expected output: OK. For a read-only check from your project directory, run:
Test tool calls
Create a separate test directory with aREADME.md containing Codex Step Plan test. Start Codex there and enter:
hello.py exists, prints Hello, world!, and that README.md is unchanged.
Common questions
Q: Why does Codex ask me to sign in with ChatGPT?
Q: Why does Codex ask me to sign in with ChatGPT?
Check
CODEX_HOME, the model_provider = "stepfun" setting in step.config.toml, and the --profile step startup argument. Confirm that the provider is defined in the user-level config.toml and that the API key is available through the environment or .env. Set CODEX_HOME again before starting Codex if you use a dedicated directory.Q: Why are Step models missing from /model, or why does Model metadata not found appear?
Q: Why are Step models missing from /model, or why does Model metadata not found appear?
Check that the selected profile’s
model_catalog_json points to a valid absolute path and that the catalog contains the correct model IDs. Restart after changes. If the old list remains, exit Codex, remove models_cache.json from the active CODEX_HOME, and try again.Q: How do I resolve a missing field error in the model catalog?
Q: How do I resolve a missing field error in the model catalog?
Regenerate
step-catalog.json using the structure required by your Codex version. Confirm that default.md downloaded successfully and is not empty. A reduced catalog from another version may omit required fields.Q: What should I check after a connection failure, repeated reconnects, or a 401 response?
Q: What should I check after a connection failure, repeated reconnects, or a 401 response?
Inspect the full error, network connection, API key status, and model permissions. Use
https://api.stepfun.ai/step_plan/v1 for base_url and responses for wire_api. Confirm that env_key matches the environment variable and that the key belongs to the account for this endpoint.Q: Why does codex exec keep waiting for standard input?
Q: Why does codex exec keep waiting for standard input?
If it stops at
Reading additional input from stdin... and you do not need to supply input through stdin, append < /dev/null to the command.Q: Why is the response empty or marked incomplete?
Q: Why is the response empty or marked incomplete?
Inspect the response status, error details, and token usage. Reasoning can consume the available output budget before visible text is produced. Identify the cause before adjusting parameters supported by your client version and the service.
Q: Why are search tools missing even though the MCP server is registered?
Q: Why are search tools missing even though the MCP server is registered?
Check that registration and startup use the same
CODEX_HOME, and verify STEP_API_KEY. Inspect codex mcp list, restart an interactive session, and check /mcp. If you use codex exec, verify tool loading and invocation in that mode separately.
