@goodandready/dsh-subscriptions 0.4.16 → 0.4.18
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/README.md +47 -0
- package/README.ru.md +23 -0
- package/README.zh.md +14 -0
- package/lib/accounts.js +14 -2
- package/lib/adapter.js +25 -6
- package/lib/client.js +616 -13
- package/lib/forecast.js +71 -0
- package/lib/index.js +142 -3
- package/lib/messages.js +8 -1
- package/lib/ollama.js +70 -0
- package/lib/reset-credits.js +193 -0
- package/lib/rotate.js +28 -3
- package/lib/stream-rotate.js +4 -3
- package/lib/subscriptions.js +4 -4
- package/lib/vendors/codex.js +1 -1
- package/lib/vendors/grok.js +2 -0
- package/package.json +4 -1
package/lib/subscriptions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isProvider } from "./refs.js"
|
|
2
|
-
import { pickAccount, markCooldown, isSwitchableError } from "./rotate.js"
|
|
2
|
+
import { pickAccount, markCooldown, isSwitchableError, modelFamily } from "./rotate.js"
|
|
3
3
|
import { quotaSnapshot } from "./ratelimit.js"
|
|
4
4
|
import { getVendor } from "./vendors/index.js"
|
|
5
5
|
import { pickFetch } from "./proxy.js"
|
|
@@ -92,7 +92,7 @@ export function createSubscriptionsService(deps) {
|
|
|
92
92
|
const tried = new Set()
|
|
93
93
|
let lastError = null
|
|
94
94
|
while (true) {
|
|
95
|
-
const account = pickAccount(pool, Date.now(), { switchAtRemaining: thr })
|
|
95
|
+
const account = pickAccount(pool, Date.now(), { switchAtRemaining: thr, family: modelFamily(provider, body && body.model) })
|
|
96
96
|
if (!account) {
|
|
97
97
|
if (lastError) throw lastError
|
|
98
98
|
const err = new Error("no usable subscription account for this provider")
|
|
@@ -180,9 +180,9 @@ export function createSubscriptionsService(deps) {
|
|
|
180
180
|
} catch (err) {
|
|
181
181
|
lastError = err
|
|
182
182
|
if (!isSwitchableError(err)) throw err
|
|
183
|
-
const cooled = markCooldown(account, Date.now(), cooldownMs)
|
|
183
|
+
const cooled = markCooldown(account, Date.now(), cooldownMs, modelFamily(provider, body && body.model))
|
|
184
184
|
account.cooldownUntil = cooled.cooldownUntil
|
|
185
|
-
if (typeof deps.rememberCooldown === "function") deps.rememberCooldown(account.ref, account.cooldownUntil)
|
|
185
|
+
if (typeof deps.rememberCooldown === "function") deps.rememberCooldown(account.ref, account.cooldownUntil, cooled.cooldownFamilies || null)
|
|
186
186
|
// try next account
|
|
187
187
|
}
|
|
188
188
|
}
|
package/lib/vendors/codex.js
CHANGED
|
@@ -205,7 +205,7 @@ export async function usage(blob, cfg, fetchImpl) {
|
|
|
205
205
|
|
|
206
206
|
export async function* streamOnce({ blob, options, fetchImpl, headers, config, signal }) {
|
|
207
207
|
const base = (config.baseUrl || defaults().baseUrl).replace(/\/$/, '')
|
|
208
|
-
const body = codexResponsesBody(options, INSTRUCTIONS)
|
|
208
|
+
const body = codexResponsesBody(options, INSTRUCTIONS, config)
|
|
209
209
|
const res = await fetchImpl(`${base}/responses`, {
|
|
210
210
|
method: 'POST',
|
|
211
211
|
headers: {
|
package/lib/vendors/grok.js
CHANGED
|
@@ -213,6 +213,8 @@ export async function* streamOnce({ blob, options, fetchImpl, headers, config, s
|
|
|
213
213
|
const base = (config.baseUrl || defaults().baseUrl).replace(/\/$/, '')
|
|
214
214
|
let body = codexResponsesBody(options, '')
|
|
215
215
|
if (!body.instructions) delete body.instructions
|
|
216
|
+
// grok manages reasoning itself (cli catalog aware); drop the codex-level field
|
|
217
|
+
delete body.reasoning
|
|
216
218
|
const catalog = await cliCatalogCached(blob, config, fetchImpl).catch(() => new Map())
|
|
217
219
|
const reasoning = grokReasoningBody(options.model, options.reasoningEffort, catalog)
|
|
218
220
|
if (reasoning) body.reasoning = reasoning
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-subscriptions",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.18",
|
|
4
4
|
"description": "Use ChatGPT Codex, Claude, Grok, and Antigravity subscriptions as DeepSeek Harness LLM providers via OAuth.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -63,5 +63,8 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"socks": "^2.8.9",
|
|
65
65
|
"undici": "^8.10.1"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@deepseek-ai/dsh-llm": "0.1.0-rc.8"
|
|
66
69
|
}
|
|
67
70
|
}
|