> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Step 3.7

> StepFun's Step 3.7 Flash is a 198B-parameter sparse MoE vision-language model.

[Reasoning](https://docs.baseten.co/examples/models/capabilities/reasoning)
[Tool calling](https://docs.baseten.co/examples/models/capabilities/tool-calling)
[Multimodal (image)](https://docs.baseten.co/examples/models/capabilities/multimodal-image)
[Long context](https://docs.baseten.co/examples/models/capabilities/long-context)

StepFun's Step 3.7 Flash is a 198B-parameter sparse MoE vision-language model. It supports image input, native tool calling, and selectable reasoning levels, served from an FP8 checkpoint.

## Setup

Install the Baseten CLI and sign in, then install the OpenAI SDK.

**Install and sign in to Baseten**

> [tab] macOS or Linux
>
> ```bash Terminal theme={"system"}
> brew tap basetenlabs/baseten
> brew trust --formula basetenlabs/baseten/baseten
> brew install baseten
> ```

> [tab] Windows
>
> Download and extract the Windows archive for the latest Baseten CLI release:
>
> ```powershell Terminal theme={"system"}
> $release = Invoke-RestMethod https://api.github.com/repos/basetenlabs/baseten-cli/releases/latest
> $asset = $release.assets | Where-Object { $_.name -like "*_windows_amd64.zip" }
> Invoke-WebRequest $asset.browser_download_url -OutFile baseten.zip
> Expand-Archive -Force baseten.zip .
> ```
>
> Move `baseten.exe` to a directory on your `PATH`.

For other platforms or a specific version, see the [Baseten CLI install reference](https://docs.baseten.co/reference/cli/baseten/overview.md#install).

```sh theme={"system"}
baseten auth login
```

**Install the OpenAI SDK**

```sh theme={"system"}
uv pip install openai
```

To install without Homebrew, see the [Baseten CLI install reference](https://docs.baseten.co/reference/cli/baseten/overview.md#install).

This preset serves Step 3.7 Flash on H100:4 with FP8 weights and an FP8 KV cache, optimized for low time-to-first-token with MTP speculative decoding.

> [card] Hardware
>
> H100 × 4

> [card] Engine
>
> vLLM (stepfun37 build)

> [card] Context
>
> 256K

> [card] Concurrency
>
> 64

## Write the config

Create and move into the project directory:

```sh theme={"system"}
mkdir step-3.7-flash-latency && cd step-3.7-flash-latency
```

Then create a file named `config.yaml` and paste the following:

```yaml config.yaml theme={"system"}
model_name: "model:step-3.7-flash preset:latency"
model_metadata:
  description: >-
    StepFun Step-3.7-Flash 198B sparse MoE vision-language model served with vLLM,
    FP8-quantized with FP8 KV cache, OpenAI-compatible chat with tooling, multimodal image input,
    and MTP speculative decoding. Supports 256k context and selectable reasoning levels (low, medium, high).
  repo_id: stepfun-ai/Step-3.7-Flash-FP8
  example_model_input:
    model: stepfun-ai/Step-3.7-Flash-FP8
    messages:
      - role: user
        content: "What is the meaning of life?"
    stream: true
    max_tokens: 32768
    temperature: 1.0
  tags:
    - openai-compatible
    - multimodal
base_image:
  image: vllm/vllm-openai:stepfun37
weights:
  - source: "hf://stepfun-ai/Step-3.7-Flash-FP8@b3d7916fccac844cca050d7520f2aaa513f9a84f"
    mount_location: "/app/checkpoint/model"
resources:
  accelerator: H100:4
  use_gpu: true
environment_variables:
  VLLM_LOGGING_LEVEL: WARNING
  VLLM_ENGINE_READY_TIMEOUT_S: "3600"
  VLLM_USE_DEEP_GEMM: "0"
docker_server:
  start_command: >-
    sh -c 'GPU_COUNT=$(nvidia-smi --list-gpus | wc -l) && vllm serve /app/checkpoint/model
    --served-model-name stepfun-ai/Step-3.7-Flash-FP8
    --trust-remote-code
    --enable-chunked-prefill
    --enable-prefix-caching
    --enable-expert-parallel
    --disable-cascade-attn
    --async-scheduling
    --tensor-parallel-size $GPU_COUNT
    --max-model-len 262144
    --max-num-seqs 32
    --max-num-batched-tokens 8192
    --gpu-memory-utilization 0.95
    --kv-cache-dtype fp8
    --reasoning-parser step3p5
    --enable-auto-tool-choice
    --tool-call-parser step3p5
    --speculative-config.method mtp
    --speculative-config.num_speculative_tokens 3
    --load-format runai_streamer'
  readiness_endpoint: /health
  liveness_endpoint: /health
  predict_endpoint: /v1/chat/completions
  server_port: 8000
runtime:
  predict_concurrency: 64
  health_checks:
    startup_threshold_seconds: 1800
    restart_threshold_seconds: 1200
    stop_traffic_threshold_seconds: 120
```

## Flags

The `start_command` passes these flags to the engine. Each one controls a runtime or serving behavior:

| Flag | Value | What it does |
| - | - | - |
| `--trust-remote-code` | (no value) | Execute model-specific Python from the checkpoint (required for many Qwen, Phi, and custom architectures). |
| `--enable-chunked-prefill` | (no value) | Process long prompts in chunks so decode requests keep running. |
| `--enable-prefix-caching` | (no value) | Reuse KV cache across requests that share a prefix. |
| `--enable-expert-parallel` | (no value) | Shard MoE expert weights across tensor-parallel ranks instead of replicating them, reducing per-GPU memory for large MoE models. |
| `--disable-cascade-attn` | (no value) | Disable cascade attention, falling back to the standard attention path. |
| `--async-scheduling` | (no value) | Overlap scheduling with GPU execution to hide scheduler latency. |
| `--tensor-parallel-size` | `$GPU_COUNT` | Number of GPUs to shard the model across. |
| `--max-model-len` | `262144` | Maximum context length (tokens) the server accepts per request. |
| `--max-num-seqs` | `32` | Maximum number of concurrent sequences in the batch. |
| `--max-num-batched-tokens` | `8192` | Maximum total tokens processed per scheduler step. |
| `--gpu-memory-utilization` | `0.95` | Fraction of GPU memory vLLM may use for weights and KV cache. |
| `--kv-cache-dtype` | `fp8` | KV cache numeric precision. **fp8:** \~2× KV cache density with negligible quality impact on most models. |
| `--reasoning-parser` | `step3p5` | Server-side parser that separates reasoning output into `reasoning_content`. |
| `--enable-auto-tool-choice` | (no value) | Let the model choose when to call tools without requiring `tool_choice: "required"`. |
| `--tool-call-parser` | `step3p5` | Server-side parser that emits structured `tool_calls` on the response. |
| `--speculative-config.method` | `mtp` | Speculative decoding method. **mtp:** Multi-token prediction head speculation. |
| `--speculative-config.num_speculative_tokens` | `3` | Number of tokens the draft speculator proposes per step. |
| `--load-format` | `runai_streamer` | Weight loading backend. **runai\_streamer:** Stream weights from object storage without materializing to disk. |

## Deploy

Push the config to Baseten with the Baseten CLI, or with the Truss CLI if you prefer it:

```sh Baseten CLI theme={"system"}
baseten model push
```

```sh Truss CLI theme={"system"}
uvx truss push
```

You should see output similar to:

```output theme={"system"}
Pushing model "step-3.7-flash-latency"...
Uploading model...
Uploaded model in 0s
✨ Model step-3.7-flash-latency was successfully pushed ✨

  Model:       step-3.7-flash-latency (abc1d2ef)
  Deployment:  xyz123
  Environment: production

🪵 View logs:
   deployment:   baseten model deployment logs --model-id abc1d2ef --deployment-id xyz123
   environment:  baseten model environment logs --model-id abc1d2ef --environment production  (once deployed)
   app:          https://app.baseten.co/models/abc1d2ef/logs/xyz123

🚀 Invoke your model:
   URL:  https://model-abc1d2ef.api.baseten.co/deployment/xyz123/predict
   CLI:  baseten model predict --model-id abc1d2ef
```

`baseten model push` prints your **model ID** (`abc1d2ef` in the example). The examples below use it wherever you see `{model_id}`, and read your API key from the `BASETEN_API_KEY` environment variable.

## Call the model

Your deployment serves an OpenAI-compatible API.

Now call your deployment to run inference:

> [tab] Python
>
> ```python main.py theme={"system"}
> import os
> from openai import OpenAI
>
> client = OpenAI(
>     api_key=os.environ["BASETEN_API_KEY"],
>     base_url="https://model-{model_id}.api.baseten.co/environments/production/sync/v1",
> )
>
> response = client.chat.completions.create(
>     model="stepfun-ai/Step-3.7-Flash-FP8",
>     messages=[
>         {"role": "user", "content": "What is machine learning?"}
>     ],
> )
>
> print(response.choices[0].message.content)
> ```

> [tab] cURL
>
> ```sh theme={"system"}
> curl -s https://model-{model_id}.api.baseten.co/environments/production/sync/v1/chat/completions \
>   -H "Content-Type: application/json" \
>   -H "Authorization: Bearer $BASETEN_API_KEY" \
>   -d '{
>     "model": "stepfun-ai/Step-3.7-Flash-FP8",
>     "messages": [
>       {"role": "user", "content": "What is machine learning?"}
>     ]
>   }'
> ```

The server parses the model's chain of thought into a separate `reasoning_content` field on the response. Read it alongside the final answer:

```python theme={"system"}
response = client.chat.completions.create(
    model="stepfun-ai/Step-3.7-Flash-FP8",
    messages=[
        {"role": "user", "content": "How many r's in strawberry?"}
    ],
)
print(response.choices[0].message.reasoning_content)  # chain of thought
print(response.choices[0].message.content)            # final answer
```

To let the model call tools, pass a `tools` array. The server returns structured `tool_calls` on the response:

```python theme={"system"}
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "parameters": {
            "type": "object",
            "properties": {"location": {"type": "string"}},
            "required": ["location"],
        },
    },
}]

response = client.chat.completions.create(
    model="stepfun-ai/Step-3.7-Flash-FP8",
    messages=[
        {"role": "user", "content": "What's the weather in Paris?"}
    ],
    tools=tools,
)
print(response.choices[0].message.tool_calls)
```

## Next steps

> [card] [Call your model](https://docs.baseten.co/inference/calling-your-model.md)
>
> Endpoint anatomy, authentication, and sync versus async inference

> [card] [Autoscaling](https://docs.baseten.co/deployment/autoscaling/overview.md)
>
> Scale replicas with traffic, including scale to zero
