AIFusionAIFusion
  • Platform Tutorial
  • Claude Code Tutorial
  • OpenCode Tutorial
  • OpenClaw Tutorial
  • English
  • 简体中文
  • Platform Tutorial
  • Claude Code Tutorial
  • OpenCode Tutorial
  • OpenClaw Tutorial
  • English
  • 简体中文
  • Guide

    • Platform Tutorial
    • Claude Code Tutorial
    • OpenCode Tutorial
    • OpenClaw Tutorial

OpenCode Tutorial

What is OpenCode?

OpenCode is an open-source, free command-line interface (CLI) tool built with Go, offering powerful AI assistance for developers. Its ultimate competitive edge lies in breaking free from model lock-in—allowing you to seamlessly connect to any model, whether it's Gemini, Claude, or GPT.

Fully Open Source & Free

Based on Go, driven by open source community

Multi-Model Free Switching

Supports OpenAI, Anthropic, Gemini and local models

Interactive Terminal Interface

Smooth TUI experience based on Bubble Tea

LSP Integration

Built-in code intelligence and diagnostics

Installation Methods

Method 1: Install Script (macOS / Linux)

curl -fsSL https://opencode.ai/install | bashSupported Environments & System Requirements
Supported Platforms
macOS 12+ (Recommended)
Ubuntu 20.04+ / Debian 11+
Windows (requires additional installation of Git for Windows)
System Requirements
Node.js 18.0 or higher version
npm or yarn package manager
Windows users need to install Git for Windows
4GB+ available memory
Stable network connection
Installation Steps
1. Install Node.js
If Node.js is not yet installed, we recommend using nvm for version management:nvm install 18nvm use 18
⚠ Note for Windows Users
Windows systems additionally require installing Git for Windows, otherwise Claude Code may not run properly. Keep default options during installation.
2. Install Claude Code CLI (Required)
This is the prerequisite for all subsequent configuration. You must first install the Claude Code CLI tool locally:
npm install -g @anthropic-ai/claude-code
Verify Installation
Run claude --version to confirm successful installation.
API Configuration (Key Step)
1. Get Token
Go to the SpritNest console to get your API Key. Free credits are given upon registration.
2. Configure Environment Variables
Edit the configuration file ~/.claude/settings.json:
{  "env": {    "ANTHROPIC_AUTH_TOKEN": "sk-your-api-key",    "ANTHROPIC_BASE_URL": "https://aifusion.network/",    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000",    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"  },  "permissions": {    "allow": [],    "deny": []  },  "alwaysThinkingEnabled": false}
💡 Tip
You can also configure via environment variables: export ANTHROPIC_BASE_URL=https://aifusion.network/ and export ANTHROPIC_AUTH_TOKEN="sk-xxx"
3. Configure .claude.json
Edit or create the ~/.claude.json file (on Windows: User Directory/.claude.json), add the following content to skip the initial onboarding flow:
{  "hasCompletedOnboarding": true}
❓ Why is this step needed?
After configuring this parameter, Claude Code will skip the official onboarding flow at startup and enter the ready-to-use state directly, avoiding getting stuck on the onboarding page due to network restrictions.
Basic Usage
1. Start Claude Code
# Start in the project directorycd your-projectclaude
2. First Startup Setup
On first startup, Claude Code will automatically scan the project structure. You can directly describe your requirements in natural language:
# Let Claude explain code> Explain the logic of src/auth/middleware.ts# Let Claude refactor code> Refactor this class component to hooks# Let Claude generate code> Create a CRUD template for a REST API
3. Basic Operation Examples
/compact [instructions]  # You can add instructions, telling Claude which important information to keep
Common Commands Reference
Common Commands in Interactive Mode
When the conversation is too long and tokens are approaching the limit, use the /compact command to compress the context:
/compact [instructions]  # You can add instructions, telling Claude which important information to keep
Resume Previous Conversation
Use /resume or add the –resume parameter at startup to resume a previous conversation:
claude --resume        # Resume last conversation at startupclaude --resume <id>   # Resume a specific conversation by ID
Handling Image Information
Claude Code supports passing images in conversations for analysis. You can directly drag images into the terminal or use path references.
MCP (Model Context Protocol)
MCP (Model Context Protocol) allows Claude Code to connect to external tools and services. Simply create a .mcp.json file in the project root directory to configure.
Best Practices for MCP
Place MCP configuration in the .mcp.json file in the project root directory, so team members can share the same tool configuration.
MCP Configuration Example
{  "mcpServers": {    "filesystem": {      "command": "npx",      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]    },    "github": {      "command": "npx",      "args": ["-y", "@modelcontextprotocol/server-github"],      "env": {        "GITHUB_PERSONAL_ACCESS_TOKEN": "your-token"      }    }  }}
Advanced Tips
Project Memory File (CLAUDE.md)
Create a CLAUDE.md file in the project root directory. Claude will automatically read it at each startup to understand the project context:
# Project Architecture- Frontend: React + TypeScript + Tailwind- Backend: Node.js + Express + Prisma- Database: PostgreSQL# Coding Standards- Use ESLint + Prettier- Components use functional style + Hooks- API responses use unified { code, data, message } format# Notes- Do not modify files in the migrations directory- Environment variables have templates in .env.example
IDE Integration
Claude Code can be used with mainstream IDEs:
VS Code: Run claude directly in the built-in terminal
Cursor: Can use both Cursor AI and Claude Code simultaneously
JetBrains: Start in the Terminal panel
VS Code Plugin: Claude Code for VS Code
Besides using it in the terminal, you can also install the official Claude Code for VS Code plugin in VS Code to get a graphical interactive experience.
💡 Prerequisites
Before using this plugin, you must first install and configure the Claude Code CLI locally (i.e., complete npm install -g @anthropic-ai/claude-code + configure settings.json and .claude.json). The plugin will
Installation Method: Search for Claude Code (published by Anthropic) in the VS Code extension store, then click Install.
Usage Notes:
After installation, the plugin will automatically detect the local Claude Code CLI and its configuration
If the CLI has been correctly configured with API Key and Base URL, the plugin will work directly without popping up a login page
If the plugin prompts for login, it means the local CLI has not been installed or configured completely. Please complete the installation and configuration steps above first
Usage Tips & Common Issues
Best Practices
Let Claude analyze the project structure first, then raise specific requirements
Break complex tasks into small steps and complete them gradually
Make good use of CLAUDE.md to provide project context
Regularly use /compact to compress context and avoid token overflow
5. Review generated code, don’t accept blindly Common Issues
Q: What to do about connection timeout?
Check whether the API address and Key in ~/.claude/settings.json are correct. If using environment variables, confirm that ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN are correctly set.
Q: How to switch models?
Enter /model in the conversation to view and switch available models.
Q: What to do when tokens are used up?
Use /compact to compress context, or /clear to clear the conversation and start over.
Reference Links
OpenCode Tutorial
What is OpenCode?
OpenCode is a free open-source command-line programming tool (CLI) based on Go, providing developers with powerful AI assistance. Its core advantage lies in breaking model restrictions — you can freely connect Gemini, Claude, GPT, and other models, or even local models, all through a unified interface.
Completely Open Source and Free
Based on Go, driven by the open-source community
Multi-model Free Switching
Supports OpenAI, Anthropic, Gemini, and local models
Interactive Terminal Interface
Smooth TUI experience based on Bubble Tea
LSP Integration
Built-in code intelligence and diagnostic features
Installation Methods
Method 1: Installation Script (macOS / Linux)
Method 2: NPM Installation (All Platforms, Recommended for Windows)
Install Node.js first, then run npm i -g opencode-ai@latest
Method 3: Homebrew Desktop Client (macOS)
Run brew install --cask opencode-desktop
Desktop Application — OpenCode also provides a desktop application and IDE extensions, which can be obtained from the official website.
API Configuration (Key Step)
1. Register Custom Provider
After installation, do not start OpenCode directly. Execute in the terminal: opencode auth login
Select "other" in the provider list (at the bottom, you can search directly). Then follow the prompts:
Provider ID: Enter a unique identifier, e.g., spritnestapi (must be consistent with subsequent configuration)
API Key: Enter the API Key obtained from the SpritNest console
2. Modify Configuration File
Open the configuration directory, create or edit opencode.json:
macOS / Linux: ~/.config/opencode/opencode.json
Windows: Users\YourUsername\.config\opencode\opencode.json
⚠ Important Note: The "spritnestapi" in the configuration must be exactly the same as the Provider ID entered in step 1. Anthropic-compatible spritnestapi uses https://aifusion.network/; OpenAI-compatible "spritnestapigpt" uses https://aifusion.network/v1. If you want to use Claude and GPT models simultaneously, you can create two providers.
3. Get API Token
Go to the SpritNest console to generate a token.
Token Group Recommendation: It is recommended to use the default group. After setting the token name, do not add any models in the "Restrict Model List". Keep everything else as default.
Basic Usage
1. Start OpenCode
After saving the configuration file, restart the terminal, then run: opencode
2. Select Model
Enter the command /models in the chat interface to view available models. In the model list, you can see your configured relay station and its models. Select one to start using normally.
3. Start Coding
Usage Tips
Best Practices: 1. Utilize session management features to save and switch conversations for different projects. 2. Improve efficiency by presetting common operations through custom commands. 3. Configure multiple models in models and switch as needed. 4. Make good use of LSP integration for code intelligent suggestions.
Common Issues: Q: Can't see custom models after startup? — Check whether the Provider ID in opencode.json is exactly the same as what you entered during opencode auth login. Q: Connection failed? — Confirm that baseURL and apiKey are correctly filled, and the token group uses default.
OpenClaw Tutorial
What is OpenClaw?
OpenClaw is a powerful AI programming assistant tool that supports interacting with AI models through Web UI or command line. It provides rich configuration options and a plugin system, and can connect to various AI model providers, making it an ideal choice for developers who need flexible configuration.
Web UI Interface
Provides a friendly Web interface for convenient viewing and managing conversations
Multi-model Support
Supports Claude, GPT, and other AI models
Plugin System
Rich plugin ecosystem, expanding more features
Highly Configurable
Supports custom contextWindow, maxTokens, and other parameters
Installation Steps
Prerequisites
Make sure Node.js ≥ 22 is installed. You can check the version with the following command: node --version
Install OpenClaw
Run the following command in the terminal to globally install OpenClaw: npm install -g openclaw@latest (or use pnpm add -g openclaw@latest). After installation, run openclaw onboard --install-daemon to start the initialization wizard.
Configuration Guide
1. Start Initialization Program
After installation, run the following command to start the initialization wizard: openclaw onboard --install-daemon
2. Configuration Wizard Steps
Follow the wizard prompts for configuration. Key steps: 1. Install daemon? - Select yes. 2. Onboarding mode - Select the first option. 3. Model/auth provider - Select Custom Provider. 4. API Base URL - Enter https://aifusion.network/. 5. API Key - Enter the API Key from the console. 6. Endpoint compatibility - Select Anthropic-compatible. 7. Model ID - Enter claude-opus-4-6-thinking. 8. Endpoint ID - Use default. 9. Model alias - Optional, e.g., opus4.6. 10. Skip QuickStart/Skills/Hooks for first use. 11. How do you want to hatch your bot? - Select Open the Web UI.
3. Get API Key
Go to the SpritNest console to create a token: 1. Click "Add Token". 2. Enter a name (any), select default for the group. 3. Leave the model restriction list and IP whitelist empty, click Submit directly. 4. Copy the generated Key and paste it into the OpenClaw configuration.
4. Optimize Configuration File
After initialization, edit ~/.openclaw/openclaw.json: Increase contextWindow from 4096 to 200000. Increase maxTokens from 4096 to 8192. Confirm baseUrl is https://aifusion.network/.
Basic Usage
After configuration is complete, OpenClaw will automatically open the Web UI interface. You can converse with AI in the browser for code writing, problem answering, and other operations. For first-time use, it is recommended to first conduct a simple conversation test to confirm the configuration is correct before engaging in complex programming tasks. You can also let AI help you configure other tools and plugins.

