@mastra/claude 1.0.0 → 1.0.1-alpha.1

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.
@@ -0,0 +1,933 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ /**
4
+ * An individual message request within a batch.
5
+ */
6
+ export type BatchMessageRequest = {
7
+ /**
8
+ * Developer-provided ID created for each request in a Message Batch. Useful for
9
+ * matching results to requests, as results may be given out of request order.
10
+ *
11
+ * Must be unique for each request within the Message Batch.
12
+ *
13
+ */
14
+ custom_id: string;
15
+ params: CreateMessageRequest;
16
+ };
17
+
18
+ /**
19
+ * A block of content in a message.
20
+ */
21
+ export type Block = TextBlock | ImageBlock | ToolUseBlock | ToolResultBlock;
22
+
23
+ /**
24
+ * A delta in a streaming message.
25
+ */
26
+ export type BlockDelta = TextBlockDelta | InputJsonBlockDelta;
27
+
28
+ /**
29
+ * The cache control settings.
30
+ */
31
+ export type CacheControlEphemeral = {
32
+ type?: 'ephemeral';
33
+ };
34
+
35
+ export type type = 'ephemeral';
36
+
37
+ /**
38
+ * A delta event in a streaming content block.
39
+ */
40
+ export type ContentBlockDeltaEvent = {
41
+ delta: BlockDelta;
42
+ /**
43
+ * The index of the content block.
44
+ */
45
+ index: number;
46
+ type: 'content_block_delta';
47
+ };
48
+
49
+ /**
50
+ * A start event in a streaming content block.
51
+ */
52
+ export type ContentBlockStartEvent = {
53
+ content_block: Block;
54
+ /**
55
+ * The index of the content block.
56
+ */
57
+ index: number;
58
+ type: 'content_block_start';
59
+ };
60
+
61
+ /**
62
+ * A stop event in a streaming content block.
63
+ */
64
+ export type ContentBlockStopEvent = {
65
+ /**
66
+ * The index of the content block.
67
+ */
68
+ index: number;
69
+ type: 'content_block_stop';
70
+ };
71
+
72
+ /**
73
+ * The request parameters for creating a message batch.
74
+ */
75
+ export type CreateMessageBatchRequest = {
76
+ /**
77
+ * List of requests for prompt completion. Each is an individual request to create a Message.
78
+ */
79
+ requests: Array<BatchMessageRequest>;
80
+ };
81
+
82
+ /**
83
+ * The request parameters for creating a message.
84
+ */
85
+ export type CreateMessageRequest = {
86
+ /**
87
+ * The model that will complete your prompt.
88
+ *
89
+ * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
90
+ * details and options.
91
+ *
92
+ */
93
+ model:
94
+ | string
95
+ | 'claude-3-5-sonnet-latest'
96
+ | 'claude-3-5-sonnet-20241022'
97
+ | 'claude-3-5-sonnet-20240620'
98
+ | 'claude-3-opus-latest'
99
+ | 'claude-3-opus-20240229'
100
+ | 'claude-3-sonnet-20240229'
101
+ | 'claude-3-haiku-20240307'
102
+ | 'claude-2.1'
103
+ | 'claude-2.0'
104
+ | 'claude-instant-1.2';
105
+ /**
106
+ * Input messages.
107
+ *
108
+ * Our models are trained to operate on alternating `user` and `assistant`
109
+ * conversational turns. When creating a new `Message`, you specify the prior
110
+ * conversational turns with the `messages` parameter, and the model then generates
111
+ * the next `Message` in the conversation.
112
+ *
113
+ * Each input message must be an object with a `role` and `content`. You can
114
+ * specify a single `user`-role message, or you can include multiple `user` and
115
+ * `assistant` messages. The first message must always use the `user` role.
116
+ *
117
+ * If the final message uses the `assistant` role, the response content will
118
+ * continue immediately from the content in that message. This can be used to
119
+ * constrain part of the model's response.
120
+ *
121
+ * See [message content](https://docs.anthropic.com/en/api/messages-content) for
122
+ * details on how to construct valid message objects.
123
+ *
124
+ * Example with a single `user` message:
125
+ *
126
+ * ```json
127
+ * [{ "role": "user", "content": "Hello, Claude" }]
128
+ * ```
129
+ *
130
+ * Example with multiple conversational turns:
131
+ *
132
+ * ```json
133
+ * [
134
+ * { "role": "user", "content": "Hello there." },
135
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
136
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
137
+ * ]
138
+ * ```
139
+ *
140
+ * Example with a partially-filled response from Claude:
141
+ *
142
+ * ```json
143
+ * [
144
+ * {
145
+ * "role": "user",
146
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
147
+ * },
148
+ * { "role": "assistant", "content": "The best answer is (" }
149
+ * ]
150
+ * ```
151
+ *
152
+ * Each input message `content` may be either a single `string` or an array of
153
+ * content blocks, where each block has a specific `type`. Using a `string` for
154
+ * `content` is shorthand for an array of one content block of type `"text"`. The
155
+ * following input messages are equivalent:
156
+ *
157
+ * ```json
158
+ * { "role": "user", "content": "Hello, Claude" }
159
+ * ```
160
+ *
161
+ * ```json
162
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
163
+ * ```
164
+ *
165
+ * Starting with Claude 3 models, you can also send image content blocks:
166
+ *
167
+ * ```json
168
+ * {
169
+ * "role": "user",
170
+ * "content": [
171
+ * {
172
+ * "type": "image",
173
+ * "source": {
174
+ * "type": "base64",
175
+ * "media_type": "image/jpeg",
176
+ * "data": "/9j/4AAQSkZJRg..."
177
+ * }
178
+ * },
179
+ * { "type": "text", "text": "What is in this image?" }
180
+ * ]
181
+ * }
182
+ * ```
183
+ *
184
+ * We currently support the `base64` source type for images, and the `image/jpeg`,
185
+ * `image/png`, `image/gif`, and `image/webp` media types.
186
+ *
187
+ * See [examples](https://docs.anthropic.com/en/api/messages-examples) for more
188
+ * input examples.
189
+ *
190
+ * Note that if you want to include a
191
+ * [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
192
+ * the top-level `system` parameter — there is no `"system"` role for input
193
+ * messages in the Messages API.
194
+ *
195
+ */
196
+ messages: Array<Message>;
197
+ /**
198
+ * The maximum number of tokens to generate before stopping.
199
+ *
200
+ * Note that our models may stop _before_ reaching this maximum. This parameter
201
+ * only specifies the absolute maximum number of tokens to generate.
202
+ *
203
+ * Different models have different maximum values for this parameter. See
204
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for details.
205
+ *
206
+ */
207
+ max_tokens: number;
208
+ metadata?: CreateMessageRequestMetadata;
209
+ /**
210
+ * Custom text sequences that will cause the model to stop generating.
211
+ *
212
+ * Our models will normally stop when they have naturally completed their turn,
213
+ * which will result in a response `stop_reason` of `"end_turn"`.
214
+ *
215
+ * If you want the model to stop generating when it encounters custom strings of
216
+ * text, you can use the `stop_sequences` parameter. If the model encounters one of
217
+ * the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
218
+ * and the response `stop_sequence` value will contain the matched stop sequence.
219
+ *
220
+ */
221
+ stop_sequences?: Array<string>;
222
+ /**
223
+ * System prompt.
224
+ *
225
+ * A system prompt is a way of providing context and instructions to Claude, such
226
+ * as specifying a particular goal or role. See our
227
+ * [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
228
+ *
229
+ */
230
+ system?: string | Array<Block>;
231
+ /**
232
+ * Amount of randomness injected into the response.
233
+ *
234
+ * Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
235
+ * for analytical / multiple choice, and closer to `1.0` for creative and
236
+ * generative tasks.
237
+ *
238
+ * Note that even with `temperature` of `0.0`, the results will not be fully
239
+ * deterministic.
240
+ *
241
+ */
242
+ temperature?: number;
243
+ tool_choice?: ToolChoice;
244
+ /**
245
+ * Definitions of tools that the model may use.
246
+ *
247
+ * If you include `tools` in your API request, the model may return `tool_use`
248
+ * content blocks that represent the model's use of those tools. You can then run
249
+ * those tools using the tool input generated by the model and then optionally
250
+ * return results back to the model using `tool_result` content blocks.
251
+ *
252
+ * Each tool definition includes:
253
+ *
254
+ * - `name`: Name of the tool.
255
+ * - `description`: Optional, but strongly-recommended description of the tool.
256
+ * - `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`
257
+ * shape that the model will produce in `tool_use` output content blocks.
258
+ *
259
+ * For example, if you defined `tools` as:
260
+ *
261
+ * ```json
262
+ * [
263
+ * {
264
+ * "name": "get_stock_price",
265
+ * "description": "Get the current stock price for a given ticker symbol.",
266
+ * "input_schema": {
267
+ * "type": "object",
268
+ * "properties": {
269
+ * "ticker": {
270
+ * "type": "string",
271
+ * "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
272
+ * }
273
+ * },
274
+ * "required": ["ticker"]
275
+ * }
276
+ * }
277
+ * ]
278
+ * ```
279
+ *
280
+ * And then asked the model "What's the S&P 500 at today?", the model might produce
281
+ * `tool_use` content blocks in the response like this:
282
+ *
283
+ * ```json
284
+ * [
285
+ * {
286
+ * "type": "tool_use",
287
+ * "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
288
+ * "name": "get_stock_price",
289
+ * "input": { "ticker": "^GSPC" }
290
+ * }
291
+ * ]
292
+ * ```
293
+ *
294
+ * You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
295
+ * input, and return the following back to the model in a subsequent `user`
296
+ * message:
297
+ *
298
+ * ```json
299
+ * [
300
+ * {
301
+ * "type": "tool_result",
302
+ * "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
303
+ * "content": "259.75 USD"
304
+ * }
305
+ * ]
306
+ * ```
307
+ *
308
+ * Tools can be used for workflows that include running client-side tools and
309
+ * functions, or more generally whenever you want the model to produce a particular
310
+ * JSON structure of output.
311
+ *
312
+ * See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
313
+ *
314
+ */
315
+ tools?: Array<Tool>;
316
+ /**
317
+ * Only sample from the top K options for each subsequent token.
318
+ *
319
+ * Used to remove "long tail" low probability responses.
320
+ * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
321
+ *
322
+ * Recommended for advanced use cases only. You usually only need to use
323
+ * `temperature`.
324
+ *
325
+ */
326
+ top_k?: number;
327
+ /**
328
+ * Use nucleus sampling.
329
+ *
330
+ * In nucleus sampling, we compute the cumulative distribution over all the options
331
+ * for each subsequent token in decreasing probability order and cut it off once it
332
+ * reaches a particular probability specified by `top_p`. You should either alter
333
+ * `temperature` or `top_p`, but not both.
334
+ *
335
+ * Recommended for advanced use cases only. You usually only need to use
336
+ * `temperature`.
337
+ *
338
+ */
339
+ top_p?: number;
340
+ /**
341
+ * Whether to incrementally stream the response using server-sent events.
342
+ *
343
+ * See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
344
+ * details.
345
+ *
346
+ */
347
+ stream?: boolean;
348
+ };
349
+
350
+ /**
351
+ * An object describing metadata about the request.
352
+ */
353
+ export type CreateMessageRequestMetadata = {
354
+ /**
355
+ * An external identifier for the user who is associated with the request.
356
+ *
357
+ * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
358
+ * this id to help detect abuse. Do not include any identifying information such as
359
+ * name, email address, or phone number.
360
+ *
361
+ */
362
+ user_id?: string;
363
+ };
364
+
365
+ /**
366
+ * An error object.
367
+ */
368
+ export type Error = {
369
+ /**
370
+ * The type of error.
371
+ */
372
+ type: string;
373
+ /**
374
+ * A human-readable error message.
375
+ */
376
+ message: string;
377
+ };
378
+
379
+ /**
380
+ * An error event in a streaming conversation.
381
+ */
382
+ export type ErrorEvent = {
383
+ type: 'error';
384
+ error: Error;
385
+ };
386
+
387
+ /**
388
+ * A block of image content.
389
+ */
390
+ export type ImageBlock = {
391
+ source: ImageBlockSource;
392
+ /**
393
+ * The type of content block.
394
+ */
395
+ type?: 'image';
396
+ cache_control?: CacheControlEphemeral;
397
+ };
398
+
399
+ /**
400
+ * The source of an image block.
401
+ */
402
+ export type ImageBlockSource = {
403
+ /**
404
+ * The base64-encoded image data.
405
+ */
406
+ data: string;
407
+ /**
408
+ * The media type of the image.
409
+ */
410
+ media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
411
+ /**
412
+ * The type of image source.
413
+ */
414
+ type: 'base64';
415
+ };
416
+
417
+ /**
418
+ * The media type of the image.
419
+ */
420
+ export type media_type = 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
421
+
422
+ /**
423
+ * The type of image source.
424
+ */
425
+ export type type2 = 'base64';
426
+
427
+ /**
428
+ * A delta in a streaming input JSON.
429
+ */
430
+ export type InputJsonBlockDelta = {
431
+ /**
432
+ * The partial JSON delta.
433
+ */
434
+ partial_json?: string;
435
+ /**
436
+ * The type of content block.
437
+ */
438
+ type: 'input_json_delta';
439
+ };
440
+
441
+ /**
442
+ * A message in a chat conversation.
443
+ */
444
+ export type Message = {
445
+ /**
446
+ * Unique object identifier.
447
+ *
448
+ * The format and length of IDs may change over time.
449
+ *
450
+ */
451
+ id?: string;
452
+ /**
453
+ * The content of the message.
454
+ */
455
+ content: string | Array<Block>;
456
+ role: MessageRole;
457
+ /**
458
+ * The model that handled the request.
459
+ */
460
+ model?: string;
461
+ stop_reason?: StopReason;
462
+ /**
463
+ * Which custom stop sequence was generated, if any.
464
+ *
465
+ * This value will be a non-null string if one of your custom stop sequences was
466
+ * generated.
467
+ *
468
+ */
469
+ stop_sequence?: string;
470
+ /**
471
+ * Object type.
472
+ *
473
+ * For Messages, this is always `"message"`.
474
+ *
475
+ */
476
+ type?: string;
477
+ usage?: Usage;
478
+ };
479
+
480
+ /**
481
+ * A batch of message requests.
482
+ */
483
+ export type MessageBatch = {
484
+ /**
485
+ * Unique object identifier for the message batch.
486
+ */
487
+ id: string;
488
+ /**
489
+ * RFC 3339 datetime string representing the time at which the Message Batch was created.
490
+ */
491
+ created_at: string;
492
+ /**
493
+ * RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
494
+ */
495
+ expires_at: string;
496
+ /**
497
+ * Processing status of the Message Batch.
498
+ */
499
+ processing_status: 'in_progress' | 'canceling' | 'ended';
500
+ request_counts: MessageBatchRequestCounts;
501
+ /**
502
+ * URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
503
+ */
504
+ results_url?: string | null;
505
+ /**
506
+ * Object type. For Message Batches, this is always `"message_batch"`.
507
+ */
508
+ type: 'message_batch';
509
+ };
510
+
511
+ /**
512
+ * Processing status of the Message Batch.
513
+ */
514
+ export type processing_status = 'in_progress' | 'canceling' | 'ended';
515
+
516
+ /**
517
+ * Object type. For Message Batches, this is always `"message_batch"`.
518
+ */
519
+ export type type3 = 'message_batch';
520
+
521
+ /**
522
+ * Tallies requests within the Message Batch, categorized by their status.
523
+ */
524
+ export type MessageBatchRequestCounts = {
525
+ /**
526
+ * Number of requests in the Message Batch that are processing.
527
+ */
528
+ processing: number;
529
+ /**
530
+ * Number of requests in the Message Batch that have completed successfully.
531
+ */
532
+ succeeded: number;
533
+ /**
534
+ * Number of requests in the Message Batch that encountered an error.
535
+ */
536
+ errored: number;
537
+ /**
538
+ * Number of requests in the Message Batch that have been canceled.
539
+ */
540
+ canceled: number;
541
+ /**
542
+ * Number of requests in the Message Batch that have expired.
543
+ */
544
+ expired: number;
545
+ };
546
+
547
+ /**
548
+ * A delta in a streaming message.
549
+ */
550
+ export type MessageDelta = {
551
+ stop_reason?: StopReason;
552
+ /**
553
+ * Which custom stop sequence was generated, if any.
554
+ *
555
+ * This value will be a non-null string if one of your custom stop sequences was
556
+ * generated.
557
+ *
558
+ */
559
+ stop_sequence?: string;
560
+ };
561
+
562
+ /**
563
+ * A delta event in a streaming conversation.
564
+ */
565
+ export type MessageDeltaEvent = {
566
+ delta: MessageDelta;
567
+ type: 'message_delta';
568
+ usage: MessageDeltaUsage;
569
+ };
570
+
571
+ /**
572
+ * Billing and rate-limit usage.
573
+ *
574
+ * Anthropic's API bills and rate-limits by token counts, as tokens represent the
575
+ * underlying cost to our systems.
576
+ *
577
+ * Under the hood, the API transforms requests into a format suitable for the
578
+ * model. The model's output then goes through a parsing stage before becoming an
579
+ * API response. As a result, the token counts in `usage` will not match one-to-one
580
+ * with the exact visible content of an API request or response.
581
+ *
582
+ * For example, `output_tokens` will be non-zero, even for an empty string response
583
+ * from Claude.
584
+ *
585
+ */
586
+ export type MessageDeltaUsage = {
587
+ /**
588
+ * The cumulative number of output tokens which were used.
589
+ */
590
+ output_tokens: number;
591
+ };
592
+
593
+ /**
594
+ * The role of the messages author.
595
+ */
596
+ export type MessageRole = 'user' | 'assistant';
597
+
598
+ /**
599
+ * A start event in a streaming conversation.
600
+ */
601
+ export type MessageStartEvent = {
602
+ message: Message;
603
+ type: 'message_start';
604
+ };
605
+
606
+ /**
607
+ * A stop event in a streaming conversation.
608
+ */
609
+ export type MessageStopEvent = {
610
+ type: 'message_stop';
611
+ };
612
+
613
+ /**
614
+ * A event in a streaming conversation.
615
+ */
616
+ export type MessageStreamEvent =
617
+ | MessageStartEvent
618
+ | MessageDeltaEvent
619
+ | MessageStopEvent
620
+ | ContentBlockStartEvent
621
+ | ContentBlockDeltaEvent
622
+ | ContentBlockStopEvent
623
+ | PingEvent
624
+ | ErrorEvent;
625
+
626
+ /**
627
+ * The type of a streaming event.
628
+ */
629
+ export type MessageStreamEventType =
630
+ | 'message_start'
631
+ | 'message_delta'
632
+ | 'message_stop'
633
+ | 'content_block_start'
634
+ | 'content_block_delta'
635
+ | 'content_block_stop'
636
+ | 'ping'
637
+ | 'error';
638
+
639
+ /**
640
+ * A ping event in a streaming conversation.
641
+ */
642
+ export type PingEvent = {
643
+ type: 'ping';
644
+ };
645
+
646
+ /**
647
+ * The reason that we stopped.
648
+ *
649
+ * This may be one the following values:
650
+ *
651
+ * - `"end_turn"`: the model reached a natural stopping point
652
+ * - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
653
+ * - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
654
+ * - `"tool_use"`: the model invoked one or more tools
655
+ *
656
+ * In non-streaming mode this value is always non-null. In streaming mode, it is
657
+ * null in the `message_start` event and non-null otherwise.
658
+ *
659
+ */
660
+ export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use';
661
+
662
+ /**
663
+ * A block of text content.
664
+ */
665
+ export type TextBlock = {
666
+ /**
667
+ * The text content.
668
+ */
669
+ text: string;
670
+ /**
671
+ * The type of content block.
672
+ */
673
+ type?: 'text';
674
+ cache_control?: CacheControlEphemeral;
675
+ };
676
+
677
+ /**
678
+ * A delta in a streaming text block.
679
+ */
680
+ export type TextBlockDelta = {
681
+ /**
682
+ * The text delta.
683
+ */
684
+ text: string;
685
+ /**
686
+ * The type of content block.
687
+ */
688
+ type: 'text_delta';
689
+ };
690
+
691
+ /**
692
+ * A tool the model may use.
693
+ */
694
+ export type Tool = ToolCustom | ToolComputerUse | ToolTextEditor | ToolBash;
695
+
696
+ /**
697
+ * A tool for running commands in a bash shell.
698
+ */
699
+ export type ToolBash = {
700
+ /**
701
+ * The type of tool.
702
+ */
703
+ type?: 'ToolBash';
704
+ /**
705
+ * The name of the tool.
706
+ */
707
+ name?: string;
708
+ cache_control?: CacheControlEphemeral;
709
+ };
710
+
711
+ /**
712
+ * How the model should use the provided tools. The model can use a specific tool,
713
+ * any available tool, or decide by itself.
714
+ *
715
+ * - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
716
+ * - `any`: tells Claude that it must use one of the provided tools, but doesn’t force a particular tool.
717
+ * - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field.
718
+ *
719
+ */
720
+ export type ToolChoice = {
721
+ type: ToolChoiceType;
722
+ /**
723
+ * The name of the tool to use.
724
+ */
725
+ name?: string;
726
+ /**
727
+ * Whether to disable parallel tool use.
728
+ */
729
+ disable_parallel_tool_use?: boolean;
730
+ };
731
+
732
+ /**
733
+ * How the model should use the provided tools. The model can use a specific tool,
734
+ * any available tool, or decide by itself.
735
+ *
736
+ * - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
737
+ * - `any`: tells Claude that it must use one of the provided tools, but doesn't force a particular tool.
738
+ * - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field.
739
+ *
740
+ */
741
+ export type ToolChoiceType = 'auto' | 'any' | 'tool';
742
+
743
+ /**
744
+ * A tool that uses a mouse and keyboard to interact with a computer, and take screenshots.
745
+ */
746
+ export type ToolComputerUse = {
747
+ /**
748
+ * The type of tool.
749
+ */
750
+ type?: 'ToolComputerUse';
751
+ /**
752
+ * The name of the tool.
753
+ */
754
+ name?: string;
755
+ cache_control?: CacheControlEphemeral;
756
+ /**
757
+ * The width of the display in pixels.
758
+ */
759
+ display_width_px: number;
760
+ /**
761
+ * The height of the display in pixels.
762
+ */
763
+ display_height_px: number;
764
+ /**
765
+ * The number of the display to use.
766
+ */
767
+ display_number?: number | null;
768
+ };
769
+
770
+ /**
771
+ * A custom tool the model may use.
772
+ */
773
+ export type ToolCustom = {
774
+ /**
775
+ * The type of tool.
776
+ */
777
+ type?: 'ToolCustom';
778
+ /**
779
+ * The name of the tool. Must match the regex `^[a-zA-Z0-9_-]{1,64}$`.
780
+ */
781
+ name: string;
782
+ /**
783
+ * Description of what this tool does.
784
+ *
785
+ * Tool descriptions should be as detailed as possible. The more information that
786
+ * the model has about what the tool is and how to use it, the better it will
787
+ * perform. You can use natural language descriptions to reinforce important
788
+ * aspects of the tool input JSON schema.
789
+ *
790
+ */
791
+ description?: string;
792
+ /**
793
+ * [JSON schema](https://json-schema.org/) for this tool's input.
794
+ *
795
+ * This defines the shape of the `input` that your tool accepts and that the model
796
+ * will produce.
797
+ *
798
+ */
799
+ input_schema: {
800
+ [key: string]: unknown;
801
+ };
802
+ };
803
+
804
+ /**
805
+ * The result of using a tool.
806
+ */
807
+ export type ToolResultBlock = {
808
+ /**
809
+ * The `id` of the tool use request this is a result for.
810
+ */
811
+ tool_use_id: string;
812
+ /**
813
+ * The result of the tool, as a string (e.g. `"content": "15 degrees"`)
814
+ * or list of nested content blocks (e.g. `"content": [{"type": "text", "text": "15 degrees"}]`).
815
+ * These content blocks can use the text or image types.
816
+ *
817
+ */
818
+ content: string | Array<Block>;
819
+ /**
820
+ * Set to `true` if the tool execution resulted in an error.
821
+ */
822
+ is_error?: boolean;
823
+ /**
824
+ * The type of content block.
825
+ */
826
+ type?: 'tool_result';
827
+ cache_control?: CacheControlEphemeral;
828
+ };
829
+
830
+ /**
831
+ * A tool for viewing, creating and editing files.
832
+ */
833
+ export type ToolTextEditor = {
834
+ /**
835
+ * The type of tool.
836
+ */
837
+ type?: 'ToolTextEditor';
838
+ /**
839
+ * The name of the tool.
840
+ */
841
+ name?: string;
842
+ cache_control?: CacheControlEphemeral;
843
+ };
844
+
845
+ /**
846
+ * The tool the model wants to use.
847
+ */
848
+ export type ToolUseBlock = {
849
+ /**
850
+ * A unique identifier for this particular tool use block.
851
+ * This will be used to match up the tool results later.
852
+ *
853
+ */
854
+ id: string;
855
+ /**
856
+ * The name of the tool being used.
857
+ */
858
+ name: string;
859
+ /**
860
+ * An object containing the input being passed to the tool, conforming to the tool's `input_schema`.
861
+ */
862
+ input: {
863
+ [key: string]: unknown;
864
+ };
865
+ /**
866
+ * The type of content block.
867
+ */
868
+ type?: 'tool_use';
869
+ cache_control?: CacheControlEphemeral;
870
+ };
871
+
872
+ /**
873
+ * Billing and rate-limit usage.
874
+ *
875
+ * Anthropic's API bills and rate-limits by token counts, as tokens represent the
876
+ * underlying cost to our systems.
877
+ *
878
+ * Under the hood, the API transforms requests into a format suitable for the
879
+ * model. The model's output then goes through a parsing stage before becoming an
880
+ * API response. As a result, the token counts in `usage` will not match one-to-one
881
+ * with the exact visible content of an API request or response.
882
+ *
883
+ * For example, `output_tokens` will be non-zero, even for an empty string response
884
+ * from Claude.
885
+ *
886
+ */
887
+ export type Usage = {
888
+ /**
889
+ * The number of input tokens which were used.
890
+ */
891
+ input_tokens: number;
892
+ /**
893
+ * The number of output tokens which were used.
894
+ */
895
+ output_tokens: number;
896
+ /**
897
+ * The number of input tokens read from the cache.
898
+ */
899
+ cache_creation_input_tokens?: number;
900
+ /**
901
+ * The number of input tokens used to create the cache entry.
902
+ */
903
+ cache_read_input_tokens?: number;
904
+ };
905
+
906
+ export type CreateMessageData = {
907
+ body: CreateMessageRequest;
908
+ };
909
+
910
+ export type CreateMessageResponse = Message;
911
+
912
+ export type CreateMessageError = unknown;
913
+
914
+ export type CreateMessageBatchData = {
915
+ body: CreateMessageBatchRequest;
916
+ };
917
+
918
+ export type CreateMessageBatchResponse = MessageBatch;
919
+
920
+ export type CreateMessageBatchError = unknown;
921
+
922
+ export type RetrieveMessageBatchData = {
923
+ path: {
924
+ /**
925
+ * The ID of the message batch to retrieve.
926
+ */
927
+ id: string;
928
+ };
929
+ };
930
+
931
+ export type RetrieveMessageBatchResponse = MessageBatch;
932
+
933
+ export type RetrieveMessageBatchError = unknown;