@simonyea/holysheep-cli 1.7.91 → 1.7.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/tools/codex.js +13 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.93",
|
|
4
4
|
"description": "Claude Code/Cursor/Cline API relay for China — ¥1=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openai-china",
|
package/src/tools/codex.js
CHANGED
|
@@ -12,11 +12,13 @@
|
|
|
12
12
|
* [model_providers.holysheep]
|
|
13
13
|
* name = "HolySheep"
|
|
14
14
|
* base_url = "https://api.holysheep.ai/v1"
|
|
15
|
-
* api_key = "cr_xxx"
|
|
16
15
|
* wire_api = "responses"
|
|
17
16
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* [model_providers.holysheep.http_headers]
|
|
18
|
+
* Authorization = "Bearer cr_xxx"
|
|
19
|
+
*
|
|
20
|
+
* 注意:Codex RS 不支持 api_key 字段,env_key 需要环境变量(Windows 需重启终端)。
|
|
21
|
+
* 改用 http_headers 直接设置 Authorization header,配置即生效。
|
|
20
22
|
*/
|
|
21
23
|
const fs = require('fs')
|
|
22
24
|
const path = require('path')
|
|
@@ -48,7 +50,8 @@ function stripManagedTomlConfig(content) {
|
|
|
48
50
|
const trimmed = line.trim()
|
|
49
51
|
|
|
50
52
|
if (/^\[[^\]]+\]$/.test(trimmed)) {
|
|
51
|
-
if (trimmed === '[model_providers.holysheep]'
|
|
53
|
+
if (trimmed === '[model_providers.holysheep]' ||
|
|
54
|
+
trimmed === '[model_providers.holysheep.http_headers]') {
|
|
52
55
|
currentSection = trimmed
|
|
53
56
|
skipHolySheepBlock = true
|
|
54
57
|
continue
|
|
@@ -104,6 +107,7 @@ function writeTomlConfig(apiKey, baseUrlOpenAI, model) {
|
|
|
104
107
|
const content = stripManagedTomlConfig(readTomlConfig())
|
|
105
108
|
|
|
106
109
|
// 在开头插入 holysheep 配置
|
|
110
|
+
// 使用 http_headers 直接设置 Authorization,不依赖环境变量
|
|
107
111
|
const newConfig = [
|
|
108
112
|
`model = "${model || 'gpt-5.4'}"`,
|
|
109
113
|
`model_provider = "holysheep"`,
|
|
@@ -113,9 +117,11 @@ function writeTomlConfig(apiKey, baseUrlOpenAI, model) {
|
|
|
113
117
|
`[model_providers.holysheep]`,
|
|
114
118
|
`name = "HolySheep"`,
|
|
115
119
|
`base_url = "${baseUrlOpenAI}"`,
|
|
116
|
-
`api_key = "${apiKey}"`,
|
|
117
120
|
`wire_api = "responses"`,
|
|
118
121
|
'',
|
|
122
|
+
`[model_providers.holysheep.http_headers]`,
|
|
123
|
+
`Authorization = "Bearer ${apiKey}"`,
|
|
124
|
+
'',
|
|
119
125
|
].join('\n')
|
|
120
126
|
|
|
121
127
|
fs.writeFileSync(CONFIG_FILE, cleanupToml(newConfig) + '\n', 'utf8')
|
|
@@ -185,15 +191,13 @@ module.exports = {
|
|
|
185
191
|
const model = 'gpt-5.4'
|
|
186
192
|
|
|
187
193
|
// 写入 TOML(Rust Codex v0.111+ 使用)
|
|
194
|
+
// Codex RS 不支持 api_key 字段,必须用 env_key 指向环境变量
|
|
188
195
|
writeTomlConfig(apiKey, baseUrlOpenAI, model)
|
|
189
196
|
|
|
190
197
|
// 同时写 JSON(兼容旧版 TypeScript Codex)
|
|
191
198
|
writeJsonConfigIfNeeded(apiKey, baseUrlOpenAI, model)
|
|
192
199
|
|
|
193
|
-
// 清除 auth.json 中的 ChatGPT OAuth
|
|
194
|
-
// Codex RS 在 auth_mode=chatgpt 时会用 OAuth JWT token 做 Authorization header,
|
|
195
|
-
// 即使 config.toml 里设置了自定义 model_provider 的 api_key 也会被覆盖,
|
|
196
|
-
// 导致 holysheep 收到非 cr_ 前缀的 token 返回 401。
|
|
200
|
+
// 清除 auth.json 中的 ChatGPT OAuth 认证,避免干扰
|
|
197
201
|
neutralizeAuthJson()
|
|
198
202
|
|
|
199
203
|
return {
|