Method 2: NPM Install (All platforms, recommended for Windows)

First install Node.js, then run:

npm i -g opencode-ai@latest

Method 3: Homebrew Desktop Client (macOS)

brew install --cask opencode-desktop

Desktop Application

OpenCode also provides desktop applications and IDE extensions, available from official download page to download.

API Configuration (Key Step)

1. Register Custom Provider

After installation, do not launch OpenCode directly. Run the following in the terminal:

opencode auth login

Select other from the provider list (at the bottom, you can search directly):

Then follow the prompts:

  • Provider ID: Enter a unique identifier, e.g., spritnestapi(must be consistent with subsequent configuration)

  • API Key:Enter the API Key obtained from the SpritNest console

2. Modify Configuration File

Open the configuration directory, create or edit opencode.json:

  • macOS / Linux:~/.config/opencode/opencode.json

  • Windows:Users\your-username\.config\opencode\opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "spritnestapi": {  // Must match the Provider ID from the previous step exactly
      "npm": "@ai-sdk/anthropic",
      "name": "SpritNest-Api",  // Display name (Customizable)
      "options": {
        "baseURL": "https://aifusion.network/"
        // "apiKey": "{cred:spritnestapi}"  // Optional: Automatically reference the secret stored in the previous step
      },
      "models": {
        "claude-opus-4-5-20251101": {
          "name": "claude-opus-4-5-20251101"
        },
        "claude-sonnet-4-5": {
          "name": "claude-sonnet-4-5"
        },
        "claude-opus-4-6": {
          "name": "claude opus 4.6"
        }
        // Add more models...
      }
    },
    "spritnestapigpt": {  // Set up another OpenAI-compatible provider to use Claude and GPT simultaneously
      "npm": "@ai-sdk/openai",
      "name": "SpritNest-gpt",
      "options": {
        "baseURL": "https://aifusion.network/",
        "apiKey": "sk-your-gpt-api-key"  // Standardize on tokens from the "default" group
      },
      "models": {
        "gpt-5.2-codex": {
          "name": "gpt-5.2-codex"
        },
        "gpt-5.3-codex": {
          "name": "gpt-5.3-codex"
        },
        "gpt-5.3-codex-spark": {
          "name": "gpt-5.3-codex-spark"
        }
        // Add more models...
      }
    }
  }
}

