@eum-agent/llm-provider-anthropic 0.0.0-stage → 1.1.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/assets/NOTICE ADDED
@@ -0,0 +1,28 @@
1
+ Vendor marks from lobehub/lobe-icons (@lobehub/icons-static-svg 1.95.1, MIT), except where noted. Each file is named for the catalogue row contributed by its owning provider extension.
2
+
3
+ - zhipu*.svg: the Z glyph from Z.ai's own logo (https://z-cdn.chatglm.cn/z-ai/static/logo.svg), without its dark tile.
4
+ - kimi-coding*.svg: the K filled black, as kimi.com's light-scheme favicon draws it; the lobe-icons original fills it white.
5
+
6
+ The lobe-icons marks are distributed under the MIT License:
7
+
8
+ MIT License
9
+
10
+ Copyright (c) 2023 LobeHub
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ <svg fill="currentColor" fill-rule="evenodd" height="24" style="flex:none;line-height:1" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><title>Anthropic</title><path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path></svg>
package/dist/index.js ADDED
@@ -0,0 +1,564 @@
1
+ //#endregion
2
+ //#region src/catalog.ts
3
+ /** Supplier-owned catalogue rows; protocol request facts belong to protocol registrations. */
4
+ const catalog = {
5
+ vendors: [{
6
+ kind: "vendor",
7
+ id: "anthropic",
8
+ logo: "data:image/svg+xml,%3Csvg%20fill%3D%22currentColor%22%20fill-rule%3D%22evenodd%22%20height%3D%2224%22%20style%3D%22flex%3Anone%3Bline-height%3A1%22%20viewBox%3D%220%200%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EAnthropic%3C%2Ftitle%3E%3Cpath%20d%3D%22M13.827%203.52h3.603L24%2020h-3.603l-6.57-16.48zm-7.258%200h3.767L16.906%2020h-3.674l-1.343-3.461H5.017l-1.344%203.46H0L6.57%203.522zm4.132%209.959L8.453%207.687%206.205%2013.48H10.7z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E",
9
+ name: "Anthropic",
10
+ region: null,
11
+ market: "international",
12
+ catalogKey: "anthropic",
13
+ canListModels: true,
14
+ endpoints: [{
15
+ baseUrl: "https://api.anthropic.com/v1",
16
+ type: "anthropic",
17
+ endpointId: "anthropic",
18
+ protocolIds: ["anthropic", "openai"],
19
+ alwaysThinking: [
20
+ "claude-fable-5",
21
+ "claude-mythos",
22
+ "claude-opus-5-5"
23
+ ]
24
+ }]
25
+ }],
26
+ snapshot: { "anthropic": {
27
+ "claude-sonnet-4-6": {
28
+ "id": "claude-sonnet-4-6",
29
+ "name": "Claude Sonnet 4.6",
30
+ "family": "claude-sonnet",
31
+ "reasoning": true,
32
+ "reasoning_options": [{
33
+ "type": "effort",
34
+ "values": [
35
+ "low",
36
+ "medium",
37
+ "high",
38
+ "max"
39
+ ]
40
+ }, {
41
+ "type": "budget_tokens",
42
+ "min": 1024
43
+ }],
44
+ "temperature": true,
45
+ "tool_call": true,
46
+ "attachment": true,
47
+ "modalities": {
48
+ "input": [
49
+ "text",
50
+ "image",
51
+ "pdf"
52
+ ],
53
+ "output": ["text"]
54
+ },
55
+ "limit": {
56
+ "context": 1e6,
57
+ "output": 128e3
58
+ },
59
+ "release_date": "2026-02-17"
60
+ },
61
+ "claude-opus-5": {
62
+ "id": "claude-opus-5",
63
+ "name": "Claude Opus 5",
64
+ "family": "claude-opus",
65
+ "reasoning": true,
66
+ "reasoning_options": [{
67
+ "type": "effort",
68
+ "values": [
69
+ "low",
70
+ "medium",
71
+ "high",
72
+ "xhigh",
73
+ "max"
74
+ ]
75
+ }],
76
+ "temperature": false,
77
+ "tool_call": true,
78
+ "attachment": true,
79
+ "modalities": {
80
+ "input": [
81
+ "text",
82
+ "image",
83
+ "pdf"
84
+ ],
85
+ "output": ["text"]
86
+ },
87
+ "limit": {
88
+ "context": 1e6,
89
+ "output": 128e3
90
+ },
91
+ "release_date": "2026-07-24"
92
+ },
93
+ "claude-opus-4-5": {
94
+ "id": "claude-opus-4-5",
95
+ "name": "Claude Opus 4.5 (latest)",
96
+ "family": "claude-opus",
97
+ "reasoning": true,
98
+ "reasoning_options": [{
99
+ "type": "effort",
100
+ "values": [
101
+ "low",
102
+ "medium",
103
+ "high"
104
+ ]
105
+ }, {
106
+ "type": "budget_tokens",
107
+ "min": 1024
108
+ }],
109
+ "temperature": true,
110
+ "tool_call": true,
111
+ "attachment": true,
112
+ "modalities": {
113
+ "input": [
114
+ "text",
115
+ "image",
116
+ "pdf"
117
+ ],
118
+ "output": ["text"]
119
+ },
120
+ "limit": {
121
+ "context": 2e5,
122
+ "output": 64e3
123
+ },
124
+ "release_date": "2025-11-24"
125
+ },
126
+ "claude-fable-5-1": {
127
+ "id": "claude-fable-5-1",
128
+ "name": "Claude Fable 5.1",
129
+ "family": "claude-fable",
130
+ "reasoning": true,
131
+ "reasoning_options": [{
132
+ "type": "effort",
133
+ "values": [
134
+ "low",
135
+ "medium",
136
+ "high",
137
+ "xhigh",
138
+ "max"
139
+ ]
140
+ }],
141
+ "temperature": false,
142
+ "tool_call": true,
143
+ "attachment": true,
144
+ "modalities": {
145
+ "input": [
146
+ "text",
147
+ "image",
148
+ "pdf"
149
+ ],
150
+ "output": ["text"]
151
+ },
152
+ "limit": {
153
+ "context": 1e6,
154
+ "output": 128e3
155
+ },
156
+ "release_date": "2026-09-01"
157
+ },
158
+ "claude-opus-4-6": {
159
+ "id": "claude-opus-4-6",
160
+ "name": "Claude Opus 4.6",
161
+ "family": "claude-opus",
162
+ "reasoning": true,
163
+ "reasoning_options": [{
164
+ "type": "effort",
165
+ "values": [
166
+ "low",
167
+ "medium",
168
+ "high",
169
+ "max"
170
+ ]
171
+ }, {
172
+ "type": "budget_tokens",
173
+ "min": 1024
174
+ }],
175
+ "temperature": true,
176
+ "tool_call": true,
177
+ "attachment": true,
178
+ "modalities": {
179
+ "input": [
180
+ "text",
181
+ "image",
182
+ "pdf"
183
+ ],
184
+ "output": ["text"]
185
+ },
186
+ "limit": {
187
+ "context": 1e6,
188
+ "output": 128e3
189
+ },
190
+ "release_date": "2026-02-04"
191
+ },
192
+ "claude-sonnet-4-5-20250929": {
193
+ "id": "claude-sonnet-4-5-20250929",
194
+ "name": "Claude Sonnet 4.5",
195
+ "family": "claude-sonnet",
196
+ "reasoning": true,
197
+ "reasoning_options": [{
198
+ "type": "budget_tokens",
199
+ "min": 1024
200
+ }],
201
+ "temperature": true,
202
+ "tool_call": true,
203
+ "attachment": true,
204
+ "modalities": {
205
+ "input": [
206
+ "text",
207
+ "image",
208
+ "pdf"
209
+ ],
210
+ "output": ["text"]
211
+ },
212
+ "limit": {
213
+ "context": 1e6,
214
+ "output": 64e3
215
+ },
216
+ "release_date": "2025-09-29"
217
+ },
218
+ "claude-opus-4-7": {
219
+ "id": "claude-opus-4-7",
220
+ "name": "Claude Opus 4.7",
221
+ "family": "claude-opus",
222
+ "reasoning": true,
223
+ "reasoning_options": [{
224
+ "type": "effort",
225
+ "values": [
226
+ "low",
227
+ "medium",
228
+ "high",
229
+ "xhigh",
230
+ "max"
231
+ ]
232
+ }],
233
+ "temperature": false,
234
+ "tool_call": true,
235
+ "attachment": true,
236
+ "modalities": {
237
+ "input": [
238
+ "text",
239
+ "image",
240
+ "pdf"
241
+ ],
242
+ "output": ["text"]
243
+ },
244
+ "limit": {
245
+ "context": 1e6,
246
+ "output": 128e3
247
+ },
248
+ "release_date": "2026-04-14"
249
+ },
250
+ "claude-haiku-4-5-20251001": {
251
+ "id": "claude-haiku-4-5-20251001",
252
+ "name": "Claude Haiku 4.5",
253
+ "family": "claude-haiku",
254
+ "reasoning": true,
255
+ "reasoning_options": [{
256
+ "type": "budget_tokens",
257
+ "min": 1024
258
+ }],
259
+ "temperature": true,
260
+ "tool_call": true,
261
+ "attachment": true,
262
+ "modalities": {
263
+ "input": [
264
+ "text",
265
+ "image",
266
+ "pdf"
267
+ ],
268
+ "output": ["text"]
269
+ },
270
+ "limit": {
271
+ "context": 2e5,
272
+ "output": 64e3
273
+ },
274
+ "release_date": "2025-10-15"
275
+ },
276
+ "claude-fable-5": {
277
+ "id": "claude-fable-5",
278
+ "name": "Claude Fable 5",
279
+ "family": "claude-fable",
280
+ "reasoning": true,
281
+ "reasoning_options": [{
282
+ "type": "effort",
283
+ "values": [
284
+ "low",
285
+ "medium",
286
+ "high",
287
+ "xhigh",
288
+ "max"
289
+ ]
290
+ }],
291
+ "temperature": false,
292
+ "tool_call": true,
293
+ "attachment": true,
294
+ "modalities": {
295
+ "input": [
296
+ "text",
297
+ "image",
298
+ "pdf"
299
+ ],
300
+ "output": ["text"]
301
+ },
302
+ "limit": {
303
+ "context": 1e6,
304
+ "output": 128e3
305
+ },
306
+ "release_date": "2026-06-07"
307
+ },
308
+ "claude-haiku-4-5": {
309
+ "id": "claude-haiku-4-5",
310
+ "name": "Claude Haiku 4.5 (latest)",
311
+ "family": "claude-haiku",
312
+ "reasoning": true,
313
+ "reasoning_options": [{
314
+ "type": "budget_tokens",
315
+ "min": 1024
316
+ }],
317
+ "temperature": true,
318
+ "tool_call": true,
319
+ "attachment": true,
320
+ "modalities": {
321
+ "input": [
322
+ "text",
323
+ "image",
324
+ "pdf"
325
+ ],
326
+ "output": ["text"]
327
+ },
328
+ "limit": {
329
+ "context": 2e5,
330
+ "output": 64e3
331
+ },
332
+ "release_date": "2025-10-15"
333
+ },
334
+ "claude-sonnet-4-5": {
335
+ "id": "claude-sonnet-4-5",
336
+ "name": "Claude Sonnet 4.5 (latest)",
337
+ "family": "claude-sonnet",
338
+ "reasoning": true,
339
+ "reasoning_options": [{
340
+ "type": "budget_tokens",
341
+ "min": 1024
342
+ }],
343
+ "temperature": true,
344
+ "tool_call": true,
345
+ "attachment": true,
346
+ "modalities": {
347
+ "input": [
348
+ "text",
349
+ "image",
350
+ "pdf"
351
+ ],
352
+ "output": ["text"]
353
+ },
354
+ "limit": {
355
+ "context": 1e6,
356
+ "output": 64e3
357
+ },
358
+ "release_date": "2025-09-29"
359
+ },
360
+ "claude-opus-4-8": {
361
+ "id": "claude-opus-4-8",
362
+ "name": "Claude Opus 4.8",
363
+ "family": "claude-opus",
364
+ "reasoning": true,
365
+ "reasoning_options": [{
366
+ "type": "effort",
367
+ "values": [
368
+ "low",
369
+ "medium",
370
+ "high",
371
+ "xhigh",
372
+ "max"
373
+ ]
374
+ }],
375
+ "temperature": false,
376
+ "tool_call": true,
377
+ "attachment": true,
378
+ "modalities": {
379
+ "input": [
380
+ "text",
381
+ "image",
382
+ "pdf"
383
+ ],
384
+ "output": ["text"]
385
+ },
386
+ "limit": {
387
+ "context": 1e6,
388
+ "output": 128e3
389
+ },
390
+ "release_date": "2026-05-28"
391
+ },
392
+ "claude-sonnet-5": {
393
+ "id": "claude-sonnet-5",
394
+ "name": "Claude Sonnet 5",
395
+ "family": "claude-sonnet",
396
+ "reasoning": true,
397
+ "reasoning_options": [{ "type": "toggle" }, {
398
+ "type": "effort",
399
+ "values": [
400
+ "low",
401
+ "medium",
402
+ "high",
403
+ "xhigh",
404
+ "max"
405
+ ]
406
+ }],
407
+ "temperature": false,
408
+ "tool_call": true,
409
+ "attachment": true,
410
+ "modalities": {
411
+ "input": [
412
+ "text",
413
+ "image",
414
+ "pdf"
415
+ ],
416
+ "output": ["text"]
417
+ },
418
+ "limit": {
419
+ "context": 1e6,
420
+ "output": 128e3
421
+ },
422
+ "release_date": "2026-06-29"
423
+ },
424
+ "claude-opus-4-5-20251101": {
425
+ "id": "claude-opus-4-5-20251101",
426
+ "name": "Claude Opus 4.5",
427
+ "family": "claude-opus",
428
+ "reasoning": true,
429
+ "reasoning_options": [{
430
+ "type": "effort",
431
+ "values": [
432
+ "low",
433
+ "medium",
434
+ "high"
435
+ ]
436
+ }, {
437
+ "type": "budget_tokens",
438
+ "min": 1024
439
+ }],
440
+ "temperature": true,
441
+ "tool_call": true,
442
+ "attachment": true,
443
+ "modalities": {
444
+ "input": [
445
+ "text",
446
+ "image",
447
+ "pdf"
448
+ ],
449
+ "output": ["text"]
450
+ },
451
+ "limit": {
452
+ "context": 2e5,
453
+ "output": 64e3
454
+ },
455
+ "release_date": "2025-11-24"
456
+ }
457
+ } },
458
+ snapshotAt: Date.parse("2026-09-17")
459
+ };
460
+ //#endregion
461
+ //#region src/routing.ts
462
+ /** Maps only declared official roots; protocol implementations own the remaining resource URI. */
463
+ function connectionConfig(endpoint, protocolId, config, aliases = []) {
464
+ const defaults = Object.values(endpoint.capabilities).find((one) => one.protocolIds.includes(protocolId))?.protocolDefaults?.[protocolId] ?? {};
465
+ const configured = config.baseUrl;
466
+ const canonical = [
467
+ endpoint.defaults?.baseUrl,
468
+ ...Object.values(endpoint.capabilities).flatMap((one) => Object.values(one.protocolDefaults ?? {}).map((value) => value.baseUrl)),
469
+ ...aliases
470
+ ].filter((value) => typeof value === "string");
471
+ const isOfficial = configured === void 0 || typeof configured === "string" && canonical.some((value) => value.replace(/\/+$/, "") === configured.replace(/\/+$/, ""));
472
+ const selected = defaults.baseUrl ?? endpoint.defaults?.baseUrl;
473
+ return {
474
+ ...endpoint.defaults,
475
+ ...defaults,
476
+ ...config,
477
+ ...isOfficial && selected !== void 0 ? { baseUrl: selected } : {}
478
+ };
479
+ }
480
+ //#endregion
481
+ //#region src/type.ts
482
+ /** Stable supplier registration identity. */
483
+ const TYPE = "anthropic";
484
+ const endpoints = [{
485
+ id: "anthropic",
486
+ label: "Anthropic",
487
+ capabilities: { chat: {
488
+ protocolIds: ["anthropic", "openai"],
489
+ defaultProtocolId: "anthropic",
490
+ protocolDefaults: { openai: { baseUrl: "https://api.anthropic.com/v1" } }
491
+ } },
492
+ defaults: { baseUrl: "https://api.anthropic.com/v1" },
493
+ credentialGroup: "anthropic"
494
+ }];
495
+ const protocolOptions = { anthropic: { budgetOnly: [
496
+ "claude-sonnet-4-5",
497
+ "claude-haiku-4-5",
498
+ "claude-opus-4-5",
499
+ "claude-opus-4-1",
500
+ "claude-opus-4-0",
501
+ "claude-sonnet-4-0",
502
+ "claude-opus-4-2025",
503
+ "claude-sonnet-4-2025",
504
+ "claude-3-7-sonnet"
505
+ ] } };
506
+ /** Builds this supplier's declaration without network activity or protocol imports. */
507
+ function anthropicProviderType(support) {
508
+ return {
509
+ type: TYPE,
510
+ label: "Anthropic",
511
+ fields: [{
512
+ key: "apiKey",
513
+ kind: "secret",
514
+ label: "API Key",
515
+ required: true
516
+ }],
517
+ endpoints,
518
+ catalog: support ? {
519
+ ...catalog,
520
+ source: support.catalogueSource("https://models.dev/api.json", "models")
521
+ } : catalog,
522
+ describeModel({ model }) {
523
+ return Object.values(catalog.snapshot).some((row) => Object.hasOwn(row, model)) ? {
524
+ id: model,
525
+ outputLimit: {
526
+ ordinary: 16e3,
527
+ thinking: 32e3
528
+ }
529
+ } : void 0;
530
+ },
531
+ prepareConnection(input) {
532
+ const endpoint = endpoints.find((one) => one.id === input.endpointId);
533
+ if (!endpoint || !Object.values(endpoint.capabilities).some((one) => one.protocolIds.includes(input.protocolId))) throw new Error("unsupported supplier endpoint or protocol");
534
+ return {
535
+ config: connectionConfig(endpoint, input.protocolId, input.config),
536
+ options: {
537
+ ...protocolOptions[input.protocolId],
538
+ ...input.protocolId === "anthropic" && String(input.config.baseUrl ?? endpoint.defaults?.baseUrl).replace(/\/$/, "") === endpoint.defaults?.baseUrl ? { effortCacheModels: {
539
+ "claude-fable-5-1": "high",
540
+ "claude-mythos-5-1": "high",
541
+ "claude-opus-5-5": "medium",
542
+ "claude-opus-5": "high",
543
+ "claude-sonnet-5-5": "high",
544
+ "claude-haiku-5-5": "medium"
545
+ } } : {}
546
+ }
547
+ };
548
+ }
549
+ };
550
+ }
551
+ //#endregion
552
+ //#region src/index.ts
553
+ /** Supplier extensions contribute no tools. */
554
+ const TOOL_NAMES = [];
555
+ const plugin = {
556
+ name: "@eum-agent/llm-provider-anthropic",
557
+ requires: ["model-catalogue-sources"],
558
+ apply(ctx) {
559
+ const support = ctx.services.get("model-catalogue-sources");
560
+ ctx.modelProviders.register(anthropicProviderType(support));
561
+ }
562
+ };
563
+ //#endregion
564
+ export { TOOL_NAMES, plugin as default };
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "@eum-agent/llm-provider-anthropic",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "displayName": {
4
+ "en-US": "Anthropic Model Connection",
5
+ "zh-CN": "模型接入 · Anthropic"
6
+ },
7
+ "version": "1.1.0",
8
+ "type": "module",
9
+ "description": "Anthropic model provider and catalogue",
10
+ "license": "MIT",
11
+ "exports": {
12
+ ".": {
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "assets"
19
+ ],
20
+ "devDependencies": {
21
+ "@eum-agent/plugin": "1.1.0"
22
+ },
23
+ "yaoguang": {
24
+ "description": {
25
+ "en-US": "Anthropic model provider and catalogue",
26
+ "zh-CN": "Anthropic 品牌供应商与模型目录"
27
+ },
28
+ "dependencies": {
29
+ "@eum-agent/llm-management": "1.1.0"
30
+ },
31
+ "kind": "extension"
32
+ },
33
+ "scripts": {
34
+ "build": "tsdown",
35
+ "test": "vitest run",
36
+ "typecheck": "tsc --noEmit"
37
+ }
6
38
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.