@askalf/dario 2.4.0 → 2.4.2

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  <p align="center">
2
2
  <h1 align="center">dario</h1>
3
- <p align="center"><strong>Use your Claude subscription as an API.</strong></p>
3
+ <p align="center"><strong>Use your Claude subscription as an API. The only proxy that bills correctly.</strong></p>
4
4
  <p align="center">
5
- No API key needed. Your Claude Max/Pro subscription becomes a local API endpoint<br/>that any tool, SDK, or framework can use.
5
+ No API key needed. Your Claude Max/Pro subscription becomes a local API endpoint<br/>that any tool, SDK, or framework can use — with native billing classification,<br/>so your Max plan limits actually work.
6
6
  </p>
7
7
  </p>
8
8
 
@@ -66,6 +66,37 @@ Opus, Sonnet, Haiku — all models, streaming, tool use. Works with Cursor, Cont
66
66
 
67
67
  ---
68
68
 
69
+ ## Why dario
70
+
71
+ Most Claude subscription proxies have a critical billing problem: **Anthropic classifies their requests as third-party and routes all usage to Extra Usage billing** — even when you have Max plan limits available. You're paying for your subscription twice.
72
+
73
+ dario is the only proxy that solves this. It injects native Claude Code device identity (`metadata.user_id`) into every request, so Anthropic's billing system treats your requests exactly like Claude Code itself. Your Max plan limits work correctly.
74
+
75
+ | | dario | Other proxies |
76
+ |---|---|---|
77
+ | **Billing classification** | Native Claude Code session | Third-party (Extra Usage) |
78
+ | **Max plan limits** | Used correctly | Bypassed — billed separately |
79
+ | **Device identity** | Injected automatically | Missing |
80
+ | **Beta flags** | Match Claude Code v2.1.98 | Outdated or missing |
81
+ | **Billable beta filtering** | Strips surprise charges | Passes everything through |
82
+
83
+ <details>
84
+ <summary><strong>vs competitors</strong></summary>
85
+
86
+ | Feature | dario | Meridian (710 stars) | CLIProxyAPI (24K stars) | claude-code-mux |
87
+ |---------|-------|---------|------------|-----------------|
88
+ | Native billing classification | **Yes** | No | Inherited (CLI-only) | No |
89
+ | Direct OAuth (streaming, tools) | **Yes** | Yes (SDK-based) | No | No |
90
+ | CLI fallback (rate limit bypass) | **Yes** | No | Yes (only mode) | No |
91
+ | OpenAI API compat | **Yes** | Yes | Yes | Yes |
92
+ | Orchestration sanitization | **Yes** | Yes | No | No |
93
+ | Token anomaly detection | **Yes** | Yes | No | No |
94
+ | Codebase size | ~1,200 lines | ~9,000 lines | Platform | Rust binary |
95
+ | Dependencies | 1 | Many | Many | Compiled |
96
+ | Setup | 2 commands | Config + build | Config + dashboard | Config |
97
+
98
+ </details>
99
+
69
100
  ## The Problem
70
101
 
71
102
  You pay $100-200/mo for Claude Max or Pro. But that subscription only works on claude.ai and Claude Code. If you want to use Claude with **any other tool** — Cursor, Continue, Aider, your own scripts — you need a separate API key with separate billing.
@@ -349,13 +380,17 @@ Then run `hermes` normally — it routes through dario using your Claude subscri
349
380
  ## Supported Features
350
381
 
351
382
  ### Direct API Mode
352
- - All Claude models (Opus 4.6, Sonnet 4.6, Haiku 4.5)
383
+ - All Claude models (Opus 4.6, Sonnet 4.6, Haiku 4.5) + 1M extended context aliases (`opus1m`, `sonnet1m`)
384
+ - **Native billing classification** — device identity metadata ensures Max plan limits work correctly
353
385
  - **OpenAI-compatible** (`/v1/chat/completions`) — works with any OpenAI SDK or tool
354
- - Streaming and non-streaming (both Anthropic and OpenAI SSE formats)
386
+ - Streaming and non-streaming (both Anthropic and OpenAI SSE formats, including tool_use streaming)
355
387
  - Tool use / function calling
356
388
  - System prompts and multi-turn conversations
357
389
  - Prompt caching and extended thinking
358
- - All `anthropic-beta` features (headers pass through)
390
+ - **Billable beta filtering** — strips `extended-cache-ttl`, `context-management`, `prompt-caching-scope` from client betas to prevent surprise Extra Usage charges
391
+ - **Orchestration tag sanitization** — strips agent-injected XML (`<system-reminder>`, `<env>`, `<task_metadata>`, etc.) before forwarding
392
+ - **Token anomaly detection** — warns on context spike (>60% input growth) or output explosion (>2x previous)
393
+ - Concurrency control (max 10 concurrent upstream requests)
359
394
  - CORS enabled (works from browser apps on localhost)
360
395
 
361
396
  ### CLI Backend Mode
@@ -458,7 +493,7 @@ Dario handles your OAuth tokens. Here's why you can trust it:
458
493
 
459
494
  | Signal | Status |
460
495
  |--------|--------|
461
- | **Source code** | ~1100 lines of TypeScript — small enough to read in one sitting |
496
+ | **Source code** | ~1,300 lines of TypeScript — small enough to audit in one sitting |
462
497
  | **Dependencies** | 1 production dep (`@anthropic-ai/sdk`). Verify: `npm ls --production` |
463
498
  | **npm provenance** | Every release is [SLSA attested](https://www.npmjs.com/package/@askalf/dario) via GitHub Actions |
464
499
  | **Security scanning** | [CodeQL](https://github.com/askalf/dario/actions/workflows/codeql.yml) runs on every push and weekly |
@@ -480,7 +515,7 @@ cd $(npm root -g)/@askalf/dario && npm ls --production
480
515
 
481
516
  ## Contributing
482
517
 
483
- PRs welcome. The codebase is ~1100 lines of TypeScript across 4 files:
518
+ PRs welcome. The codebase is ~1,300 lines of TypeScript across 4 files:
484
519
 
485
520
  | File | Purpose |
486
521
  |------|---------|
package/dist/proxy.js CHANGED
@@ -571,11 +571,11 @@ export async function startProxy(opts = {}) {
571
571
  const modelInfo = modelOverride ? ` (model: ${modelOverride})` : '';
572
572
  console.log(`[dario] #${requestCount} ${req.method} ${urlPath}${modelInfo}`);
573
573
  }
574
- // Beta flags matching native Claude Code v2.1.98.
575
- // context-management and prompt-caching-scope are safe when metadata.user_id
576
- // is present billing classification depends on device identity, not betas.
574
+ // Conservative beta defaults only betas confirmed safe for Max plans.
575
+ // context-management and prompt-caching-scope stripped: even with metadata.user_id,
576
+ // these may independently trigger Extra Usage billing (reported by @belangertrading).
577
577
  const clientBeta = req.headers['anthropic-beta'];
578
- let beta = 'oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,claude-code-20250219,advisor-tool-2026-03-01';
578
+ let beta = 'oauth-2025-04-20,interleaved-thinking-2025-05-14,claude-code-20250219,advisor-tool-2026-03-01';
579
579
  if (clientBeta) {
580
580
  const filtered = filterBillableBetas(clientBeta);
581
581
  if (filtered)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Use your Claude subscription as an API. No API key needed. Local proxy for Claude Max/Pro subscriptions.",
5
5
  "type": "module",
6
6
  "bin": {