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.
档记录了在 OpenClaw 中配置和修复 GitHub Copilot GPT-5.4 模型的技术方案。主要问题包括模型拒绝、缺少 IDE 认证头、API 路由错误以及网关不稳定。根本原因在于模型配置未完全接入、缺少 Copilot 专用 IDE 头信息、GPT-5.4 需使用 Responses API 而非 Chat Completions,以及 OpenClaw 传输层未正确支持 github-copilot 提供商。解决方案涉及更新 openclaw.json 配置文件以设置正确的 API 类型和模型注册,修改运行时 Bundle 文件以注入 IDE 头并修正路由逻辑,最后重启网关验证。升级后需重新应用补丁脚本以确保功能正常。
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:
~/.openclaw/openclaw.jsonThis is necessary because the problem is not only model registration. It is also an OpenClaw transport-routing issue for GitHub Copilot Responses API traffic.
The following errors may appear during debugging:
github-copilot/gpt-5.4 ... not allowed
HTTP 400: bad request: missing Editor-Version header for IDE auth
No API provider registered for api: github-copilot
HTTP 400: model "gpt-5.4" is not accessible via the /chat/completions endpoint
gateway disconnected: closed | idle
There are four distinct problems.
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.
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
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"
openai, not github-copilotEven 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.
~/.openclaw/openclaw.json
~/node_modules/openclaw/dist/reply-DhtejUNZ.js
~/.openclaw/workspace/ken-patchs/reapply-openclaw-copilot-gpt54-patches.mjs
Update the GitHub Copilot provider block in ~/.openclaw/openclaw.json.
Use:
{
"baseUrl": "https://api.individual.githubcopilot.com",
"api": "openai-completions"
}
Why keep provider API as openai-completions?
github-copilot caused runtime/provider registration failuresSet 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}
Make sure this exists:
"agents":{"defaults":{"models":{"github-copilot/gpt-5.4":{}}}}
OpenClaw needs to attach Copilot IDE headers before sending provider requests.
In ~/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);
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:
github-copilot never entered the Responses transport branchstreamSimplestreamSimple hit /chat/completionsAfter this patch:
github-copilot + openai-responses uses the correct Responses transportnode -e "JSON.parse(require('fs').readFileSync('~/node_modules/openclaw/dist/reply-DhtejUNZ.js', 'utf8')); console.log('OK')"
Note: Adjust the file path based on your actual installation.
node --check "~/node_modules/openclaw/dist/reply-DhtejUNZ.js"
openclaw gateway restart
github-copilot/gpt-5.4himissing 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
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
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.
openai-completions?Because GitHub Copilot GPT-5.4 is not accessible on /chat/completions. It must go through the Responses API.
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.
node ~/.openclaw/workspace/ken-patchs/reapply-openclaw-copilot-gpt54-patches.mjs openclaw gateway restart openclaw status
With the config fix and runtime patches in place, github-copilot/gpt-5.4 works in OpenClaw and the gateway remains stable.

微信公众号「极客日志」,在微信中扫描左侧二维码关注。展示文案:极客日志 zeeklog
生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online
基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online
查找任何按下的键的javascript键代码、代码、位置和修饰符。 在线工具,Keycode 信息在线工具,online
JavaScript 字符串转义/反转义;Java 风格 \uXXXX(Native2Ascii)编码与解码。 在线工具,Escape 与 Native 编解码在线工具,online
使用 Prettier 在浏览器内格式化 JavaScript 或 HTML 片段。 在线工具,JavaScript / HTML 格式化在线工具,online
Terser 压缩、变量名混淆,或 javascript-obfuscator 高强度混淆(体积会增大)。 在线工具,JavaScript 压缩与混淆在线工具,online