@askalf/dario 4.8.52 → 4.8.54
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 +1 -1
- package/dist/proxy.d.ts +39 -9
- package/dist/proxy.js +42 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -179,7 +179,7 @@ You point every tool at one URL. dario reads each request, decides which backend
|
|
|
179
179
|
|
|
180
180
|
| Client speaks | Model | Routes to | What happens |
|
|
181
181
|
|---|---|---|---|
|
|
182
|
-
| Anthropic Messages | `claude-*` / `opus` / `sonnet` / `haiku` | Claude backend | OAuth swap + CC template replay → `api.anthropic.com` |
|
|
182
|
+
| Anthropic Messages | `claude-*` / `fable` / `opus` / `sonnet` / `haiku` | Claude backend | OAuth swap + CC template replay → `api.anthropic.com` |
|
|
183
183
|
| Anthropic Messages | `gpt-*`, `llama-*`, … | OpenAI-compat backend | Anthropic→OpenAI translation, forwarded |
|
|
184
184
|
| OpenAI Chat | `gpt-*` / `o1-*` / `o3-*` | OpenAI-compat backend | Auth swap, body forwarded byte-for-byte |
|
|
185
185
|
| OpenAI Chat | `claude-*` | Claude backend | OpenAI→Anthropic translation, then Claude path |
|
package/dist/proxy.d.ts
CHANGED
|
@@ -29,17 +29,38 @@ export declare function parseProviderPrefix(model: string): {
|
|
|
29
29
|
*/
|
|
30
30
|
export declare const FABLE_FALLBACK_CREDIT_BETA = "fallback-credit-2026-06-01";
|
|
31
31
|
export declare const CONTEXT_1M_BETA = "context-1m-2025-08-07";
|
|
32
|
+
export declare const MID_CONVERSATION_SYSTEM_BETA = "mid-conversation-system-2026-04-07";
|
|
33
|
+
export declare const EFFORT_BETA = "effort-2025-11-24";
|
|
32
34
|
/**
|
|
33
35
|
* Model-conditional beta flags, mirroring real CC (live captures
|
|
34
|
-
* 2026-06-09, CC v2.1.170 —
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* -
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
36
|
+
* 2026-06-09, CC v2.1.170 — same binary/account, `--print -p hi`, identical
|
|
37
|
+
* request shape, deterministic across repeat trials):
|
|
38
|
+
*
|
|
39
|
+
* model betas effort-body notable beta set
|
|
40
|
+
* --------------- ----- ----------- ------------------------------------
|
|
41
|
+
* claude-opus-4-8 9 xhigh baked base (all flags)
|
|
42
|
+
* claude-sonnet-4-6 8 high base − mid-conversation-system
|
|
43
|
+
* claude-haiku-4-5 6 (none) base − mid-conversation-system − effort
|
|
44
|
+
*
|
|
45
|
+
* APPENDS (CC adds for these families):
|
|
46
|
+
* - `fallback-credit-2026-06-01` rides on FABLE requests only (without it,
|
|
47
|
+
* subscription fable traffic is soft-refused upstream).
|
|
48
|
+
* - `context-1m-2025-08-07` rides on `[1m]`-labelled requests only (CC does
|
|
49
|
+
* NOT send it for plain models). `skipContext1m` (dario#36) suppresses the
|
|
50
|
+
* [1m] append when the account's long-context billing was rejected.
|
|
51
|
+
*
|
|
52
|
+
* OMISSIONS (CC drops for these families; the baked base is opus's full set):
|
|
53
|
+
* - `mid-conversation-system-2026-04-07` — sonnet + haiku omit it. All three
|
|
54
|
+
* models still send the SAME 3 system blocks, so this is a capability
|
|
55
|
+
* advertisement, not load-bearing for the system shape — safe to drop.
|
|
56
|
+
* - `effort-2025-11-24` — haiku omits it (and sends no `output_config.effort`
|
|
57
|
+
* body field either; dario already strips that field for haiku, so dropping
|
|
58
|
+
* the beta just restores consistency).
|
|
59
|
+
*
|
|
60
|
+
* Removing a beta can never provoke an upstream 400 (the runtime rejection
|
|
61
|
+
* cache only ever needs to ADD strips), so the omissions are strictly safe.
|
|
62
|
+
* Only the two families measured to omit them are touched; opus / fable /
|
|
63
|
+
* unknown models keep the full baked set unchanged.
|
|
43
64
|
*/
|
|
44
65
|
export declare function betaForModel(base: string, model: string | null | undefined, skipContext1m?: boolean): string;
|
|
45
66
|
/**
|
|
@@ -90,6 +111,15 @@ export declare function buildOrchestrationPatterns(preserveTags?: Set<string>):
|
|
|
90
111
|
* opt any tag out of the scrub. dario#78.
|
|
91
112
|
*/
|
|
92
113
|
export declare function sanitizeMessages(body: Record<string, unknown>, preserveTags?: Set<string>): void;
|
|
114
|
+
export declare const OPENAI_MODELS_LIST: {
|
|
115
|
+
object: string;
|
|
116
|
+
data: {
|
|
117
|
+
id: string;
|
|
118
|
+
object: string;
|
|
119
|
+
created: number;
|
|
120
|
+
owned_by: string;
|
|
121
|
+
}[];
|
|
122
|
+
};
|
|
93
123
|
interface ProxyOptions {
|
|
94
124
|
port?: number;
|
|
95
125
|
host?: string;
|
package/dist/proxy.js
CHANGED
|
@@ -209,17 +209,38 @@ function filterBillableBetas(betas) {
|
|
|
209
209
|
*/
|
|
210
210
|
export const FABLE_FALLBACK_CREDIT_BETA = 'fallback-credit-2026-06-01';
|
|
211
211
|
export const CONTEXT_1M_BETA = 'context-1m-2025-08-07';
|
|
212
|
+
export const MID_CONVERSATION_SYSTEM_BETA = 'mid-conversation-system-2026-04-07';
|
|
213
|
+
export const EFFORT_BETA = 'effort-2025-11-24';
|
|
212
214
|
/**
|
|
213
215
|
* Model-conditional beta flags, mirroring real CC (live captures
|
|
214
|
-
* 2026-06-09, CC v2.1.170 —
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* -
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
216
|
+
* 2026-06-09, CC v2.1.170 — same binary/account, `--print -p hi`, identical
|
|
217
|
+
* request shape, deterministic across repeat trials):
|
|
218
|
+
*
|
|
219
|
+
* model betas effort-body notable beta set
|
|
220
|
+
* --------------- ----- ----------- ------------------------------------
|
|
221
|
+
* claude-opus-4-8 9 xhigh baked base (all flags)
|
|
222
|
+
* claude-sonnet-4-6 8 high base − mid-conversation-system
|
|
223
|
+
* claude-haiku-4-5 6 (none) base − mid-conversation-system − effort
|
|
224
|
+
*
|
|
225
|
+
* APPENDS (CC adds for these families):
|
|
226
|
+
* - `fallback-credit-2026-06-01` rides on FABLE requests only (without it,
|
|
227
|
+
* subscription fable traffic is soft-refused upstream).
|
|
228
|
+
* - `context-1m-2025-08-07` rides on `[1m]`-labelled requests only (CC does
|
|
229
|
+
* NOT send it for plain models). `skipContext1m` (dario#36) suppresses the
|
|
230
|
+
* [1m] append when the account's long-context billing was rejected.
|
|
231
|
+
*
|
|
232
|
+
* OMISSIONS (CC drops for these families; the baked base is opus's full set):
|
|
233
|
+
* - `mid-conversation-system-2026-04-07` — sonnet + haiku omit it. All three
|
|
234
|
+
* models still send the SAME 3 system blocks, so this is a capability
|
|
235
|
+
* advertisement, not load-bearing for the system shape — safe to drop.
|
|
236
|
+
* - `effort-2025-11-24` — haiku omits it (and sends no `output_config.effort`
|
|
237
|
+
* body field either; dario already strips that field for haiku, so dropping
|
|
238
|
+
* the beta just restores consistency).
|
|
239
|
+
*
|
|
240
|
+
* Removing a beta can never provoke an upstream 400 (the runtime rejection
|
|
241
|
+
* cache only ever needs to ADD strips), so the omissions are strictly safe.
|
|
242
|
+
* Only the two families measured to omit them are touched; opus / fable /
|
|
243
|
+
* unknown models keep the full baked set unchanged.
|
|
223
244
|
*/
|
|
224
245
|
export function betaForModel(base, model, skipContext1m = false) {
|
|
225
246
|
let beta = base;
|
|
@@ -233,6 +254,17 @@ export function betaForModel(base, model, skipContext1m = false) {
|
|
|
233
254
|
append(FABLE_FALLBACK_CREDIT_BETA);
|
|
234
255
|
if (/\[1m\]$/.test(m) && !skipContext1m)
|
|
235
256
|
append(CONTEXT_1M_BETA);
|
|
257
|
+
const drop = new Set();
|
|
258
|
+
if (m.includes('haiku')) {
|
|
259
|
+
drop.add(MID_CONVERSATION_SYSTEM_BETA);
|
|
260
|
+
drop.add(EFFORT_BETA);
|
|
261
|
+
}
|
|
262
|
+
else if (m.includes('sonnet')) {
|
|
263
|
+
drop.add(MID_CONVERSATION_SYSTEM_BETA);
|
|
264
|
+
}
|
|
265
|
+
if (drop.size > 0) {
|
|
266
|
+
beta = beta.split(',').filter((b) => !drop.has(b.trim())).join(',');
|
|
267
|
+
}
|
|
236
268
|
return beta;
|
|
237
269
|
}
|
|
238
270
|
/**
|
|
@@ -445,7 +477,7 @@ function translateStreamChunk(line) {
|
|
|
445
477
|
catch { }
|
|
446
478
|
return null;
|
|
447
479
|
}
|
|
448
|
-
const OPENAI_MODELS_LIST = { object: 'list', data: ['claude-fable-5', 'claude-fable-5[1m]', 'claude-opus-4-8', 'claude-opus-4-7', 'claude-opus-4-6', 'claude-sonnet-4-6', 'claude-haiku-4-5'].map(id => ({ id, object: 'model', created: 1700000000, owned_by: 'anthropic' })) };
|
|
480
|
+
export const OPENAI_MODELS_LIST = { object: 'list', data: ['claude-fable-5', 'claude-fable-5[1m]', 'claude-opus-4-8', 'claude-opus-4-7', 'claude-opus-4-6', 'claude-sonnet-4-6', 'claude-haiku-4-5'].map(id => ({ id, object: 'model', created: 1700000000, owned_by: 'anthropic' })) };
|
|
449
481
|
/**
|
|
450
482
|
* Append a JSON-ND line to the proxy log file. No-op when stream is
|
|
451
483
|
* null (logFile not configured). Errors are swallowed — log writes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askalf/dario",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.54",
|
|
4
4
|
"description": "Use your Claude Pro/Max subscription in any tool — Cursor, Cline, Aider, the Agent SDK, your scripts — at subscription pricing, not per-token API bills. One local Anthropic + OpenAI-compatible endpoint.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|