跳到主要内容
极客日志极客日志面向AI+效率的开发者社区
首页博客GitHub 精选镜像工具UI配色美学隐私政策关于联系
搜索内容 / 工具 / 仓库 / 镜像...⌘K搜索
注册
博客列表
JavaScriptNode.jsAI

OpenClaw 集成 GitHub Copilot GPT-5.4 技术修复指南

综述由AI生成详细记录了在 OpenClaw 环境中使 GitHub Copilot GPT-5.4 模型正常工作的修复方案。主要问题包括模型配置不匹配、缺少 IDE 认证头、API 路由错误及网关不稳定。解决方案涉及修改 ~/.openclaw/openclaw.json 配置文件,将模型 API 设为 openai-responses,并在运行时补丁中注入 Copilot IDE 头部信息。同时需调整 OpenClaw 内部路由逻辑以支持 github-copilot provider 的 Responses 传输。修复后需重启网关并验证连接稳定性。

静心发布于 2026/4/6更新于 2026/6/335 浏览

OpenClaw + GitHub Copilot GPT-5.4 Technical Fix Guide

Overview

This guide documents how to make github-copilot/gpt-5.4 work inside OpenClaw when the model already works in OpenCode but fails in OpenClaw.

The final solution requires both:

  1. A config fix in ~/.openclaw/openclaw.json
  2. A runtime patch in the installed OpenClaw bundle

This is necessary because the problem is not only model registration. It is also an OpenClaw transport-routing issue for GitHub Copilot Responses API traffic.

Symptoms

The following errors may appear during debugging:

Symptom 1: Model Rejected
github-copilot/gpt-5.4 ... not allowed 
Symptom 2: IDE Auth Header Missing
HTTP 400: bad request: missing Editor-Version header for IDE auth 
Symptom 3: Unsupported Provider Mode
No API provider registered for api: github-copilot 
Symptom 4: Wrong Endpoint
HTTP 400: model "gpt-5.4" is not accessible via the /chat/completions endpoint 
Symptom 5: Gateway Instability
gateway disconnected: closed | idle 

Root Cause Analysis

There are four distinct problems.

1. Model Config and Allowlist Mismatch

OpenClaw could see the provider, but github-copilot/gpt-5.4 was not fully wired into the active model config path used by the agent defaults.

2. Missing GitHub Copilot IDE Headers

GitHub Copilot requires IDE-style headers for auth. OpenClaw was sending requests through a generic OpenAI-compatible path, so required headers were not included.

Required headers:

{
  "User-Agent": "GitHubCopilotChat/0.35.0",
  "Editor-Version": "vscode/1.107.0",
  "Editor-Plugin-Version": "copilot-chat/0.35.0",
  "Copilot-Integration-Id": "vscode-chat"
}

Without them, Copilot returns:

missing Editor-Version header for IDE auth 
3. GPT-5.4 Is Not a Chat Completions Model

gpt-5.4 must use the Responses API, not /chat/completions.

So this is wrong for gpt-5.4:

"api":"openai-completions"

This is required instead:

"api":"openai-responses"
4. OpenClaw Transport Routing Only Handled openai, Not github-copilot

Even after changing gpt-5.4 to openai-responses, OpenClaw still fell back to the generic stream path because its embedded runner only activated the Responses transport for provider openai.

That caused OpenClaw to keep hitting /chat/completions for GitHub Copilot GPT-5.4.

Files Involved

Config File

~/.openclaw/openclaw.json

Installed OpenClaw Runtime Bundle

/home/water/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/dist/reply-DhtejUNZ.js

Reapply Script

~/.openclaw/workspace/ken-patchs/reapply-openclaw-copilot-gpt54-patches.mjs

Step 1: Fix the OpenClaw Config

Update the GitHub Copilot provider block in ~/.openclaw/openclaw.json.

Provider-level Requirements

Use:

{
  "baseUrl":"https://api.individual.githubcopilot.com",
  "api":"openai-completions"
}

Why keep provider API as openai-completions?

  • OpenClaw runtime expects the provider to stay on a supported generic adapter path
  • Switching the entire provider to github-copilot caused runtime/provider registration failures
Model-level Requirements for GPT-5.4

Set the gpt-5.4 model entry to:

