> ## 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.

# Claude Code Integration Guide

Claude Code is an AI coding assistant that runs in the terminal. It can complete code generation, debugging, refactoring, engineering management, and other development tasks through natural language commands. By configuring its API endpoint, Claude Code can route model requests to a custom AI service.

This guide explains how to configure Step API access in Claude Code and verify that the model is available.

## Overview

Claude Code is designed for developers who prefer terminal-based workflows. After the configuration is complete, you can use natural language to drive coding tasks directly inside local projects.

## Prerequisites

### Operating System

Claude Code supports the following systems:

* macOS
* Linux
* Windows (PowerShell or Windows Terminal is recommended)

### Node.js Environment

Claude Code depends on Node.js. We recommend installing `Node.js >= 18`.

Example installation methods for different systems:

* macOS: use Homebrew or `nvm`
* Linux: use the system package manager or `nvm`
* Windows: use the official Node.js installer or Chocolatey

Example commands:

```bash theme={null}
brew install node
nvm install 18
sudo apt install nodejs npm
choco install nodejs
```

After installation, run the following commands to verify your environment:

```bash theme={null}
node -v
npm -v
```

### Subscribe to Step Plan

Before you start, make sure your account has an active Step Plan subscription. Model calls and quota usage will work only after your account has the required plan or calling permissions.

To subscribe or purchase a plan, visit [Step Plan Subscription](https://platform.stepfun.ai/step-plan).

### Get a Step API Key

Before calling models, get an API Key from the [Step Open Platform](https://platform.stepfun.ai/interface-key). We recommend creating a new key in the console and avoiding hardcoding it into your code repository.

Recommended practices:

* Store the key in an environment variable
* Or manage the key through a local configuration file

## Configuration Steps

### Install Claude Code

Run the following command in your terminal:

```bash theme={null}
npm install -g @anthropic-ai/claude-code
```

After installation, verify the version:

```bash theme={null}
claude --version
```

### Create the Configuration File

<Tabs>
  <Tab title="Quick setup with the script">
    macOS / Linux (Bash)

    ```bash theme={null}
    curl -fsSL https://cdn.jsdelivr.net/gh/Zgh332358/claude-key-setup@main/configure_claude.sh -o configure_claude.sh
    chmod +x configure_claude.sh
    bash configure_claude.sh
    ```

    Windows (PowerShell as Administrator)

    **Note**: You must run the script in PowerShell as Administrator. Otherwise, the script will show a prompt and exit.

    1. Right-click the Windows Start menu, then select "Terminal (Admin)" or "Windows PowerShell (Admin)".

    2. Run the following commands:

    ```powershell theme={null}
    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass; irm https://raw.githubusercontent.com/Zgh332358/claude-key-setup/main/configure_claude.ps1 -OutFile configure_claude.ps1; .\configure_claude.ps1
    ```
  </Tab>

  <Tab title="Edit the configuration file manually">
    Claude Code reads the API service address and authentication information from a configuration file. The configuration file is located at:

    ```text theme={null}
    ~/.claude/settings.json
    ```

    If the file does not exist, create the directory and file first:

    ```bash theme={null}
    mkdir -p ~/.claude
    touch ~/.claude/settings.json
    ```

    Write the following content into the configuration file:

    ```jsonc theme={null}
    {
      "env": {
        "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
        "ANTHROPIC_BASE_URL": "https://api.stepfun.ai/step_plan"
      },
      "model": "<model_id>"
    }
    ```

    Parameter description:

    * `ANTHROPIC_AUTH_TOKEN`: enter your Step API Key
    * `ANTHROPIC_BASE_URL`: enter the Base URL
    * `model`: enter `<model_id>`

    > Note: In this guide, `<model_id>` can be `step-3.7-flash`, `step-3.5-flash-2603`, or `step-3.5-flash`.

    After saving the file, reopen your terminal to make the configuration take effect.
  </Tab>
</Tabs>

### Start Claude Code

Enter any code project directory:

```bash theme={null}
cd your-project
```

Start Claude Code:

```bash theme={null}
claude
```

If `Do you want to use this API key?` appears on first launch, select `Yes`.

## Test the Integration

After entering Claude Code, run the following command to view the current configuration status:

```text theme={null}
/status
```

Confirm that the following information is correct:

* The API Key is loaded
* The Base URL is correct (`https://api.stepfun.ai/step_plan`)
* The default model name is correct (`<model_id>`)

Then run this test instruction:

```text theme={null}
write a minimal python hello world program into hello.py
```

If Claude Code successfully creates the file and writes code into it, the model integration is working.

## Common Issues

### Model Does Not Exist

Example error:

```text theme={null}
model does not exist
```

Possible causes:

* The model name is incorrect (it should be `<model_id>`)
* The current account does not have permission to use this model
* The Base URL points to the wrong endpoint (it should be `https://api.stepfun.ai/step_plan`)

### Invalid API Key

Example error:

```text theme={null}
401 invalid_api_key
```

Possible causes:

* The API Key was entered incorrectly
* The key has expired or been deleted
* The key does not match the current API domain

### Insufficient Quota

Example error:

```text theme={null}
402 quota_exceeded
```

This usually means the current account has used up its calling quota. Add balance or upgrade your plan.

### Changes Do Not Take Effect After Modifying the Configuration

We recommend checking:

1. Whether Claude Code has been fully restarted.
2. Whether the configuration file uses valid JSON.
3. Whether the terminal environment variables have been refreshed.

## Summary

After configuration is complete, Claude Code can initiate model calls through the Step API in the terminal for code generation, debugging, and development workflow automation. We recommend verifying the configuration with `/status` and a minimal task before using it in a real project.