⚠ ImportantNote

The "spritnestapi" in the configuration must exactly match the Provider ID Provider ID entered in Step 1.Anthropic compatible spritnestapi useshttps://aifusion.network/;OpenAI compatible "spritnestapigpt" uses https://aifusion.network/。To use GPT models simultaneously, you need to create another "spritnestapigpt" provider, also using the default group token.

3. Get API Token

Go to SpritNest Tokenpage to generate a token.

Token Group Recommendation

It is recommended to use the default group. After setting the token name, do not add any models in the "Restricted Model List" below. Keep everything else as default.

Basic Usage

1. Start OpenCode

After saving the configuration file, restart the terminal, then run:

opencode

2. Select Model

Enter the command in the chat interface to view available models:

/models

In the model list, you can see your configured relay station and its models (e.g., "claude-opus-4-6"). Select one to start using it.

3. Start Coding

> Help me analyze the architecture of this project
> Add error handling to this function
> Optimize the performance of this code

Usage Tips

Best Practices

1. Use session management to save and switch between different project conversations

2. Preset common operations via custom commands to improve efficiency

3. Configure multiple models in models and switch as needed

4. Make good use of LSP integration for code intelligenceFAQ

Q: Can't see custom model after startup?

Check whether the Provider ID in opencode.json where的 Provider ID matches the one entered during opencode auth login exactly.

