客户端接入 / 工作流

OpenClaw 最新版本 自定义中转站配置教程

OpenClaw 最新版本 自定义中转站配置教程

第一步:安装与基础初始化

首先确保你已经安装了 Node.js 环境,然后在终端执行:

  1. 全局安装:

npm install -g openclaw@latest



  1. 执行引导(根据提示完成基础设置):

openclaw onboard




第二步:修改主配置文件 clawdbot.json

打开路径:C:\Users\admin\.openclaw\openclaw.json

modelsauth 部分修改为以下内容,以支持自定义中转站。


{

  "agents": {

    "defaults": {

      "model": {

        "primary": "api-proxy-claude/claude-sonnet-4-5-20250929"

      },

      "models": {

        "api-proxy-gpt/gpt-5.2": {

          "alias": "GPT-5.2"

        },

        "api-proxy-claude/claude-sonnet-4-5-20250929": {

          "alias": "Claude Sonnet 4.5"

        },

        "api-proxy-google/gemini-3-pro-preview": {

          "alias": "Gemini 3 Pro"

        },

        "api-proxy-deepseek/deepseek-v3.2": {

          "alias": "Deepseek v3.2"

        }

      },

      "workspace": "C:\\Users\\admin\\clawd",

      "maxConcurrent": 4,

      "subagents": {

        "maxConcurrent": 8

      }

    }

  },

  "auth": {

    "profiles": {

      "api-proxy-gpt:default": {

        "provider": "api-proxy-gpt",

        "mode": "api_key"

      },

      "api-proxy-claude:default": {

        "provider": "api-proxy-claude",

        "mode": "api_key"

      },

      "api-proxy-google:default": {

        "provider": "api-proxy-google",

        "mode": "api_key"

      },

      "api-proxy-deepseek:default": {

        "provider": "api-proxy-deepseek",

        "mode": "api_key"

      }

    }

  },

  "models": {

    "mode": "merge",

    "providers": {

      "api-proxy-gpt": {

        "baseUrl": "https://www.cokeapi.com/v1",

        "api": "openai-responses",

        "models": [

          {

            "id": "gpt-5.2",

            "name": "GPT-5.2",

            "reasoning": false,

            "input": [

              "text"

            ],

            "cost": {

              "input": 0,

              "output": 0,

              "cacheRead": 0,

              "cacheWrite": 0

            },

            "contextWindow": 128000,

            "maxTokens": 8192

          }

        ]

      },

      "api-proxy-claude": {

        "baseUrl": "https://www.cokeapi.com",

        "api": "anthropic-messages",

        "models": [

          {

            "id": "claude-sonnet-4-5-20250929",

            "name": "Claude Sonnet 4.5",

            "reasoning": false,

            "input": [

              "text"

            ],

            "cost": {

              "input": 0,

              "output": 0,

              "cacheRead": 0,

              "cacheWrite": 0

            },

            "contextWindow": 200000,

            "maxTokens": 8192

          }

        ]

      },

      "api-proxy-google": {

        "baseUrl": "https://www.cokeapi.com/v1",

        "api": "google-generative-ai",

        "models": [

          {

            "id": "gemini-3-pro-preview",

            "name": "Gemini 3 Pro",

            "reasoning": false,

            "input": [

              "text"

            ],

            "cost": {

              "input": 0,

              "output": 0,

              "cacheRead": 0,

              "cacheWrite": 0

            },

            "contextWindow": 2000000,

            "maxTokens": 8192

          }

        ]

      },

      "api-proxy-deepseek": {

        "baseUrl": "https://www.cokeapi.com/v1",

        "api": "openai-completions",

        "models": [

          {

            "id": "deepseek-v3.2",

            "name": "Deepseek v3.2",

            "reasoning": false,

            "input": [

              "text"

            ],

            "cost": {

              "input": 0,

              "output": 0,

              "cacheRead": 0,

              "cacheWrite": 0

            },

            "contextWindow": 2000000,

            "maxTokens": 8192

          }

        ]

      }

    }

  }

}




第三步:配置鉴权文件 auth-profiles.json

打开路径:C:\Users\admin\.openclaw\agents\main\agent\auth-profiles.json

在此处填入你从中转站获取的真实 API Key。


{

  "version": 1,

  "profiles": {

    "api-proxy-gpt:default": {

      "type": "api_key",

      "provider": "api-proxy-gpt",

      "key": "sk-your-unique-gpt-key-here"

    },

    "api-proxy-claude:default": {

      "type": "api_key",

      "provider": "api-proxy-claude",

      "key": "sk-your-unique-claude-key-here"

    },

    "api-proxy-google:default": {

      "type": "api_key",

      "provider": "api-proxy-google",

      "key": "sk-your-unique-google-key-here"

    },

    "api-proxy-deepseek:default": {

      "type": "api_key",

      "provider": "api-proxy-deepseek",

      "key": "sk-your-unique-deepseek-key-here"

    }

  }

}




第四步:检查并启动

  1. 启动 Gateway 服务:

openclaw gateway --port 18789



  1. 访问控制台:

打开浏览器访问 http://127.0.0.1:18789/