@rulvar/anthropic 1.8.0 → 1.10.0
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/dist/index.d.ts +14 -2
- package/dist/index.js +40 -21
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CanonicalId, ChatEvent, ChatRequest, FinishInfo, ModelCaps, ProviderAdapter, Usage, WireError } from "@rulvar/core";
|
|
1
|
+
import { CanonicalId, ChatEvent, ChatRequest, FinishInfo, ModelCaps, PriceTable, ProviderAdapter, Usage, WireError } from "@rulvar/core";
|
|
2
2
|
|
|
3
3
|
//#region src/caps.d.ts
|
|
4
4
|
interface AnthropicModelInfo {
|
|
@@ -24,6 +24,18 @@ declare const ANTHROPIC_MODELS: Record<string, AnthropicModelInfo>;
|
|
|
24
24
|
* CostReport.unpriced and a run ceiling warns that it cannot bound the
|
|
25
25
|
* model.
|
|
26
26
|
*/
|
|
27
|
+
/**
|
|
28
|
+
* The seed pricing rows as a versioned price table, keyed by full
|
|
29
|
+
* ModelRef under the adapter's fixed id 'anthropic'. Pass it to
|
|
30
|
+
* createEngine({ pricing }) so the run journals a concrete
|
|
31
|
+
* pricingVersion instead of 'unpriced': the versioned table wins over
|
|
32
|
+
* the caps fallback by rule, and a later table revision surfaces as
|
|
33
|
+
* explicit configuration drift on resume rather than a silent
|
|
34
|
+
* reinterpretation. Extend or override rows by spreading `models` into
|
|
35
|
+
* your own table with a new version string (the documented path for the
|
|
36
|
+
* Sonnet 5 promotion ending on 2026-08-31).
|
|
37
|
+
*/
|
|
38
|
+
declare const ANTHROPIC_PRICING: PriceTable;
|
|
27
39
|
declare function anthropicModelInfo(model: string): AnthropicModelInfo;
|
|
28
40
|
//#endregion
|
|
29
41
|
//#region src/adapter.d.ts
|
|
@@ -135,4 +147,4 @@ declare function mapAnthropicStream(stream: AsyncIterable<AnthropicStreamEvent>,
|
|
|
135
147
|
*/
|
|
136
148
|
declare function anthropicErrorToWire(error: unknown): WireError;
|
|
137
149
|
//#endregion
|
|
138
|
-
export { ANTHROPIC_MODELS, type AnthropicAdapterOptions, type AnthropicClientLike, type AnthropicModelInfo, type AnthropicStreamEvent, DEFAULT_PAUSE_TURN_MAX_CONTINUATIONS, IdMap, type TurnMapping, anthropic, anthropicErrorToWire, anthropicModelInfo, buildAnthropicParams, mapAnthropicStream, mapStopReason, normalizeAnthropicUsage };
|
|
150
|
+
export { ANTHROPIC_MODELS, ANTHROPIC_PRICING, type AnthropicAdapterOptions, type AnthropicClientLike, type AnthropicModelInfo, type AnthropicStreamEvent, DEFAULT_PAUSE_TURN_MAX_CONTINUATIONS, IdMap, type TurnMapping, anthropic, anthropicErrorToWire, anthropicModelInfo, buildAnthropicParams, mapAnthropicStream, mapStopReason, normalizeAnthropicUsage };
|
package/dist/index.js
CHANGED
|
@@ -31,28 +31,28 @@ function current(contextWindow, maxOutputTokens, pricing, cacheMinTokens) {
|
|
|
31
31
|
/** Static seed table naming the current model set. */
|
|
32
32
|
const ANTHROPIC_MODELS = {
|
|
33
33
|
"claude-fable-5": current(1e6, 128e3, {
|
|
34
|
-
in: 20,
|
|
35
|
-
out: 100,
|
|
36
|
-
cacheRead: 2,
|
|
37
|
-
cacheWrite: 25
|
|
38
|
-
}, 2048),
|
|
39
|
-
"claude-opus-4-8": current(4e5, 128e3, {
|
|
40
|
-
in: 12,
|
|
41
|
-
out: 60,
|
|
42
|
-
cacheRead: 1.2,
|
|
43
|
-
cacheWrite: 15
|
|
44
|
-
}, 4096),
|
|
45
|
-
"claude-opus-4-7": current(4e5, 64e3, {
|
|
46
34
|
in: 10,
|
|
47
35
|
out: 50,
|
|
48
36
|
cacheRead: 1,
|
|
49
37
|
cacheWrite: 12.5
|
|
38
|
+
}, 2048),
|
|
39
|
+
"claude-opus-4-8": current(4e5, 128e3, {
|
|
40
|
+
in: 5,
|
|
41
|
+
out: 25,
|
|
42
|
+
cacheRead: .5,
|
|
43
|
+
cacheWrite: 6.25
|
|
44
|
+
}, 4096),
|
|
45
|
+
"claude-opus-4-7": current(4e5, 64e3, {
|
|
46
|
+
in: 5,
|
|
47
|
+
out: 25,
|
|
48
|
+
cacheRead: .5,
|
|
49
|
+
cacheWrite: 6.25
|
|
50
50
|
}, 4096),
|
|
51
51
|
"claude-sonnet-5": current(4e5, 64e3, {
|
|
52
|
-
in:
|
|
53
|
-
out:
|
|
54
|
-
cacheRead: .
|
|
55
|
-
cacheWrite:
|
|
52
|
+
in: 2,
|
|
53
|
+
out: 10,
|
|
54
|
+
cacheRead: .2,
|
|
55
|
+
cacheWrite: 2.5
|
|
56
56
|
}, 2048),
|
|
57
57
|
"claude-haiku-4-5": (() => {
|
|
58
58
|
const base = current(2e5, 64e3, {
|
|
@@ -72,10 +72,10 @@ const ANTHROPIC_MODELS = {
|
|
|
72
72
|
})(),
|
|
73
73
|
"claude-opus-4-6": {
|
|
74
74
|
...current(2e5, 32e3, {
|
|
75
|
-
in:
|
|
76
|
-
out:
|
|
77
|
-
cacheRead:
|
|
78
|
-
cacheWrite:
|
|
75
|
+
in: 5,
|
|
76
|
+
out: 25,
|
|
77
|
+
cacheRead: .5,
|
|
78
|
+
cacheWrite: 6.25
|
|
79
79
|
}, 4096),
|
|
80
80
|
thinkingForm: "enabled-budget"
|
|
81
81
|
},
|
|
@@ -99,6 +99,25 @@ const ANTHROPIC_MODELS = {
|
|
|
99
99
|
* CostReport.unpriced and a run ceiling warns that it cannot bound the
|
|
100
100
|
* model.
|
|
101
101
|
*/
|
|
102
|
+
/**
|
|
103
|
+
* The seed pricing rows as a versioned price table, keyed by full
|
|
104
|
+
* ModelRef under the adapter's fixed id 'anthropic'. Pass it to
|
|
105
|
+
* createEngine({ pricing }) so the run journals a concrete
|
|
106
|
+
* pricingVersion instead of 'unpriced': the versioned table wins over
|
|
107
|
+
* the caps fallback by rule, and a later table revision surfaces as
|
|
108
|
+
* explicit configuration drift on resume rather than a silent
|
|
109
|
+
* reinterpretation. Extend or override rows by spreading `models` into
|
|
110
|
+
* your own table with a new version string (the documented path for the
|
|
111
|
+
* Sonnet 5 promotion ending on 2026-08-31).
|
|
112
|
+
*/
|
|
113
|
+
const ANTHROPIC_PRICING = {
|
|
114
|
+
pricingVersion: "anthropic-2026-07-16",
|
|
115
|
+
models: (() => {
|
|
116
|
+
const models = {};
|
|
117
|
+
for (const [name, info] of Object.entries(ANTHROPIC_MODELS)) if (info.caps.pricing !== void 0) models[`anthropic:${name}`] = info.caps.pricing;
|
|
118
|
+
return models;
|
|
119
|
+
})()
|
|
120
|
+
};
|
|
102
121
|
function anthropicModelInfo(model) {
|
|
103
122
|
const exact = ANTHROPIC_MODELS[model];
|
|
104
123
|
if (exact !== void 0) return exact;
|
|
@@ -778,4 +797,4 @@ function anthropic(options = {}) {
|
|
|
778
797
|
};
|
|
779
798
|
}
|
|
780
799
|
//#endregion
|
|
781
|
-
export { ANTHROPIC_MODELS, DEFAULT_PAUSE_TURN_MAX_CONTINUATIONS, IdMap, anthropic, anthropicErrorToWire, anthropicModelInfo, buildAnthropicParams, mapAnthropicStream, mapStopReason, normalizeAnthropicUsage };
|
|
800
|
+
export { ANTHROPIC_MODELS, ANTHROPIC_PRICING, DEFAULT_PAUSE_TURN_MAX_CONTINUATIONS, IdMap, anthropic, anthropicErrorToWire, anthropicModelInfo, buildAnthropicParams, mapAnthropicStream, mapStopReason, normalizeAnthropicUsage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/anthropic",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Rulvar first-class provider adapter over @anthropic-ai/sdk.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,12 +23,13 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@anthropic-ai/sdk": "^0.110.0",
|
|
26
|
-
"@rulvar/core": "1.
|
|
26
|
+
"@rulvar/core": "1.10.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.20.0",
|
|
30
30
|
"tsdown": "^0.22.3",
|
|
31
|
-
"typescript": "~6.0.3"
|
|
31
|
+
"typescript": "~6.0.3",
|
|
32
|
+
"@rulvar/testing": "1.10.0"
|
|
32
33
|
},
|
|
33
34
|
"repository": {
|
|
34
35
|
"type": "git",
|