Q: Connection failed?

Confirm that baseURL and apiKey are filled in correctly, and the token group uses default.

OpenClaw Tutorial

What is OpenClaw?

OpenClaw is a powerful AI programming assistant tool that supports interacting with AI models via Web UI or command line. It provides rich configuration options and a plugin system, and canconnect to various AI model providers, making it a powerful tool for developers to boost programming efficiency.

Web UI Interface

Provides a friendly web interface for easy viewing and managing conversations

Multi-Model Support

Supports various AI models including Claude, GPT, etc.

Plugin System

Rich plugin ecosystem for extending functionality

Highly Configurable

Supports custom contextWindow, maxTokens and other parameters

Installation Steps

Prerequisites

Ensure Node.js ≥ 22 is installed. You can check the version with the following command:

Check Node.js Version

Install OpenClaw

Run the following command in the terminal to install OpenClaw globally:

Install Command

Configuration Guide

1. Start Initialization

After installation, run the following command to start the initialization wizard:

Init Command

2. Configuration Wizard Steps

Follow the wizard prompts to configure. Key steps are as follows:

  1. Install daemon? - Select yes

  2. Onboarding mode - Select the first option

  3. Model/auth provider - Select Custom Provider (Any OpenAI or Anthropic compatible endpoint)

  4. API Base URL - Enter https://aifusion.network/

  5. API KeyEnter the API Key obtained from the console (see notes below)

  6. Endpoint compatibility - Select AnthroEnterc-compatible (Uses /messages)

  7. Model ID - Enter claude-opus-4-6-thinking(or other models)

  8. Endpoint ID - Use default value

  9. Model alias - Optional, e.g., enter opus4.6

  10. Subsequent QuickStart, Skills, Hooks and other options can be selected as needed. For first-time use, you can skip all of them.

  11. How do you want to hatch your bot? - Select Open the Web UI for easy viewing

3. Get API KGo to

前往 SpritNest Tokenpage to create a token:

  1. Click "Add Token"

  2. Enter a name (any), select default for group

  3. Leave the model restriction list and IP whitelist empty, and click Submit directly

  4. Copy the generated Key and paste it into the OpenClaw configuration

4. Optimize Configuration File

After initialization, edit the configuration file ~/.openclaw/openclaw.json,优化以下参数:

  • Increase contextWindow from 4096 to 200000

  • Increase maxTokens from 4096 to 8192

  • Confirm baseUrl is https://aifusion.network/

Configuration File Example

Basic Usage

After configuration, OpenClaw will automatically open the Web UI interface. You can interact with AI in the browser for code writing, Q&A, and other operations.

Usage Tips

For first-time use, it is recommended to test with simple conversations first, and confirm the configuration is correct before proceeding with complex programming tasks.You can also let AI help you configure other toolsInstallnd plugins.

Last Updated: 7/2/26, 10:54 AM
Contributors: eric
Prev
Claude Code Tutorial
Next
OpenClaw Tutorial