omp packages

@marshal/pi-stepfun-provider0.1.3

StepFun model provider for pi coding agent

marshal Published 4 days ago MIT ~99 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-stepfun-provider

StepFun model provider for pi coding agent.

Features

  • ๐Ÿš€ Native provider integration - Models appear in /model selector
  • ๐Ÿ”‘ API key authentication - Via STEPFUN_API_KEY environment variable
  • ๐Ÿ”„ Dynamic model discovery - Fetches latest models from StepFun API
  • ๐Ÿ’ฐ Cost tracking - Input/output/cache token costs displayed
  • ๐Ÿง  Reasoning support - Reasoning models with reasoning_effort (low/medium/high)
  • ๐Ÿ–ผ๏ธ Vision support - Step 3.7 Flash / Step 5 Preview image understanding

Installation

Recommended: Install via npm for stable access and install statistics.

# Install directly with pi (recommended)
pi install npm:@marshal/pi-stepfun-provider

Or standard npm install:

npm install -g @marshal/pi-stepfun-provider

Note: pi install npm:... registers the extension globally. Plain npm install -g only downloads the package without registering it as a pi extension.

Alternative: Install from GitHub (for source access or custom modifications).

# Install from GitHub repo
pi install git:github.com/MarshalW/pi-stepfun-provider

Users in China are encouraged to use the npm method, as GitHub access may be unreliable.

Configuration

Set your StepFun API key:

export STEPFUN_API_KEY=sk-xxxxxxxxxxxxxxxx

Step Plan

StepFun's Step Plan subscription uses a separate endpoint. If you subscribed via Step Plan, set the base URL:

export STEPFUN_BASE_URL=https://api.stepfun.com/step_plan/v1

Add both environment variables to your shell profile (.bashrc, .zshrc, etc.) for persistence.

DNS: force IPv4 (required on some networks)

api.stepfun.com publishes both A and AAAA records, but only IPv4 responds. Node 20+ may pick the AAAA record and fail with DNS lookup failed, which surfaces as a silently failed turn rather than an obvious error. If you hit that, force IPv4 name resolution:

export NODE_OPTIONS=--dns-result-order=ipv4first

curl -4 works while curl -6 returns 000 is the quickest way to confirm this is your problem.

Usage

pi

Then use /model to select a StepFun model:

  • stepfun/step-5-preview - 1M-context flagship reasoning model (image understanding; the model itself also accepts video, but pi only exposes text + image inputs)
  • stepfun/step-3.7-flash - Multimodal reasoning model (image understanding, same video caveat)
  • stepfun/step-3.5-flash - Flagship text reasoning model
  • stepfun/step-3.5-flash-2603 - Agent-optimized reasoning model

Available Models

Model ID Name Reasoning Vision Context Max Output
step-5-preview Step 5 Preview โœ… โœ… 1M 64k
step-3.7-flash Step 3.7 Flash โœ… โœ… 256k 64k
step-3.5-flash Step 3.5 Flash โœ… โŒ 256k 64k
step-3.5-flash-2603 Step 3.5 Flash 2603 โœ… โŒ 256k 64k

Specs verified against the official docs; cost values are USD per 1M tokens from the English pricing page (the Chinese page quotes CNY).

Model ids that are not in the curated table above are discovered dynamically from GET /v1/models and built from the API-reported metadata (max_input_tokens, enable_vision_input, enable_reason, reasoning_effort_support_list) instead of hard-coded defaults โ€” so a brand-new model id reports its real context window and its real thinking levels on first sight. Unknown pricing is reported as 0 rather than as a guessed value.

GET /v1/models also lists speech models (TTS / ASR / realtime). They are not callable through chat completions (they answer {"type":"model_invalid"}), so they are filtered out via supported_protocols / model_type and never show up in /model. If a response contains no chat models at all, the static catalog is kept instead of replacing the model list with an empty one.

Refreshing Models

Models are fetched from StepFun API on:

  • Startup (if API key configured)
  • Running /model command
  • Running pi update --models

Development

# Clone and install dependencies
git clone https://github.com/MarshalW/pi-stepfun-provider
cd pi-stepfun-provider
pnpm install

# Test locally without installing globally
pi install -l .

Package Structure

pi-stepfun-provider/
โ”œโ”€โ”€ package.json          # Package manifest with pi config
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts          # Extension entry point
โ”‚   โ”œโ”€โ”€ models.ts         # Model definitions + dynamic fetching
โ”‚   โ””โ”€โ”€ streaming.ts      # Custom streaming (delegates to OpenAI compat)
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ LICENSE

License

MIT