{"id":"gpt-5.4","name":"GPT-5.4","api":"openai-responses","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":64000}
Agent Model Registration

Make sure this exists:

"agents":{"defaults":{"models":{"github-copilot/gpt-5.4":{}}}}

Step 2: Patch OpenClaw to Inject Copilot IDE Headers

OpenClaw needs to attach Copilot IDE headers before sending provider requests.

In /home/water/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/dist/reply-DhtejUNZ.js, add a wrapper like this near the other provider wrappers:

const GITHUB_COPILOT_IDE_HEADERS = {
  "User-Agent": "GitHubCopilotChat/0.35.0",
  "Editor-Version": "vscode/1.107.0",
  "Editor-Plugin-Version": "copilot-chat/0.35.0",
  "Copilot-Integration-Id": "vscode-chat"
};
function createGitHubCopilotHeadersWrapper(baseStreamFn) {
  const underlying = baseStreamFn ?? streamSimple;
  return (model, context, options) => {
    return underlying(model, context, {
      ...options,
      headers: { ...GITHUB_COPILOT_IDE_HEADERS, ...options?.headers }
    });
  };
}

Then apply it inside the provider wrapper logic:

if(provider === "github-copilot") agent.streamFn = createGitHubCopilotHeadersWrapper(agent.streamFn);

Step 3: Patch OpenClaw to Route GitHub Copilot Responses Correctly

Find the branch that decides which stream transport to use.

