@apicity/anthropic 0.1.0-alpha.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Justin Tanner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,581 @@
1
+ # @apicity/anthropic
2
+
3
+ [![npm](https://img.shields.io/npm/v/@apicity/anthropic?color=cb0000)](https://www.npmjs.com/package/@apicity/anthropic)
4
+ [![zero dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](package.json)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue?logo=typescript&logoColor=white)](tsconfig.json)
6
+
7
+ Anthropic / Claude provider for messages, batches, models, files, and admin APIs.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @apicity/anthropic
13
+ # or
14
+ pnpm add @apicity/anthropic
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```typescript
20
+ import { anthropic as createAnthropic } from "@apicity/anthropic";
21
+
22
+ const anthropic = createAnthropic({ apiKey: process.env.ANTHROPIC_API_KEY! });
23
+ ```
24
+
25
+ ## Real-world example: multi-turn TypeScript review with system prompt + few-shot priming
26
+
27
+ The single biggest knob the Anthropic Messages API gives you is the
28
+ `messages` array itself: every prior turn is grist for the next one.
29
+ Pair that with a strict `system` prompt to lock the output format and
30
+ one priming exchange to demonstrate the format, and you get a
31
+ deterministic-looking single-line bug reviewer out of `claude-sonnet-4-6`
32
+ without any tools, no JSON-mode, no fine-tune. Every token, model id,
33
+ and content block below is mined from
34
+ [`tests/recordings/anthropic_2966493235/messages-code-review_891889396/`](../../../tests/recordings/anthropic_2966493235/messages-code-review_891889396/),
35
+ the HAR replayed by
36
+ [`tests/integration/anthropic-messages-code-review.test.ts`](../../../tests/integration/anthropic-messages-code-review.test.ts)
37
+ — recorded straight against `https://api.anthropic.com/v1/messages` with
38
+ the typed `@apicity/anthropic` client.
39
+
40
+ ````typescript
41
+ import { anthropic as createAnthropic } from "@apicity/anthropic";
42
+ import type {
43
+ AnthropicMessageResponse,
44
+ AnthropicTextBlock,
45
+ } from "@apicity/anthropic";
46
+
47
+ const anthropic = createAnthropic({
48
+ apiKey: process.env.ANTHROPIC_API_KEY!,
49
+ });
50
+
51
+ // 1. The `system` field is a hard contract for response shape — Claude
52
+ // treats it as higher-priority instruction than anything in
53
+ // `messages`. Spelling out the exact line format here ("BUG: <one
54
+ // sentence>", no preamble, no Markdown) is what stops the model
55
+ // from wrapping the answer in "Sure! Here's the bug:" or fenced
56
+ // code, which it does by default.
57
+ //
58
+ // 2. The `messages` array is a *transcript*, not a single prompt. The
59
+ // one-shot user→assistant pair below primes the format on a known
60
+ // bug (off-by-one in a loop bound) so the third turn answers in
61
+ // the same shape on a code snippet the model has not seen before.
62
+ // This is few-shot prompting; no fine-tuning required.
63
+ const result: AnthropicMessageResponse = await anthropic.v1.messages({
64
+ model: "claude-sonnet-4-6",
65
+ max_tokens: 256,
66
+ system:
67
+ "You are a senior TypeScript reviewer. Reply with exactly one line " +
68
+ "in the form: 'BUG: <one-sentence summary>'. No preamble, no code, " +
69
+ "no Markdown.",
70
+ messages: [
71
+ {
72
+ role: "user",
73
+ content:
74
+ "Review this:\n```ts\nfunction firstNonEmpty(xs: string[]): string {\n" +
75
+ " for (let i = 0; i <= xs.length; i++) {\n" +
76
+ " if (xs[i]) return xs[i];\n" +
77
+ " }\n return '';\n}\n```",
78
+ },
79
+ {
80
+ role: "assistant",
81
+ content:
82
+ "BUG: The loop condition `i <= xs.length` reads one past the " +
83
+ "last index, so `xs[xs.length]` is dereferenced as undefined.",
84
+ },
85
+ {
86
+ role: "user",
87
+ content:
88
+ "Now review this one the same way:\n```ts\n" +
89
+ "async function readAll(stream: ReadableStream<Uint8Array>): " +
90
+ "Promise<Uint8Array> {\n" +
91
+ " const reader = stream.getReader();\n" +
92
+ " const chunks: Uint8Array[] = [];\n" +
93
+ " while (true) {\n" +
94
+ " const { done, value } = await reader.read();\n" +
95
+ " if (done) break;\n chunks.push(value);\n }\n" +
96
+ " return Buffer.concat(chunks);\n}\n```",
97
+ },
98
+ ],
99
+ });
100
+
101
+ // 3. `content` is always an array of typed blocks, never a single
102
+ // string. This is the same shape Claude returns when there are
103
+ // `tool_use`, `thinking`, or `image` blocks in the response —
104
+ // treating it uniformly here means tool-using and thinking
105
+ // workflows drop in without restructuring the read path.
106
+ const text = result.content
107
+ .filter((b): b is AnthropicTextBlock => b.type === "text")
108
+ .map((b) => b.text)
109
+ .join("")
110
+ .trim();
111
+
112
+ console.log(text);
113
+ // → "BUG: The reader is never released via `reader.releaseLock()`
114
+ // (especially on error), leaving the stream permanently locked."
115
+
116
+ console.log(
117
+ `model=${result.model} stop=${result.stop_reason} ` +
118
+ `in=${result.usage.input_tokens} out=${result.usage.output_tokens}`,
119
+ );
120
+ // → "model=claude-sonnet-4-6 stop=end_turn in=268 out=33"
121
+ ````
122
+
123
+ **Notes**
124
+
125
+ - The `system` prompt is treated as a soft-but-strong constraint on
126
+ every turn, not just the first — Claude re-applies it as the
127
+ conversation lengthens, so the format won't drift after 10 turns
128
+ the way a single user-message instruction will. Pass it as a string
129
+ for short rules; pass it as `[{ type: "text", text, cache_control:
130
+ { type: "ephemeral" } }]` to mark it as cacheable when you reuse
131
+ the same long system prompt across many requests.
132
+ - Few-shot priming via a fake `assistant` turn is the cheapest
133
+ reliable way to lock output formatting without `tools` or
134
+ structured-output APIs. Claude does not distinguish between turns
135
+ it actually generated and turns you wrote — both are equally
136
+ authoritative context. Keep priming turns *short and exact*; if
137
+ yours doesn't match the system rule character-for-character (e.g. a
138
+ trailing period the system says shouldn't be there), the model
139
+ will hedge.
140
+ - `result.content` is a `(AnthropicTextBlock | AnthropicToolUseBlock |
141
+ AnthropicThinkingBlock | …)[]` discriminated union. Filter on
142
+ `b.type === "text"` before reading `.text`; on `b.type ===
143
+ "tool_use"` before reading `.input`; on `b.type === "thinking"`
144
+ before reading `.thinking`. Claude can interleave them in one
145
+ response — e.g. a leading text block, then a thinking block, then
146
+ a tool_use — so always iterate, never assume `content[0]`.
147
+ - `usage.input_tokens` includes the *entire* transcript on every
148
+ turn, so a 10-turn conversation pays for the system prompt + 10
149
+ turns of history every time. To amortize a long system prompt
150
+ (>1024 tokens) across many calls, mark it `cache_control:
151
+ ephemeral` and watch `usage.cache_read_input_tokens` rise on calls
152
+ 2–N.
153
+ - Errors throw `AnthropicError` with `status`, the parsed `body`, and
154
+ the upstream `errorType` ("authentication_error",
155
+ "rate_limit_error", "overloaded_error", …). Wrap with `withRetry`
156
+ from `@apicity/anthropic` for `429` and `529 overloaded_error`,
157
+ which Claude returns under sustained load. Pair with `withFallback`
158
+ to roll over to `claude-haiku-4-5` for non-critical paths.
159
+ - Point the same call at a Claude-compatible gateway by passing
160
+ `baseURL` (and a `fetch` wrapper if the backend uses a different
161
+ auth header than `x-api-key`) to `createAnthropic`. The factory's
162
+ request shape is upstream-faithful, so anything that speaks the
163
+ Anthropic Messages wire format — Bedrock proxies, third-party
164
+ gateways, local mocks — works without touching call sites.
165
+
166
+ ## API Reference
167
+
168
+ 26 endpoints across 4 groups. Each method mirrors an upstream URL path.
169
+
170
+ ### files
171
+
172
+ <details>
173
+ <summary><code>DELETE</code> <b><code>anthropic.v1.files.del</code></b></summary>
174
+
175
+ <code>DELETE https://api.anthropic.com/v1/files/{fileId}</code>
176
+
177
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
178
+
179
+ ```typescript
180
+ const res = await anthropic.v1.files.del({ /* ... */ });
181
+ ```
182
+
183
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
184
+
185
+ </details>
186
+
187
+ <details>
188
+ <summary><code>GET</code> <b><code>anthropic.v1.files.content</code></b></summary>
189
+
190
+ <code>GET https://api.anthropic.com/v1/files/{fileId}/content</code>
191
+
192
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
193
+
194
+ ```typescript
195
+ const res = await anthropic.v1.files.content({ /* ... */ });
196
+ ```
197
+
198
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
199
+
200
+ </details>
201
+
202
+ <details>
203
+ <summary><code>GET</code> <b><code>anthropic.v1.files.list</code></b></summary>
204
+
205
+ <code>GET https://api.anthropic.com/v1/files</code>
206
+
207
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
208
+
209
+ ```typescript
210
+ const res = await anthropic.v1.files.list({ /* ... */ });
211
+ ```
212
+
213
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
214
+
215
+ </details>
216
+
217
+ <details>
218
+ <summary><code>GET</code> <b><code>anthropic.v1.files.retrieve</code></b></summary>
219
+
220
+ <code>GET https://api.anthropic.com/v1/files/{fileId}</code>
221
+
222
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
223
+
224
+ ```typescript
225
+ const res = await anthropic.v1.files.retrieve({ /* ... */ });
226
+ ```
227
+
228
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
229
+
230
+ </details>
231
+
232
+ <details>
233
+ <summary><code>POST</code> <b><code>anthropic.v1.files</code></b></summary>
234
+
235
+ <code>POST https://api.anthropic.com/v1/files</code>
236
+
237
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
238
+
239
+ ```typescript
240
+ const res = await anthropic.v1.files({ /* ... */ });
241
+ ```
242
+
243
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
244
+
245
+ </details>
246
+
247
+ ### messages
248
+
249
+ <details>
250
+ <summary><code>DELETE</code> <b><code>anthropic.v1.messages.batches.del</code></b></summary>
251
+
252
+ <code>DELETE https://api.anthropic.com/v1/messages/batches/{batchId}</code>
253
+
254
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
255
+
256
+ ```typescript
257
+ const res = await anthropic.v1.messages.batches.del({ /* ... */ });
258
+ ```
259
+
260
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
261
+
262
+ </details>
263
+
264
+ <details>
265
+ <summary><code>GET</code> <b><code>anthropic.v1.messages.batches.list</code></b></summary>
266
+
267
+ <code>GET https://api.anthropic.com/v1/messages/batches</code>
268
+
269
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
270
+
271
+ ```typescript
272
+ const res = await anthropic.v1.messages.batches.list({ /* ... */ });
273
+ ```
274
+
275
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
276
+
277
+ </details>
278
+
279
+ <details>
280
+ <summary><code>GET</code> <b><code>anthropic.v1.messages.batches.results</code></b></summary>
281
+
282
+ <code>GET https://api.anthropic.com/v1/messages/batches/{batchId}/results</code>
283
+
284
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
285
+
286
+ ```typescript
287
+ const res = await anthropic.v1.messages.batches.results({ /* ... */ });
288
+ ```
289
+
290
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
291
+
292
+ </details>
293
+
294
+ <details>
295
+ <summary><code>GET</code> <b><code>anthropic.v1.messages.batches.retrieve</code></b></summary>
296
+
297
+ <code>GET https://api.anthropic.com/v1/messages/batches/{batchId}</code>
298
+
299
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
300
+
301
+ ```typescript
302
+ const res = await anthropic.v1.messages.batches.retrieve({ /* ... */ });
303
+ ```
304
+
305
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
306
+
307
+ </details>
308
+
309
+ <details>
310
+ <summary><code>POST</code> <b><code>anthropic.v1.messages</code></b></summary>
311
+
312
+ <code>POST https://api.anthropic.com/v1/messages</code>
313
+
314
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
315
+
316
+ ```typescript
317
+ const res = await anthropic.v1.messages({ /* ... */ });
318
+ ```
319
+
320
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
321
+
322
+ </details>
323
+
324
+ <details>
325
+ <summary><code>POST</code> <b><code>anthropic.v1.messages</code></b></summary>
326
+
327
+ <code>POST https://api.anthropic.com/v1/messages</code>
328
+
329
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
330
+
331
+ ```typescript
332
+ const res = await anthropic.v1.messages({ /* ... */ });
333
+ ```
334
+
335
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
336
+
337
+ </details>
338
+
339
+ <details>
340
+ <summary><code>POST</code> <b><code>anthropic.v1.messages.batches</code></b></summary>
341
+
342
+ <code>POST https://api.anthropic.com/v1/messages/batches</code>
343
+
344
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
345
+
346
+ ```typescript
347
+ const res = await anthropic.v1.messages.batches({ /* ... */ });
348
+ ```
349
+
350
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
351
+
352
+ </details>
353
+
354
+ <details>
355
+ <summary><code>POST</code> <b><code>anthropic.v1.messages.batches.cancel</code></b></summary>
356
+
357
+ <code>POST https://api.anthropic.com/v1/messages/batches/{batchId}/cancel</code>
358
+
359
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
360
+
361
+ ```typescript
362
+ const res = await anthropic.v1.messages.batches.cancel({ /* ... */ });
363
+ ```
364
+
365
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
366
+
367
+ </details>
368
+
369
+ <details>
370
+ <summary><code>POST</code> <b><code>anthropic.v1.messages.countTokens</code></b></summary>
371
+
372
+ <code>POST https://api.anthropic.com/v1/messages/count_tokens</code>
373
+
374
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
375
+
376
+ ```typescript
377
+ const res = await anthropic.v1.messages.countTokens({ /* ... */ });
378
+ ```
379
+
380
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
381
+
382
+ </details>
383
+
384
+ <details>
385
+ <summary><code>POST</code> <b><code>anthropic.v1.messages</code></b></summary>
386
+
387
+ <code>POST https://api.anthropic.com/v1/messages</code>
388
+
389
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
390
+
391
+ ```typescript
392
+ const res = await anthropic.v1.messages({ /* ... */ });
393
+ ```
394
+
395
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
396
+
397
+ </details>
398
+
399
+ <details>
400
+ <summary><code>POST</code> <b><code>anthropic.v1.messages.batches</code></b></summary>
401
+
402
+ <code>POST https://api.anthropic.com/v1/messages/batches</code>
403
+
404
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
405
+
406
+ ```typescript
407
+ const res = await anthropic.v1.messages.batches({ /* ... */ });
408
+ ```
409
+
410
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
411
+
412
+ </details>
413
+
414
+ <details>
415
+ <summary><code>POST</code> <b><code>anthropic.v1.messages.countTokens</code></b></summary>
416
+
417
+ <code>POST https://api.anthropic.com/v1/messages/count_tokens</code>
418
+
419
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
420
+
421
+ ```typescript
422
+ const res = await anthropic.v1.messages.countTokens({ /* ... */ });
423
+ ```
424
+
425
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
426
+
427
+ </details>
428
+
429
+ ### models
430
+
431
+ <details>
432
+ <summary><code>GET</code> <b><code>anthropic.v1.models.list</code></b></summary>
433
+
434
+ <code>GET https://api.anthropic.com/v1/models</code>
435
+
436
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
437
+
438
+ ```typescript
439
+ const res = await anthropic.v1.models.list({ /* ... */ });
440
+ ```
441
+
442
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
443
+
444
+ </details>
445
+
446
+ <details>
447
+ <summary><code>GET</code> <b><code>anthropic.v1.models.retrieve</code></b></summary>
448
+
449
+ <code>GET https://api.anthropic.com/v1/models/{modelId}</code>
450
+
451
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
452
+
453
+ ```typescript
454
+ const res = await anthropic.v1.models.retrieve({ /* ... */ });
455
+ ```
456
+
457
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
458
+
459
+ </details>
460
+
461
+ ### skills
462
+
463
+ <details>
464
+ <summary><code>DELETE</code> <b><code>anthropic.v1.skills.del</code></b></summary>
465
+
466
+ <code>DELETE https://api.anthropic.com/v1/skills/{skillId}</code>
467
+
468
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
469
+
470
+ ```typescript
471
+ const res = await anthropic.v1.skills.del({ /* ... */ });
472
+ ```
473
+
474
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
475
+
476
+ </details>
477
+
478
+ <details>
479
+ <summary><code>DELETE</code> <b><code>anthropic.v1.skills.versions.del</code></b></summary>
480
+
481
+ <code>DELETE https://api.anthropic.com/v1/skills/{skillId}/versions/{version}</code>
482
+
483
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
484
+
485
+ ```typescript
486
+ const res = await anthropic.v1.skills.versions.del({ /* ... */ });
487
+ ```
488
+
489
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
490
+
491
+ </details>
492
+
493
+ <details>
494
+ <summary><code>GET</code> <b><code>anthropic.v1.skills.list</code></b></summary>
495
+
496
+ <code>GET https://api.anthropic.com/v1/skills</code>
497
+
498
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
499
+
500
+ ```typescript
501
+ const res = await anthropic.v1.skills.list({ /* ... */ });
502
+ ```
503
+
504
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
505
+
506
+ </details>
507
+
508
+ <details>
509
+ <summary><code>GET</code> <b><code>anthropic.v1.skills.retrieve</code></b></summary>
510
+
511
+ <code>GET https://api.anthropic.com/v1/skills/{skillId}</code>
512
+
513
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
514
+
515
+ ```typescript
516
+ const res = await anthropic.v1.skills.retrieve({ /* ... */ });
517
+ ```
518
+
519
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
520
+
521
+ </details>
522
+
523
+ <details>
524
+ <summary><code>GET</code> <b><code>anthropic.v1.skills.versions.list</code></b></summary>
525
+
526
+ <code>GET https://api.anthropic.com/v1/skills/{skillId}/versions</code>
527
+
528
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
529
+
530
+ ```typescript
531
+ const res = await anthropic.v1.skills.versions.list({ /* ... */ });
532
+ ```
533
+
534
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
535
+
536
+ </details>
537
+
538
+ <details>
539
+ <summary><code>POST</code> <b><code>anthropic.v1.skills.create</code></b></summary>
540
+
541
+ <code>POST https://api.anthropic.com/v1/skills</code>
542
+
543
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
544
+
545
+ ```typescript
546
+ const res = await anthropic.v1.skills.create({ /* ... */ });
547
+ ```
548
+
549
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
550
+
551
+ </details>
552
+
553
+ <details>
554
+ <summary><code>POST</code> <b><code>anthropic.v1.skills.versions.create</code></b></summary>
555
+
556
+ <code>POST https://api.anthropic.com/v1/skills/{skillId}/versions</code>
557
+
558
+ [Upstream docs ↗](https://docs.anthropic.com/en/api)
559
+
560
+ ```typescript
561
+ const res = await anthropic.v1.skills.versions.create({ /* ... */ });
562
+ ```
563
+
564
+ Source: [`packages/provider/anthropic/src/anthropic.ts`](src/anthropic.ts)
565
+
566
+ </details>
567
+
568
+ ## Middleware
569
+
570
+ ```typescript
571
+ import { anthropic as createAnthropic, withRetry } from "@apicity/anthropic";
572
+
573
+ const anthropic = createAnthropic({ apiKey: process.env.ANTHROPIC_API_KEY! });
574
+ const models = withRetry(anthropic.get.v1.models, { retries: 3 });
575
+ ```
576
+
577
+ Part of the [apicity](https://github.com/justintanner/apicity) monorepo.
578
+
579
+ ## License
580
+
581
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,3 @@
1
+ import { AnthropicOptions, AnthropicProvider } from "./types";
2
+ export declare function anthropic(opts: AnthropicOptions): AnthropicProvider;
3
+ //# sourceMappingURL=anthropic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAyBhB,iBAAiB,EAElB,MAAM,SAAS,CAAC;AA4BjB,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,CAgyBnE"}