Original behavior:

} else if(params.model.api === "openai-responses" && params.provider === "openai") {

Replace it with:

} else if(params.model.api === "openai-responses" && (params.provider === "openai" || params.provider === "github-copilot")) {

Why this matters:

  • Before the patch, github-copilot never entered the Responses transport branch
  • OpenClaw fell back to streamSimple
  • streamSimple hit /chat/completions
  • GPT-5.4 rejected that endpoint

After this patch:

  • github-copilot + openai-responses uses the correct Responses transport
  • GPT-5.4 no longer falls back to Chat Completions

Step 4: Validate and Restart

Validate Config JSON
node -e "JSON.parse(require('fs').readFileSync('/home/water/.openclaw/openclaw.json','utf8')); console.log('OK')"
Validate Patched Bundle Syntax
node --check "/home/water/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/dist/reply-DhtejUNZ.js"
Restart Gateway
openclaw gateway restart 

Verification Procedure

  1. Set the model to github-copilot/gpt-5.4
  2. Send a simple prompt like hi
  3. Confirm the gateway stays connected
  4. Confirm none of these errors return:
missing Editor-Version header for IDE auth 
model "gpt-5.4" is not accessible via the /chat/completions endpoint 
No API provider registered for api: github-copilot 

Reapply After OpenClaw Updates

Because the runtime fix patches the installed OpenClaw bundle, upgrades or reinstalls may overwrite it.

Use the reapply script:

node ~/.openclaw/workspace/ken-patchs/reapply-openclaw-copilot-gpt54-patches.mjs openclaw gateway restart 

Design Notes

Why Not Switch the Whole Provider to api: "github-copilot"?

That looked tempting, but OpenClaw's runtime path did not have a compatible registered streaming provider for that mode in this setup, which caused runtime/provider registration failures.

Why Not Keep GPT-5.4 on openai-completions?

Because GitHub Copilot GPT-5.4 is not accessible on /chat/completions. It must go through the Responses API.

Why Did OpenCode Work Earlier?

OpenCode already handled the GitHub Copilot transport path correctly, including the required Copilot headers and the proper API mode, while OpenClaw needed both config and runtime fixes.

Recommended Maintenance Notes

  • Keep this guide with the reapply script path documented nearby
  • After any OpenClaw upgrade, rerun the patch script
  • If OpenClaw changes its bundle file name, update the script path target accordingly
  • If GitHub Copilot changes required IDE header versions, update both the runtime patch and reapply script

Quick Recovery Commands

node ~/.openclaw/workspace/ken-patchs/reapply-openclaw-copilot-gpt54-patches.mjs openclaw gateway restart openclaw status 

Final State

With the config fix and runtime patches in place, github-copilot/gpt-5.4 works in OpenClaw and the gateway remains stable.

目录

  1. OpenClaw + GitHub Copilot GPT-5.4 Technical Fix Guide
  2. Overview
  3. Symptoms
  4. Symptom 1: Model Rejected
  5. Symptom 2: IDE Auth Header Missing
  6. Symptom 3: Unsupported Provider Mode
  7. Symptom 4: Wrong Endpoint
  8. Symptom 5: Gateway Instability
  9. Root Cause Analysis
  10. 1. Model Config and Allowlist Mismatch
  11. 2. Missing GitHub Copilot IDE Headers
  12. 3. GPT-5.4 Is Not a Chat Completions Model
  13. 4. OpenClaw Transport Routing Only Handled openai, Not github-copilot
  14. Files Involved
  15. Config File
  16. Installed OpenClaw Runtime Bundle
  17. Reapply Script
  18. Step 1: Fix the OpenClaw Config
  19. Provider-level Requirements
  20. Model-level Requirements for GPT-5.4
  21. Agent Model Registration
  22. Step 2: Patch OpenClaw to Inject Copilot IDE Headers
  23. Step 3: Patch OpenClaw to Route GitHub Copilot Responses Correctly
  24. Step 4: Validate and Restart
  25. Validate Config JSON
  26. Validate Patched Bundle Syntax
  27. Restart Gateway
  28. Verification Procedure
  29. Reapply After OpenClaw Updates
  30. Design Notes
  31. Why Not Switch the Whole Provider to api: "github-copilot"?
  32. Why Not Keep GPT-5.4 on openai-completions?
  33. Why Did OpenCode Work Earlier?
  34. Recommended Maintenance Notes
  35. Quick Recovery Commands
  36. Final State
  • 💰 8折买阿里云服务器限时8折了解详情
  • Magick API 一键接入全球大模型注册送1000万token查看
  • 🤖 一键搭建Deepseek满血版了解详情
  • 一键打造专属AI 智能体了解详情
极客日志微信公众号二维码

微信扫一扫,关注极客日志

微信公众号「极客日志V2」,在微信中扫描左侧二维码关注。展示文案:极客日志V2 zeeklog

更多推荐文章

查看全部
  • 医疗 AI 场景下的 k-均值算法深度解析与实战
  • 错误定位 Prompt:利用大模型快速解析异常堆栈
  • Git 和 GitHub 零基础入门指南
  • AI 零基础入门与实践完全指南
  • 国产数据库新机遇:电科金仓融合技术与 AI 化演进
  • Home Assistant 插件下载加速:HACS 极速版部署与配置
  • Manus vs OpenClaw:云端托管与开源本地化架构原理对比
  • 基于 FPGA 的北斗导航自适应抗干扰算法设计与实现
  • Python PyQt5 安装与配置及界面设计教程
  • 【论文阅读】Vision-skeleton dual-modality framework for generalizable assessment of Parkinson’s disease ga
  • Android 离线语音识别实践:基于 Whisper 与 TensorFlow Lite 实现本地转录
  • 一次线上 OOM 问题的排查与复盘
  • C# 字符串分割转换为整数数组或列表
  • Python 基础考试题库与解析
  • Python 基础语法入门:常量、变量与运算符
  • JDK 下载安装及环境变量配置指南
  • VS Code + Continue 集成 DeepSeek 配置指南
  • C++ explicit 关键字详解:作用、原因与使用
  • 2G 内存云服务器部署 Spring Boot + MySQL 实战
  • Visual C++运行库 AIO 一键部署方案

相关免费在线工具

  • RSA密钥对生成器

    生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online

  • Mermaid 预览与可视化编辑

    基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online

  • 随机西班牙地址生成器

    随机生成西班牙地址(支持马德里、加泰罗尼亚、安达卢西亚、瓦伦西亚筛选),支持数量快捷选择、显示全部与下载。 在线工具,随机西班牙地址生成器在线工具,online

  • Keycode 信息

    查找任何按下的键的javascript键代码、代码、位置和修饰符。 在线工具,Keycode 信息在线工具,online

  • Escape 与 Native 编解码

    JavaScript 字符串转义/反转义;Java 风格 \uXXXX(Native2Ascii)编码与解码。 在线工具,Escape 与 Native 编解码在线工具,online

  • JavaScript / HTML 格式化

    使用 Prettier 在浏览器内格式化 JavaScript 或 HTML 片段。 在线工具,JavaScript / HTML 格式化在线工具,online