@bodhiapp/ts-client 0.1.26 → 0.1.28
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/anthropic.d.ts +1 -0
- package/dist/anthropic.js +20 -0
- package/dist/anthropic.mjs +2 -0
- package/dist/gemini.d.ts +1 -0
- package/dist/gemini.js +20 -0
- package/dist/gemini.mjs +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/openai.d.ts +1 -0
- package/dist/openai.js +20 -0
- package/dist/openai.mjs +2 -0
- package/dist/openapi-typescript/openapi-schema-anthropic.d.ts +3391 -0
- package/dist/openapi-typescript/openapi-schema-anthropic.ts +3392 -0
- package/dist/openapi-typescript/openapi-schema-gemini.d.ts +3708 -0
- package/dist/openapi-typescript/openapi-schema-gemini.ts +3709 -0
- package/dist/openapi-typescript/openapi-schema-oai.d.ts +4371 -0
- package/dist/openapi-typescript/openapi-schema-oai.ts +4372 -0
- package/dist/openapi-typescript/openapi-schema.d.ts +1453 -3111
- package/dist/openapi-typescript/openapi-schema.ts +1453 -3111
- package/dist/types/types.gen.d.ts +477 -1731
- package/dist/types/types.gen.ts +516 -1903
- package/dist/types-anthropic/index.d.ts +1 -0
- package/dist/types-anthropic/index.ts +2 -0
- package/dist/types-anthropic/types.gen.d.ts +2241 -0
- package/dist/types-anthropic/types.gen.ts +2416 -0
- package/dist/types-gemini/index.d.ts +1 -0
- package/dist/types-gemini/index.ts +2 -0
- package/dist/types-gemini/types.gen.d.ts +4622 -0
- package/dist/types-gemini/types.gen.ts +4849 -0
- package/dist/types-oai/index.d.ts +1 -0
- package/dist/types-oai/index.ts +2 -0
- package/dist/types-oai/types.gen.d.ts +4428 -0
- package/dist/types-oai/types.gen.ts +4810 -0
- package/package.json +39 -7
|
@@ -0,0 +1,2416 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
export type ApiError = {
|
|
4
|
+
message: string;
|
|
5
|
+
type: 'api_error';
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Specifies who can invoke a tool.
|
|
10
|
+
*
|
|
11
|
+
* Values:
|
|
12
|
+
* direct: The model can call this tool directly.
|
|
13
|
+
* code_execution_20250825: The tool can be called from the code execution environment (v1).
|
|
14
|
+
* code_execution_20260120: The tool can be called from the code execution environment (v2 with persistence).
|
|
15
|
+
*/
|
|
16
|
+
export type AllowedCaller = 'direct' | 'code_execution_20250825' | 'code_execution_20260120';
|
|
17
|
+
|
|
18
|
+
export type AuthenticationError = {
|
|
19
|
+
message: string;
|
|
20
|
+
type: 'authentication_error';
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type Base64ImageSource = {
|
|
24
|
+
data: string;
|
|
25
|
+
media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
|
|
26
|
+
type: 'base64';
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type Base64PdfSource = {
|
|
30
|
+
data: string;
|
|
31
|
+
media_type: 'application/pdf';
|
|
32
|
+
type: 'base64';
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type BashCodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded' | 'output_file_too_large';
|
|
36
|
+
|
|
37
|
+
export type BashTool20250124 = {
|
|
38
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
39
|
+
/**
|
|
40
|
+
* Create a cache control breakpoint at this content block.
|
|
41
|
+
*/
|
|
42
|
+
cache_control?: ({
|
|
43
|
+
type?: 'ephemeral';
|
|
44
|
+
} & CacheControlEphemeral) | null;
|
|
45
|
+
/**
|
|
46
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
47
|
+
*/
|
|
48
|
+
defer_loading?: boolean;
|
|
49
|
+
input_examples?: Array<{
|
|
50
|
+
[key: string]: JsonValue;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Name of the tool.
|
|
54
|
+
*
|
|
55
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
56
|
+
*/
|
|
57
|
+
name: 'bash';
|
|
58
|
+
/**
|
|
59
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
60
|
+
*/
|
|
61
|
+
strict?: boolean;
|
|
62
|
+
type: 'bash_20250124';
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type BillingError = {
|
|
66
|
+
message: string;
|
|
67
|
+
type: 'billing_error';
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type CacheControlEphemeral = {
|
|
71
|
+
/**
|
|
72
|
+
* The time-to-live for the cache control breakpoint.
|
|
73
|
+
*
|
|
74
|
+
* This may be one the following values:
|
|
75
|
+
* - `5m`: 5 minutes
|
|
76
|
+
* - `1h`: 1 hour
|
|
77
|
+
*
|
|
78
|
+
* Defaults to `5m`.
|
|
79
|
+
*/
|
|
80
|
+
ttl?: '5m' | '1h';
|
|
81
|
+
type: 'ephemeral';
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type CacheCreation = {
|
|
85
|
+
/**
|
|
86
|
+
* The number of input tokens used to create the 1 hour cache entry.
|
|
87
|
+
*/
|
|
88
|
+
ephemeral_1h_input_tokens: number;
|
|
89
|
+
/**
|
|
90
|
+
* The number of input tokens used to create the 5 minute cache entry.
|
|
91
|
+
*/
|
|
92
|
+
ephemeral_5m_input_tokens: number;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Indicates whether a capability is supported.
|
|
97
|
+
*/
|
|
98
|
+
export type CapabilitySupport = {
|
|
99
|
+
/**
|
|
100
|
+
* Whether this capability is supported by the model.
|
|
101
|
+
*/
|
|
102
|
+
supported: boolean;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export type CodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded';
|
|
106
|
+
|
|
107
|
+
export type CodeExecutionTool20250522 = {
|
|
108
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
109
|
+
/**
|
|
110
|
+
* Create a cache control breakpoint at this content block.
|
|
111
|
+
*/
|
|
112
|
+
cache_control?: ({
|
|
113
|
+
type?: 'ephemeral';
|
|
114
|
+
} & CacheControlEphemeral) | null;
|
|
115
|
+
/**
|
|
116
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
117
|
+
*/
|
|
118
|
+
defer_loading?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Name of the tool.
|
|
121
|
+
*
|
|
122
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
123
|
+
*/
|
|
124
|
+
name: 'code_execution';
|
|
125
|
+
/**
|
|
126
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
127
|
+
*/
|
|
128
|
+
strict?: boolean;
|
|
129
|
+
type: 'code_execution_20250522';
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export type CodeExecutionTool20250825 = {
|
|
133
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
134
|
+
/**
|
|
135
|
+
* Create a cache control breakpoint at this content block.
|
|
136
|
+
*/
|
|
137
|
+
cache_control?: ({
|
|
138
|
+
type?: 'ephemeral';
|
|
139
|
+
} & CacheControlEphemeral) | null;
|
|
140
|
+
/**
|
|
141
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
142
|
+
*/
|
|
143
|
+
defer_loading?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Name of the tool.
|
|
146
|
+
*
|
|
147
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
148
|
+
*/
|
|
149
|
+
name: 'code_execution';
|
|
150
|
+
/**
|
|
151
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
152
|
+
*/
|
|
153
|
+
strict?: boolean;
|
|
154
|
+
type: 'code_execution_20250825';
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
|
|
159
|
+
*/
|
|
160
|
+
export type CodeExecutionTool20260120 = {
|
|
161
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
162
|
+
/**
|
|
163
|
+
* Create a cache control breakpoint at this content block.
|
|
164
|
+
*/
|
|
165
|
+
cache_control?: ({
|
|
166
|
+
type?: 'ephemeral';
|
|
167
|
+
} & CacheControlEphemeral) | null;
|
|
168
|
+
/**
|
|
169
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
170
|
+
*/
|
|
171
|
+
defer_loading?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Name of the tool.
|
|
174
|
+
*
|
|
175
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
176
|
+
*/
|
|
177
|
+
name: 'code_execution';
|
|
178
|
+
/**
|
|
179
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
180
|
+
*/
|
|
181
|
+
strict?: boolean;
|
|
182
|
+
type: 'code_execution_20260120';
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Information about the container used in the request (for the code execution tool)
|
|
187
|
+
*/
|
|
188
|
+
export type Container = {
|
|
189
|
+
/**
|
|
190
|
+
* The time at which the container will expire.
|
|
191
|
+
*/
|
|
192
|
+
expires_at: string;
|
|
193
|
+
/**
|
|
194
|
+
* Identifier for the container used in this request
|
|
195
|
+
*/
|
|
196
|
+
id: string;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export type ContentBlockSource = {
|
|
200
|
+
content: string | Array<({
|
|
201
|
+
type?: 'text';
|
|
202
|
+
} & RequestTextBlock) | ({
|
|
203
|
+
type?: 'image';
|
|
204
|
+
} & RequestImageBlock)>;
|
|
205
|
+
type: 'content';
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Context management capability details.
|
|
210
|
+
*/
|
|
211
|
+
export type ContextManagementCapability = {
|
|
212
|
+
/**
|
|
213
|
+
* Whether the clear_thinking_20251015 strategy is supported.
|
|
214
|
+
*/
|
|
215
|
+
clear_thinking_20251015: CapabilitySupport | null;
|
|
216
|
+
/**
|
|
217
|
+
* Whether the clear_tool_uses_20250919 strategy is supported.
|
|
218
|
+
*/
|
|
219
|
+
clear_tool_uses_20250919: CapabilitySupport | null;
|
|
220
|
+
/**
|
|
221
|
+
* Whether the compact_20260112 strategy is supported.
|
|
222
|
+
*/
|
|
223
|
+
compact_20260112: CapabilitySupport | null;
|
|
224
|
+
/**
|
|
225
|
+
* Whether this capability is supported by the model.
|
|
226
|
+
*/
|
|
227
|
+
supported: boolean;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export type CreateMessageParams = {
|
|
231
|
+
model: Model;
|
|
232
|
+
/**
|
|
233
|
+
* Input messages.
|
|
234
|
+
*
|
|
235
|
+
* Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.
|
|
236
|
+
*
|
|
237
|
+
* Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.
|
|
238
|
+
*
|
|
239
|
+
* If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.
|
|
240
|
+
*
|
|
241
|
+
* Example with a single `user` message:
|
|
242
|
+
*
|
|
243
|
+
* ```json
|
|
244
|
+
* [{"role": "user", "content": "Hello, Claude"}]
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* Example with multiple conversational turns:
|
|
248
|
+
*
|
|
249
|
+
* ```json
|
|
250
|
+
* [
|
|
251
|
+
* {"role": "user", "content": "Hello there."},
|
|
252
|
+
* {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"},
|
|
253
|
+
* {"role": "user", "content": "Can you explain LLMs in plain English?"},
|
|
254
|
+
* ]
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* Example with a partially-filled response from Claude:
|
|
258
|
+
*
|
|
259
|
+
* ```json
|
|
260
|
+
* [
|
|
261
|
+
* {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
|
|
262
|
+
* {"role": "assistant", "content": "The best answer is ("},
|
|
263
|
+
* ]
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent:
|
|
267
|
+
*
|
|
268
|
+
* ```json
|
|
269
|
+
* {"role": "user", "content": "Hello, Claude"}
|
|
270
|
+
* ```
|
|
271
|
+
*
|
|
272
|
+
* ```json
|
|
273
|
+
* {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
|
|
274
|
+
* ```
|
|
275
|
+
*
|
|
276
|
+
* See [input examples](https://docs.claude.com/en/api/messages-examples).
|
|
277
|
+
*
|
|
278
|
+
* Note that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API.
|
|
279
|
+
*
|
|
280
|
+
* There is a limit of 100,000 messages in a single request.
|
|
281
|
+
*/
|
|
282
|
+
messages: Array<InputMessage>;
|
|
283
|
+
/**
|
|
284
|
+
* Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.
|
|
285
|
+
*/
|
|
286
|
+
cache_control?: ({
|
|
287
|
+
type?: 'ephemeral';
|
|
288
|
+
} & CacheControlEphemeral) | null;
|
|
289
|
+
/**
|
|
290
|
+
* Container identifier for reuse across requests.
|
|
291
|
+
*/
|
|
292
|
+
container?: string | null;
|
|
293
|
+
/**
|
|
294
|
+
* Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used.
|
|
295
|
+
*/
|
|
296
|
+
inference_geo?: string | null;
|
|
297
|
+
/**
|
|
298
|
+
* The maximum number of tokens to generate before stopping.
|
|
299
|
+
*
|
|
300
|
+
* Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
|
|
301
|
+
*
|
|
302
|
+
* Different models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details.
|
|
303
|
+
*/
|
|
304
|
+
max_tokens: number;
|
|
305
|
+
/**
|
|
306
|
+
* An object describing metadata about the request.
|
|
307
|
+
*/
|
|
308
|
+
metadata?: Metadata;
|
|
309
|
+
/**
|
|
310
|
+
* Configuration options for the model's output, such as the output format.
|
|
311
|
+
*/
|
|
312
|
+
output_config?: OutputConfig;
|
|
313
|
+
/**
|
|
314
|
+
* Determines whether to use priority capacity (if available) or standard capacity for this request.
|
|
315
|
+
*
|
|
316
|
+
* Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
|
|
317
|
+
*/
|
|
318
|
+
service_tier?: 'auto' | 'standard_only';
|
|
319
|
+
/**
|
|
320
|
+
* Custom text sequences that will cause the model to stop generating.
|
|
321
|
+
*
|
|
322
|
+
* Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`.
|
|
323
|
+
*
|
|
324
|
+
* If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence.
|
|
325
|
+
*/
|
|
326
|
+
stop_sequences?: Array<string>;
|
|
327
|
+
/**
|
|
328
|
+
* Whether to incrementally stream the response using server-sent events.
|
|
329
|
+
*
|
|
330
|
+
* See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
|
|
331
|
+
*/
|
|
332
|
+
stream?: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* System prompt.
|
|
335
|
+
*
|
|
336
|
+
* A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
|
|
337
|
+
*/
|
|
338
|
+
system?: string | Array<RequestTextBlock>;
|
|
339
|
+
/**
|
|
340
|
+
* Amount of randomness injected into the response.
|
|
341
|
+
*
|
|
342
|
+
* Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
|
|
343
|
+
*
|
|
344
|
+
* Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
|
|
345
|
+
* @deprecated
|
|
346
|
+
*/
|
|
347
|
+
temperature?: number;
|
|
348
|
+
thinking?: ThinkingConfigParam;
|
|
349
|
+
tool_choice?: ToolChoice;
|
|
350
|
+
/**
|
|
351
|
+
* Definitions of tools that the model may use.
|
|
352
|
+
*
|
|
353
|
+
* If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.
|
|
354
|
+
*
|
|
355
|
+
* There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
|
356
|
+
*
|
|
357
|
+
* Each tool definition includes:
|
|
358
|
+
*
|
|
359
|
+
* * `name`: Name of the tool.
|
|
360
|
+
* * `description`: Optional, but strongly-recommended description of the tool.
|
|
361
|
+
* * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.
|
|
362
|
+
*
|
|
363
|
+
* For example, if you defined `tools` as:
|
|
364
|
+
*
|
|
365
|
+
* ```json
|
|
366
|
+
* [
|
|
367
|
+
* {
|
|
368
|
+
* "name": "get_stock_price",
|
|
369
|
+
* "description": "Get the current stock price for a given ticker symbol.",
|
|
370
|
+
* "input_schema": {
|
|
371
|
+
* "type": "object",
|
|
372
|
+
* "properties": {
|
|
373
|
+
* "ticker": {
|
|
374
|
+
* "type": "string",
|
|
375
|
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
|
376
|
+
* }
|
|
377
|
+
* },
|
|
378
|
+
* "required": ["ticker"]
|
|
379
|
+
* }
|
|
380
|
+
* }
|
|
381
|
+
* ]
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this:
|
|
385
|
+
*
|
|
386
|
+
* ```json
|
|
387
|
+
* [
|
|
388
|
+
* {
|
|
389
|
+
* "type": "tool_use",
|
|
390
|
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
391
|
+
* "name": "get_stock_price",
|
|
392
|
+
* "input": { "ticker": "^GSPC" }
|
|
393
|
+
* }
|
|
394
|
+
* ]
|
|
395
|
+
* ```
|
|
396
|
+
*
|
|
397
|
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message:
|
|
398
|
+
*
|
|
399
|
+
* ```json
|
|
400
|
+
* [
|
|
401
|
+
* {
|
|
402
|
+
* "type": "tool_result",
|
|
403
|
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
404
|
+
* "content": "259.75 USD"
|
|
405
|
+
* }
|
|
406
|
+
* ]
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.
|
|
410
|
+
*
|
|
411
|
+
* See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
|
|
412
|
+
*/
|
|
413
|
+
tools?: Array<Tool | BashTool20250124 | CodeExecutionTool20250522 | CodeExecutionTool20250825 | CodeExecutionTool20260120 | MemoryTool20250818 | TextEditor20250124 | TextEditor20250429 | TextEditor20250728 | WebSearchTool20250305 | WebFetchTool20250910 | WebSearchTool20260209 | WebFetchTool20260209 | WebFetchTool20260309 | ToolSearchToolBm2520251119 | ToolSearchToolRegex20251119>;
|
|
414
|
+
/**
|
|
415
|
+
* Only sample from the top K options for each subsequent token.
|
|
416
|
+
*
|
|
417
|
+
* Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
|
|
418
|
+
*
|
|
419
|
+
* Recommended for advanced use cases only. You usually only need to use `temperature`.
|
|
420
|
+
* @deprecated
|
|
421
|
+
*/
|
|
422
|
+
top_k?: number;
|
|
423
|
+
/**
|
|
424
|
+
* Use nucleus sampling.
|
|
425
|
+
*
|
|
426
|
+
* In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.
|
|
427
|
+
*
|
|
428
|
+
* Recommended for advanced use cases only. You usually only need to use `temperature`.
|
|
429
|
+
* @deprecated
|
|
430
|
+
*/
|
|
431
|
+
top_p?: number;
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Tool invocation directly from the model.
|
|
436
|
+
*/
|
|
437
|
+
export type DirectCaller = {
|
|
438
|
+
type: 'direct';
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Effort (reasoning_effort) capability details.
|
|
443
|
+
*/
|
|
444
|
+
export type EffortCapability = {
|
|
445
|
+
/**
|
|
446
|
+
* Whether the model supports high effort level.
|
|
447
|
+
*/
|
|
448
|
+
high: CapabilitySupport;
|
|
449
|
+
/**
|
|
450
|
+
* Whether the model supports low effort level.
|
|
451
|
+
*/
|
|
452
|
+
low: CapabilitySupport;
|
|
453
|
+
/**
|
|
454
|
+
* Whether the model supports max effort level.
|
|
455
|
+
*/
|
|
456
|
+
max: CapabilitySupport;
|
|
457
|
+
/**
|
|
458
|
+
* Whether the model supports medium effort level.
|
|
459
|
+
*/
|
|
460
|
+
medium: CapabilitySupport;
|
|
461
|
+
/**
|
|
462
|
+
* Whether this capability is supported by the model.
|
|
463
|
+
*/
|
|
464
|
+
supported: boolean;
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* All possible effort levels.
|
|
469
|
+
*/
|
|
470
|
+
export type EffortLevel = 'low' | 'medium' | 'high' | 'max';
|
|
471
|
+
|
|
472
|
+
export type ErrorResponse = {
|
|
473
|
+
error: ({
|
|
474
|
+
type?: 'invalid_request_error';
|
|
475
|
+
} & InvalidRequestError) | ({
|
|
476
|
+
type?: 'authentication_error';
|
|
477
|
+
} & AuthenticationError) | ({
|
|
478
|
+
type?: 'billing_error';
|
|
479
|
+
} & BillingError) | ({
|
|
480
|
+
type?: 'permission_error';
|
|
481
|
+
} & PermissionError) | ({
|
|
482
|
+
type?: 'not_found_error';
|
|
483
|
+
} & NotFoundError) | ({
|
|
484
|
+
type?: 'rate_limit_error';
|
|
485
|
+
} & RateLimitError) | ({
|
|
486
|
+
type?: 'timeout_error';
|
|
487
|
+
} & GatewayTimeoutError) | ({
|
|
488
|
+
type?: 'api_error';
|
|
489
|
+
} & ApiError) | ({
|
|
490
|
+
type?: 'overloaded_error';
|
|
491
|
+
} & OverloadedError);
|
|
492
|
+
request_id: string | null;
|
|
493
|
+
type: 'error';
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
export type GatewayTimeoutError = {
|
|
497
|
+
message: string;
|
|
498
|
+
type: 'timeout_error';
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
export type InputMessage = {
|
|
502
|
+
content: string | Array<InputContentBlock>;
|
|
503
|
+
role: 'user' | 'assistant';
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
export type InputSchema = {
|
|
507
|
+
properties?: {
|
|
508
|
+
[key: string]: unknown;
|
|
509
|
+
} | null;
|
|
510
|
+
required?: Array<string> | null;
|
|
511
|
+
type: 'object';
|
|
512
|
+
[key: string]: unknown | ({
|
|
513
|
+
[key: string]: unknown;
|
|
514
|
+
} | null) | (Array<string> | null) | 'object' | undefined;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
export type InvalidRequestError = {
|
|
518
|
+
message: string;
|
|
519
|
+
type: 'invalid_request_error';
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
export type JsonOutputFormat = {
|
|
523
|
+
/**
|
|
524
|
+
* The JSON schema of the format
|
|
525
|
+
*/
|
|
526
|
+
schema: {
|
|
527
|
+
[key: string]: unknown;
|
|
528
|
+
};
|
|
529
|
+
type: 'json_schema';
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
export type JsonValue = unknown;
|
|
533
|
+
|
|
534
|
+
export type ListResponseModelInfo = {
|
|
535
|
+
data: Array<ModelInfo>;
|
|
536
|
+
/**
|
|
537
|
+
* First ID in the `data` list. Can be used as the `before_id` for the previous page.
|
|
538
|
+
*/
|
|
539
|
+
first_id: string | null;
|
|
540
|
+
/**
|
|
541
|
+
* Indicates if there are more results in the requested page direction.
|
|
542
|
+
*/
|
|
543
|
+
has_more: boolean;
|
|
544
|
+
/**
|
|
545
|
+
* Last ID in the `data` list. Can be used as the `after_id` for the next page.
|
|
546
|
+
*/
|
|
547
|
+
last_id: string | null;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
export type MemoryTool20250818 = {
|
|
551
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
552
|
+
/**
|
|
553
|
+
* Create a cache control breakpoint at this content block.
|
|
554
|
+
*/
|
|
555
|
+
cache_control?: ({
|
|
556
|
+
type?: 'ephemeral';
|
|
557
|
+
} & CacheControlEphemeral) | null;
|
|
558
|
+
/**
|
|
559
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
560
|
+
*/
|
|
561
|
+
defer_loading?: boolean;
|
|
562
|
+
input_examples?: Array<{
|
|
563
|
+
[key: string]: JsonValue;
|
|
564
|
+
}>;
|
|
565
|
+
/**
|
|
566
|
+
* Name of the tool.
|
|
567
|
+
*
|
|
568
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
569
|
+
*/
|
|
570
|
+
name: 'memory';
|
|
571
|
+
/**
|
|
572
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
573
|
+
*/
|
|
574
|
+
strict?: boolean;
|
|
575
|
+
type: 'memory_20250818';
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
export type Message = {
|
|
579
|
+
/**
|
|
580
|
+
* Unique object identifier.
|
|
581
|
+
*
|
|
582
|
+
* The format and length of IDs may change over time.
|
|
583
|
+
*/
|
|
584
|
+
id: string;
|
|
585
|
+
/**
|
|
586
|
+
* Object type.
|
|
587
|
+
*
|
|
588
|
+
* For Messages, this is always `"message"`.
|
|
589
|
+
*/
|
|
590
|
+
type: 'message';
|
|
591
|
+
/**
|
|
592
|
+
* Conversational role of the generated message.
|
|
593
|
+
*
|
|
594
|
+
* This will always be `"assistant"`.
|
|
595
|
+
*/
|
|
596
|
+
role: 'assistant';
|
|
597
|
+
/**
|
|
598
|
+
* Content generated by the model.
|
|
599
|
+
*
|
|
600
|
+
* This is an array of content blocks, each of which has a `type` that determines its shape.
|
|
601
|
+
*
|
|
602
|
+
* Example:
|
|
603
|
+
*
|
|
604
|
+
* ```json
|
|
605
|
+
* [{"type": "text", "text": "Hi, I'm Claude."}]
|
|
606
|
+
* ```
|
|
607
|
+
*
|
|
608
|
+
* If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.
|
|
609
|
+
*
|
|
610
|
+
* For example, if the input `messages` were:
|
|
611
|
+
* ```json
|
|
612
|
+
* [
|
|
613
|
+
* {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
|
|
614
|
+
* {"role": "assistant", "content": "The best answer is ("}
|
|
615
|
+
* ]
|
|
616
|
+
* ```
|
|
617
|
+
*
|
|
618
|
+
* Then the response `content` might be:
|
|
619
|
+
*
|
|
620
|
+
* ```json
|
|
621
|
+
* [{"type": "text", "text": "B)"}]
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
content: Array<ContentBlock>;
|
|
625
|
+
model: Model;
|
|
626
|
+
/**
|
|
627
|
+
* The reason that we stopped.
|
|
628
|
+
*
|
|
629
|
+
* This may be one the following values:
|
|
630
|
+
* * `"end_turn"`: the model reached a natural stopping point
|
|
631
|
+
* * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
|
632
|
+
* * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
|
633
|
+
* * `"tool_use"`: the model invoked one or more tools
|
|
634
|
+
* * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
|
|
635
|
+
* * `"refusal"`: when streaming classifiers intervene to handle potential policy violations
|
|
636
|
+
*
|
|
637
|
+
* In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.
|
|
638
|
+
*/
|
|
639
|
+
stop_reason: StopReason | null;
|
|
640
|
+
/**
|
|
641
|
+
* Which custom stop sequence was generated, if any.
|
|
642
|
+
*
|
|
643
|
+
* This value will be a non-null string if one of your custom stop sequences was generated.
|
|
644
|
+
*/
|
|
645
|
+
stop_sequence: string | null;
|
|
646
|
+
/**
|
|
647
|
+
* Structured information about why model output stopped.
|
|
648
|
+
*
|
|
649
|
+
* This is `null` when the `stop_reason` has no additional detail to report.
|
|
650
|
+
*/
|
|
651
|
+
stop_details: RefusalStopDetails | null;
|
|
652
|
+
/**
|
|
653
|
+
* Billing and rate-limit usage.
|
|
654
|
+
*
|
|
655
|
+
* Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
|
|
656
|
+
*
|
|
657
|
+
* Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
|
|
658
|
+
*
|
|
659
|
+
* For example, `output_tokens` will be non-zero, even for an empty string response from Claude.
|
|
660
|
+
*
|
|
661
|
+
* Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.
|
|
662
|
+
*/
|
|
663
|
+
usage: Usage;
|
|
664
|
+
/**
|
|
665
|
+
* Information about the container used in this request.
|
|
666
|
+
*
|
|
667
|
+
* This will be non-null if a container tool (e.g. code execution) was used.
|
|
668
|
+
*/
|
|
669
|
+
container: Container | null;
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
export type Metadata = {
|
|
673
|
+
/**
|
|
674
|
+
* An external identifier for the user who is associated with the request.
|
|
675
|
+
*
|
|
676
|
+
* This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
|
|
677
|
+
*/
|
|
678
|
+
user_id?: string | null;
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Model capability information.
|
|
683
|
+
*/
|
|
684
|
+
export type ModelCapabilities = {
|
|
685
|
+
/**
|
|
686
|
+
* Whether the model supports the Batch API.
|
|
687
|
+
*/
|
|
688
|
+
batch: CapabilitySupport;
|
|
689
|
+
/**
|
|
690
|
+
* Whether the model supports citation generation.
|
|
691
|
+
*/
|
|
692
|
+
citations: CapabilitySupport;
|
|
693
|
+
/**
|
|
694
|
+
* Whether the model supports code execution tools.
|
|
695
|
+
*/
|
|
696
|
+
code_execution: CapabilitySupport;
|
|
697
|
+
/**
|
|
698
|
+
* Context management support and available strategies.
|
|
699
|
+
*/
|
|
700
|
+
context_management: ContextManagementCapability;
|
|
701
|
+
/**
|
|
702
|
+
* Effort (reasoning_effort) support and available levels.
|
|
703
|
+
*/
|
|
704
|
+
effort: EffortCapability;
|
|
705
|
+
/**
|
|
706
|
+
* Whether the model accepts image content blocks.
|
|
707
|
+
*/
|
|
708
|
+
image_input: CapabilitySupport;
|
|
709
|
+
/**
|
|
710
|
+
* Whether the model accepts PDF content blocks.
|
|
711
|
+
*/
|
|
712
|
+
pdf_input: CapabilitySupport;
|
|
713
|
+
/**
|
|
714
|
+
* Whether the model supports structured output / JSON mode / strict tool schemas.
|
|
715
|
+
*/
|
|
716
|
+
structured_outputs: CapabilitySupport;
|
|
717
|
+
/**
|
|
718
|
+
* Thinking capability and supported type configurations.
|
|
719
|
+
*/
|
|
720
|
+
thinking: ThinkingCapability;
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
export type ModelInfo = {
|
|
724
|
+
/**
|
|
725
|
+
* Object mapping capability names to their support details. Keys are always present for all known capabilities.
|
|
726
|
+
*/
|
|
727
|
+
capabilities: ModelCapabilities | null;
|
|
728
|
+
/**
|
|
729
|
+
* RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.
|
|
730
|
+
*/
|
|
731
|
+
created_at: string;
|
|
732
|
+
/**
|
|
733
|
+
* A human-readable name for the model.
|
|
734
|
+
*/
|
|
735
|
+
display_name: string;
|
|
736
|
+
/**
|
|
737
|
+
* Unique model identifier.
|
|
738
|
+
*/
|
|
739
|
+
id: string;
|
|
740
|
+
/**
|
|
741
|
+
* Maximum input context window size in tokens for this model.
|
|
742
|
+
*/
|
|
743
|
+
max_input_tokens: number | null;
|
|
744
|
+
/**
|
|
745
|
+
* Maximum value for the `max_tokens` parameter when using this model.
|
|
746
|
+
*/
|
|
747
|
+
max_tokens: number | null;
|
|
748
|
+
/**
|
|
749
|
+
* Object type.
|
|
750
|
+
*
|
|
751
|
+
* For Models, this is always `"model"`.
|
|
752
|
+
*/
|
|
753
|
+
type: 'model';
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
export type NotFoundError = {
|
|
757
|
+
message: string;
|
|
758
|
+
type: 'not_found_error';
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
export type OutputConfig = {
|
|
762
|
+
/**
|
|
763
|
+
* How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.
|
|
764
|
+
*
|
|
765
|
+
* Valid values are `low`, `medium`, `high`, or `max`.
|
|
766
|
+
*/
|
|
767
|
+
effort?: EffortLevel | null;
|
|
768
|
+
/**
|
|
769
|
+
* A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
|
|
770
|
+
*/
|
|
771
|
+
format?: JsonOutputFormat | null;
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
export type OverloadedError = {
|
|
775
|
+
message: string;
|
|
776
|
+
type: 'overloaded_error';
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
export type PermissionError = {
|
|
780
|
+
message: string;
|
|
781
|
+
type: 'permission_error';
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
export type PlainTextSource = {
|
|
785
|
+
data: string;
|
|
786
|
+
media_type: 'text/plain';
|
|
787
|
+
type: 'text';
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
export type RateLimitError = {
|
|
791
|
+
message: string;
|
|
792
|
+
type: 'rate_limit_error';
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Structured information about a refusal.
|
|
797
|
+
*/
|
|
798
|
+
export type RefusalStopDetails = {
|
|
799
|
+
/**
|
|
800
|
+
* The policy category that triggered the refusal.
|
|
801
|
+
*
|
|
802
|
+
* `null` when the refusal doesn't map to a named category.
|
|
803
|
+
*/
|
|
804
|
+
category: ('cyber' | 'bio') | null;
|
|
805
|
+
/**
|
|
806
|
+
* Human-readable explanation of the refusal.
|
|
807
|
+
*
|
|
808
|
+
* This text is not guaranteed to be stable. `null` when no explanation is available for the category.
|
|
809
|
+
*/
|
|
810
|
+
explanation: string | null;
|
|
811
|
+
type: 'refusal';
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
export type RequestBashCodeExecutionOutputBlock = {
|
|
815
|
+
file_id: string;
|
|
816
|
+
type: 'bash_code_execution_output';
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
export type RequestBashCodeExecutionResultBlock = {
|
|
820
|
+
content: Array<RequestBashCodeExecutionOutputBlock>;
|
|
821
|
+
return_code: number;
|
|
822
|
+
stderr: string;
|
|
823
|
+
stdout: string;
|
|
824
|
+
type: 'bash_code_execution_result';
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
export type RequestBashCodeExecutionToolResultBlock = {
|
|
828
|
+
/**
|
|
829
|
+
* Create a cache control breakpoint at this content block.
|
|
830
|
+
*/
|
|
831
|
+
cache_control?: ({
|
|
832
|
+
type?: 'ephemeral';
|
|
833
|
+
} & CacheControlEphemeral) | null;
|
|
834
|
+
content: RequestBashCodeExecutionToolResultError | RequestBashCodeExecutionResultBlock;
|
|
835
|
+
tool_use_id: string;
|
|
836
|
+
type: 'bash_code_execution_tool_result';
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
export type RequestBashCodeExecutionToolResultError = {
|
|
840
|
+
error_code: BashCodeExecutionToolResultErrorCode;
|
|
841
|
+
type: 'bash_code_execution_tool_result_error';
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
export type RequestCharLocationCitation = {
|
|
845
|
+
cited_text: string;
|
|
846
|
+
document_index: number;
|
|
847
|
+
document_title: string | null;
|
|
848
|
+
end_char_index: number;
|
|
849
|
+
start_char_index: number;
|
|
850
|
+
type: 'char_location';
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
export type RequestCitationsConfig = {
|
|
854
|
+
enabled?: boolean;
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
export type RequestCodeExecutionOutputBlock = {
|
|
858
|
+
file_id: string;
|
|
859
|
+
type: 'code_execution_output';
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
export type RequestCodeExecutionResultBlock = {
|
|
863
|
+
content: Array<RequestCodeExecutionOutputBlock>;
|
|
864
|
+
return_code: number;
|
|
865
|
+
stderr: string;
|
|
866
|
+
stdout: string;
|
|
867
|
+
type: 'code_execution_result';
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
export type RequestCodeExecutionToolResultBlock = {
|
|
871
|
+
/**
|
|
872
|
+
* Create a cache control breakpoint at this content block.
|
|
873
|
+
*/
|
|
874
|
+
cache_control?: ({
|
|
875
|
+
type?: 'ephemeral';
|
|
876
|
+
} & CacheControlEphemeral) | null;
|
|
877
|
+
content: RequestCodeExecutionToolResultError | RequestCodeExecutionResultBlock | RequestEncryptedCodeExecutionResultBlock;
|
|
878
|
+
tool_use_id: string;
|
|
879
|
+
type: 'code_execution_tool_result';
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
export type RequestCodeExecutionToolResultError = {
|
|
883
|
+
error_code: CodeExecutionToolResultErrorCode;
|
|
884
|
+
type: 'code_execution_tool_result_error';
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* A content block that represents a file to be uploaded to the container
|
|
889
|
+
* Files uploaded via this block will be available in the container's input directory.
|
|
890
|
+
*/
|
|
891
|
+
export type RequestContainerUploadBlock = {
|
|
892
|
+
/**
|
|
893
|
+
* Create a cache control breakpoint at this content block.
|
|
894
|
+
*/
|
|
895
|
+
cache_control?: ({
|
|
896
|
+
type?: 'ephemeral';
|
|
897
|
+
} & CacheControlEphemeral) | null;
|
|
898
|
+
file_id: string;
|
|
899
|
+
type: 'container_upload';
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
export type RequestContentBlockLocationCitation = {
|
|
903
|
+
cited_text: string;
|
|
904
|
+
document_index: number;
|
|
905
|
+
document_title: string | null;
|
|
906
|
+
end_block_index: number;
|
|
907
|
+
start_block_index: number;
|
|
908
|
+
type: 'content_block_location';
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
export type RequestDocumentBlock = {
|
|
912
|
+
/**
|
|
913
|
+
* Create a cache control breakpoint at this content block.
|
|
914
|
+
*/
|
|
915
|
+
cache_control?: ({
|
|
916
|
+
type?: 'ephemeral';
|
|
917
|
+
} & CacheControlEphemeral) | null;
|
|
918
|
+
citations?: RequestCitationsConfig | null;
|
|
919
|
+
context?: string | null;
|
|
920
|
+
source: ({
|
|
921
|
+
type?: 'base64';
|
|
922
|
+
} & Base64PdfSource) | ({
|
|
923
|
+
type?: 'text';
|
|
924
|
+
} & PlainTextSource) | ({
|
|
925
|
+
type?: 'content';
|
|
926
|
+
} & ContentBlockSource) | ({
|
|
927
|
+
type?: 'url';
|
|
928
|
+
} & UrlpdfSource);
|
|
929
|
+
title?: string | null;
|
|
930
|
+
type: 'document';
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Code execution result with encrypted stdout for PFC + web_search results.
|
|
935
|
+
*/
|
|
936
|
+
export type RequestEncryptedCodeExecutionResultBlock = {
|
|
937
|
+
content: Array<RequestCodeExecutionOutputBlock>;
|
|
938
|
+
encrypted_stdout: string;
|
|
939
|
+
return_code: number;
|
|
940
|
+
stderr: string;
|
|
941
|
+
type: 'encrypted_code_execution_result';
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
export type RequestImageBlock = {
|
|
945
|
+
/**
|
|
946
|
+
* Create a cache control breakpoint at this content block.
|
|
947
|
+
*/
|
|
948
|
+
cache_control?: ({
|
|
949
|
+
type?: 'ephemeral';
|
|
950
|
+
} & CacheControlEphemeral) | null;
|
|
951
|
+
source: ({
|
|
952
|
+
type?: 'base64';
|
|
953
|
+
} & Base64ImageSource) | ({
|
|
954
|
+
type?: 'url';
|
|
955
|
+
} & UrlImageSource);
|
|
956
|
+
type: 'image';
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
export type RequestPageLocationCitation = {
|
|
960
|
+
cited_text: string;
|
|
961
|
+
document_index: number;
|
|
962
|
+
document_title: string | null;
|
|
963
|
+
end_page_number: number;
|
|
964
|
+
start_page_number: number;
|
|
965
|
+
type: 'page_location';
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
export type RequestRedactedThinkingBlock = {
|
|
969
|
+
data: string;
|
|
970
|
+
type: 'redacted_thinking';
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
export type RequestSearchResultBlock = {
|
|
974
|
+
/**
|
|
975
|
+
* Create a cache control breakpoint at this content block.
|
|
976
|
+
*/
|
|
977
|
+
cache_control?: ({
|
|
978
|
+
type?: 'ephemeral';
|
|
979
|
+
} & CacheControlEphemeral) | null;
|
|
980
|
+
citations?: RequestCitationsConfig;
|
|
981
|
+
content: Array<RequestTextBlock>;
|
|
982
|
+
source: string;
|
|
983
|
+
title: string;
|
|
984
|
+
type: 'search_result';
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
export type RequestSearchResultLocationCitation = {
|
|
988
|
+
cited_text: string;
|
|
989
|
+
end_block_index: number;
|
|
990
|
+
search_result_index: number;
|
|
991
|
+
source: string;
|
|
992
|
+
start_block_index: number;
|
|
993
|
+
title: string | null;
|
|
994
|
+
type: 'search_result_location';
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
export type RequestServerToolUseBlock = {
|
|
998
|
+
/**
|
|
999
|
+
* Create a cache control breakpoint at this content block.
|
|
1000
|
+
*/
|
|
1001
|
+
cache_control?: ({
|
|
1002
|
+
type?: 'ephemeral';
|
|
1003
|
+
} & CacheControlEphemeral) | null;
|
|
1004
|
+
caller?: ({
|
|
1005
|
+
type?: 'direct';
|
|
1006
|
+
} & DirectCaller) | ({
|
|
1007
|
+
type?: 'code_execution_20250825';
|
|
1008
|
+
} & ServerToolCaller) | ({
|
|
1009
|
+
type?: 'code_execution_20260120';
|
|
1010
|
+
} & ServerToolCaller20260120);
|
|
1011
|
+
id: string;
|
|
1012
|
+
input: {
|
|
1013
|
+
[key: string]: unknown;
|
|
1014
|
+
};
|
|
1015
|
+
name: 'web_search' | 'web_fetch' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution' | 'tool_search_tool_regex' | 'tool_search_tool_bm25';
|
|
1016
|
+
type: 'server_tool_use';
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
export type RequestTextBlock = {
|
|
1020
|
+
/**
|
|
1021
|
+
* Create a cache control breakpoint at this content block.
|
|
1022
|
+
*/
|
|
1023
|
+
cache_control?: ({
|
|
1024
|
+
type?: 'ephemeral';
|
|
1025
|
+
} & CacheControlEphemeral) | null;
|
|
1026
|
+
citations?: Array<({
|
|
1027
|
+
type?: 'char_location';
|
|
1028
|
+
} & RequestCharLocationCitation) | ({
|
|
1029
|
+
type?: 'page_location';
|
|
1030
|
+
} & RequestPageLocationCitation) | ({
|
|
1031
|
+
type?: 'content_block_location';
|
|
1032
|
+
} & RequestContentBlockLocationCitation) | ({
|
|
1033
|
+
type?: 'web_search_result_location';
|
|
1034
|
+
} & RequestWebSearchResultLocationCitation) | ({
|
|
1035
|
+
type?: 'search_result_location';
|
|
1036
|
+
} & RequestSearchResultLocationCitation)> | null;
|
|
1037
|
+
text: string;
|
|
1038
|
+
type: 'text';
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
export type RequestTextEditorCodeExecutionCreateResultBlock = {
|
|
1042
|
+
is_file_update: boolean;
|
|
1043
|
+
type: 'text_editor_code_execution_create_result';
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
export type RequestTextEditorCodeExecutionStrReplaceResultBlock = {
|
|
1047
|
+
lines?: Array<string> | null;
|
|
1048
|
+
new_lines?: number | null;
|
|
1049
|
+
new_start?: number | null;
|
|
1050
|
+
old_lines?: number | null;
|
|
1051
|
+
old_start?: number | null;
|
|
1052
|
+
type: 'text_editor_code_execution_str_replace_result';
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
export type RequestTextEditorCodeExecutionToolResultBlock = {
|
|
1056
|
+
/**
|
|
1057
|
+
* Create a cache control breakpoint at this content block.
|
|
1058
|
+
*/
|
|
1059
|
+
cache_control?: ({
|
|
1060
|
+
type?: 'ephemeral';
|
|
1061
|
+
} & CacheControlEphemeral) | null;
|
|
1062
|
+
content: RequestTextEditorCodeExecutionToolResultError | RequestTextEditorCodeExecutionViewResultBlock | RequestTextEditorCodeExecutionCreateResultBlock | RequestTextEditorCodeExecutionStrReplaceResultBlock;
|
|
1063
|
+
tool_use_id: string;
|
|
1064
|
+
type: 'text_editor_code_execution_tool_result';
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
export type RequestTextEditorCodeExecutionToolResultError = {
|
|
1068
|
+
error_code: TextEditorCodeExecutionToolResultErrorCode;
|
|
1069
|
+
error_message?: string | null;
|
|
1070
|
+
type: 'text_editor_code_execution_tool_result_error';
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
export type RequestTextEditorCodeExecutionViewResultBlock = {
|
|
1074
|
+
content: string;
|
|
1075
|
+
file_type: 'text' | 'image' | 'pdf';
|
|
1076
|
+
num_lines?: number | null;
|
|
1077
|
+
start_line?: number | null;
|
|
1078
|
+
total_lines?: number | null;
|
|
1079
|
+
type: 'text_editor_code_execution_view_result';
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
export type RequestThinkingBlock = {
|
|
1083
|
+
signature: string;
|
|
1084
|
+
thinking: string;
|
|
1085
|
+
type: 'thinking';
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Tool reference block that can be included in tool_result content.
|
|
1090
|
+
*/
|
|
1091
|
+
export type RequestToolReferenceBlock = {
|
|
1092
|
+
/**
|
|
1093
|
+
* Create a cache control breakpoint at this content block.
|
|
1094
|
+
*/
|
|
1095
|
+
cache_control?: ({
|
|
1096
|
+
type?: 'ephemeral';
|
|
1097
|
+
} & CacheControlEphemeral) | null;
|
|
1098
|
+
tool_name: string;
|
|
1099
|
+
type: 'tool_reference';
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
export type RequestToolResultBlock = {
|
|
1103
|
+
/**
|
|
1104
|
+
* Create a cache control breakpoint at this content block.
|
|
1105
|
+
*/
|
|
1106
|
+
cache_control?: ({
|
|
1107
|
+
type?: 'ephemeral';
|
|
1108
|
+
} & CacheControlEphemeral) | null;
|
|
1109
|
+
content?: string | Array<({
|
|
1110
|
+
type?: 'text';
|
|
1111
|
+
} & RequestTextBlock) | ({
|
|
1112
|
+
type?: 'image';
|
|
1113
|
+
} & RequestImageBlock) | ({
|
|
1114
|
+
type?: 'search_result';
|
|
1115
|
+
} & RequestSearchResultBlock) | ({
|
|
1116
|
+
type?: 'document';
|
|
1117
|
+
} & RequestDocumentBlock) | ({
|
|
1118
|
+
type?: 'tool_reference';
|
|
1119
|
+
} & RequestToolReferenceBlock)>;
|
|
1120
|
+
is_error?: boolean;
|
|
1121
|
+
tool_use_id: string;
|
|
1122
|
+
type: 'tool_result';
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
export type RequestToolSearchToolResultBlock = {
|
|
1126
|
+
/**
|
|
1127
|
+
* Create a cache control breakpoint at this content block.
|
|
1128
|
+
*/
|
|
1129
|
+
cache_control?: ({
|
|
1130
|
+
type?: 'ephemeral';
|
|
1131
|
+
} & CacheControlEphemeral) | null;
|
|
1132
|
+
content: RequestToolSearchToolResultError | RequestToolSearchToolSearchResultBlock;
|
|
1133
|
+
tool_use_id: string;
|
|
1134
|
+
type: 'tool_search_tool_result';
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
export type RequestToolSearchToolResultError = {
|
|
1138
|
+
error_code: ToolSearchToolResultErrorCode;
|
|
1139
|
+
type: 'tool_search_tool_result_error';
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
export type RequestToolSearchToolSearchResultBlock = {
|
|
1143
|
+
tool_references: Array<RequestToolReferenceBlock>;
|
|
1144
|
+
type: 'tool_search_tool_search_result';
|
|
1145
|
+
};
|
|
1146
|
+
|
|
1147
|
+
export type RequestToolUseBlock = {
|
|
1148
|
+
/**
|
|
1149
|
+
* Create a cache control breakpoint at this content block.
|
|
1150
|
+
*/
|
|
1151
|
+
cache_control?: ({
|
|
1152
|
+
type?: 'ephemeral';
|
|
1153
|
+
} & CacheControlEphemeral) | null;
|
|
1154
|
+
caller?: ({
|
|
1155
|
+
type?: 'direct';
|
|
1156
|
+
} & DirectCaller) | ({
|
|
1157
|
+
type?: 'code_execution_20250825';
|
|
1158
|
+
} & ServerToolCaller) | ({
|
|
1159
|
+
type?: 'code_execution_20260120';
|
|
1160
|
+
} & ServerToolCaller20260120);
|
|
1161
|
+
id: string;
|
|
1162
|
+
input: {
|
|
1163
|
+
[key: string]: unknown;
|
|
1164
|
+
};
|
|
1165
|
+
name: string;
|
|
1166
|
+
type: 'tool_use';
|
|
1167
|
+
};
|
|
1168
|
+
|
|
1169
|
+
export type RequestWebFetchResultBlock = {
|
|
1170
|
+
content: RequestDocumentBlock;
|
|
1171
|
+
/**
|
|
1172
|
+
* ISO 8601 timestamp when the content was retrieved
|
|
1173
|
+
*/
|
|
1174
|
+
retrieved_at?: string | null;
|
|
1175
|
+
type: 'web_fetch_result';
|
|
1176
|
+
/**
|
|
1177
|
+
* Fetched content URL
|
|
1178
|
+
*/
|
|
1179
|
+
url: string;
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
export type RequestWebFetchToolResultBlock = {
|
|
1183
|
+
/**
|
|
1184
|
+
* Create a cache control breakpoint at this content block.
|
|
1185
|
+
*/
|
|
1186
|
+
cache_control?: ({
|
|
1187
|
+
type?: 'ephemeral';
|
|
1188
|
+
} & CacheControlEphemeral) | null;
|
|
1189
|
+
caller?: ({
|
|
1190
|
+
type?: 'direct';
|
|
1191
|
+
} & DirectCaller) | ({
|
|
1192
|
+
type?: 'code_execution_20250825';
|
|
1193
|
+
} & ServerToolCaller) | ({
|
|
1194
|
+
type?: 'code_execution_20260120';
|
|
1195
|
+
} & ServerToolCaller20260120);
|
|
1196
|
+
content: RequestWebFetchToolResultError | RequestWebFetchResultBlock;
|
|
1197
|
+
tool_use_id: string;
|
|
1198
|
+
type: 'web_fetch_tool_result';
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
export type RequestWebFetchToolResultError = {
|
|
1202
|
+
error_code: WebFetchToolResultErrorCode;
|
|
1203
|
+
type: 'web_fetch_tool_result_error';
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1206
|
+
export type RequestWebSearchResultBlock = {
|
|
1207
|
+
encrypted_content: string;
|
|
1208
|
+
page_age?: string | null;
|
|
1209
|
+
title: string;
|
|
1210
|
+
type: 'web_search_result';
|
|
1211
|
+
url: string;
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
export type RequestWebSearchResultLocationCitation = {
|
|
1215
|
+
cited_text: string;
|
|
1216
|
+
encrypted_index: string;
|
|
1217
|
+
title: string | null;
|
|
1218
|
+
type: 'web_search_result_location';
|
|
1219
|
+
url: string;
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
export type RequestWebSearchToolResultBlock = {
|
|
1223
|
+
/**
|
|
1224
|
+
* Create a cache control breakpoint at this content block.
|
|
1225
|
+
*/
|
|
1226
|
+
cache_control?: ({
|
|
1227
|
+
type?: 'ephemeral';
|
|
1228
|
+
} & CacheControlEphemeral) | null;
|
|
1229
|
+
caller?: ({
|
|
1230
|
+
type?: 'direct';
|
|
1231
|
+
} & DirectCaller) | ({
|
|
1232
|
+
type?: 'code_execution_20250825';
|
|
1233
|
+
} & ServerToolCaller) | ({
|
|
1234
|
+
type?: 'code_execution_20260120';
|
|
1235
|
+
} & ServerToolCaller20260120);
|
|
1236
|
+
content: Array<RequestWebSearchResultBlock> | RequestWebSearchToolResultError;
|
|
1237
|
+
tool_use_id: string;
|
|
1238
|
+
type: 'web_search_tool_result';
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
export type RequestWebSearchToolResultError = {
|
|
1242
|
+
error_code: WebSearchToolResultErrorCode;
|
|
1243
|
+
type: 'web_search_tool_result_error';
|
|
1244
|
+
};
|
|
1245
|
+
|
|
1246
|
+
export type ResponseBashCodeExecutionOutputBlock = {
|
|
1247
|
+
file_id: string;
|
|
1248
|
+
type: 'bash_code_execution_output';
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
export type ResponseBashCodeExecutionResultBlock = {
|
|
1252
|
+
content: Array<ResponseBashCodeExecutionOutputBlock>;
|
|
1253
|
+
return_code: number;
|
|
1254
|
+
stderr: string;
|
|
1255
|
+
stdout: string;
|
|
1256
|
+
type: 'bash_code_execution_result';
|
|
1257
|
+
};
|
|
1258
|
+
|
|
1259
|
+
export type ResponseBashCodeExecutionToolResultBlock = {
|
|
1260
|
+
content: ResponseBashCodeExecutionToolResultError | ResponseBashCodeExecutionResultBlock;
|
|
1261
|
+
tool_use_id: string;
|
|
1262
|
+
type: 'bash_code_execution_tool_result';
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
export type ResponseBashCodeExecutionToolResultError = {
|
|
1266
|
+
error_code: BashCodeExecutionToolResultErrorCode;
|
|
1267
|
+
type: 'bash_code_execution_tool_result_error';
|
|
1268
|
+
};
|
|
1269
|
+
|
|
1270
|
+
export type ResponseCharLocationCitation = {
|
|
1271
|
+
cited_text: string;
|
|
1272
|
+
document_index: number;
|
|
1273
|
+
document_title: string | null;
|
|
1274
|
+
end_char_index: number;
|
|
1275
|
+
file_id: string | null;
|
|
1276
|
+
start_char_index: number;
|
|
1277
|
+
type: 'char_location';
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
export type ResponseCitationsConfig = {
|
|
1281
|
+
enabled: boolean;
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1284
|
+
export type ResponseCodeExecutionOutputBlock = {
|
|
1285
|
+
file_id: string;
|
|
1286
|
+
type: 'code_execution_output';
|
|
1287
|
+
};
|
|
1288
|
+
|
|
1289
|
+
export type ResponseCodeExecutionResultBlock = {
|
|
1290
|
+
content: Array<ResponseCodeExecutionOutputBlock>;
|
|
1291
|
+
return_code: number;
|
|
1292
|
+
stderr: string;
|
|
1293
|
+
stdout: string;
|
|
1294
|
+
type: 'code_execution_result';
|
|
1295
|
+
};
|
|
1296
|
+
|
|
1297
|
+
export type ResponseCodeExecutionToolResultBlock = {
|
|
1298
|
+
content: ResponseCodeExecutionToolResultError | ResponseCodeExecutionResultBlock | ResponseEncryptedCodeExecutionResultBlock;
|
|
1299
|
+
tool_use_id: string;
|
|
1300
|
+
type: 'code_execution_tool_result';
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
export type ResponseCodeExecutionToolResultError = {
|
|
1304
|
+
error_code: CodeExecutionToolResultErrorCode;
|
|
1305
|
+
type: 'code_execution_tool_result_error';
|
|
1306
|
+
};
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* Response model for a file uploaded to the container.
|
|
1310
|
+
*/
|
|
1311
|
+
export type ResponseContainerUploadBlock = {
|
|
1312
|
+
file_id: string;
|
|
1313
|
+
type: 'container_upload';
|
|
1314
|
+
};
|
|
1315
|
+
|
|
1316
|
+
export type ResponseContentBlockLocationCitation = {
|
|
1317
|
+
cited_text: string;
|
|
1318
|
+
document_index: number;
|
|
1319
|
+
document_title: string | null;
|
|
1320
|
+
end_block_index: number;
|
|
1321
|
+
file_id: string | null;
|
|
1322
|
+
start_block_index: number;
|
|
1323
|
+
type: 'content_block_location';
|
|
1324
|
+
};
|
|
1325
|
+
|
|
1326
|
+
export type ResponseDocumentBlock = {
|
|
1327
|
+
/**
|
|
1328
|
+
* Citation configuration for the document
|
|
1329
|
+
*/
|
|
1330
|
+
citations: ResponseCitationsConfig | null;
|
|
1331
|
+
source: ({
|
|
1332
|
+
type?: 'base64';
|
|
1333
|
+
} & Base64PdfSource) | ({
|
|
1334
|
+
type?: 'text';
|
|
1335
|
+
} & PlainTextSource);
|
|
1336
|
+
/**
|
|
1337
|
+
* The title of the document
|
|
1338
|
+
*/
|
|
1339
|
+
title: string | null;
|
|
1340
|
+
type: 'document';
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Code execution result with encrypted stdout for PFC + web_search results.
|
|
1345
|
+
*/
|
|
1346
|
+
export type ResponseEncryptedCodeExecutionResultBlock = {
|
|
1347
|
+
content: Array<ResponseCodeExecutionOutputBlock>;
|
|
1348
|
+
encrypted_stdout: string;
|
|
1349
|
+
return_code: number;
|
|
1350
|
+
stderr: string;
|
|
1351
|
+
type: 'encrypted_code_execution_result';
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
export type ResponsePageLocationCitation = {
|
|
1355
|
+
cited_text: string;
|
|
1356
|
+
document_index: number;
|
|
1357
|
+
document_title: string | null;
|
|
1358
|
+
end_page_number: number;
|
|
1359
|
+
file_id: string | null;
|
|
1360
|
+
start_page_number: number;
|
|
1361
|
+
type: 'page_location';
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
export type ResponseRedactedThinkingBlock = {
|
|
1365
|
+
data: string;
|
|
1366
|
+
type: 'redacted_thinking';
|
|
1367
|
+
};
|
|
1368
|
+
|
|
1369
|
+
export type ResponseSearchResultLocationCitation = {
|
|
1370
|
+
cited_text: string;
|
|
1371
|
+
end_block_index: number;
|
|
1372
|
+
search_result_index: number;
|
|
1373
|
+
source: string;
|
|
1374
|
+
start_block_index: number;
|
|
1375
|
+
title: string | null;
|
|
1376
|
+
type: 'search_result_location';
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
export type ResponseServerToolUseBlock = {
|
|
1380
|
+
caller: ({
|
|
1381
|
+
type?: 'direct';
|
|
1382
|
+
} & DirectCaller) | ({
|
|
1383
|
+
type?: 'code_execution_20250825';
|
|
1384
|
+
} & ServerToolCaller) | ({
|
|
1385
|
+
type?: 'code_execution_20260120';
|
|
1386
|
+
} & ServerToolCaller20260120);
|
|
1387
|
+
id: string;
|
|
1388
|
+
input: {
|
|
1389
|
+
[key: string]: unknown;
|
|
1390
|
+
};
|
|
1391
|
+
name: 'web_search' | 'web_fetch' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution' | 'tool_search_tool_regex' | 'tool_search_tool_bm25';
|
|
1392
|
+
type: 'server_tool_use';
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
export type ResponseTextBlock = {
|
|
1396
|
+
/**
|
|
1397
|
+
* Citations supporting the text block.
|
|
1398
|
+
*
|
|
1399
|
+
* The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.
|
|
1400
|
+
*/
|
|
1401
|
+
citations: Array<({
|
|
1402
|
+
type?: 'char_location';
|
|
1403
|
+
} & ResponseCharLocationCitation) | ({
|
|
1404
|
+
type?: 'page_location';
|
|
1405
|
+
} & ResponsePageLocationCitation) | ({
|
|
1406
|
+
type?: 'content_block_location';
|
|
1407
|
+
} & ResponseContentBlockLocationCitation) | ({
|
|
1408
|
+
type?: 'web_search_result_location';
|
|
1409
|
+
} & ResponseWebSearchResultLocationCitation) | ({
|
|
1410
|
+
type?: 'search_result_location';
|
|
1411
|
+
} & ResponseSearchResultLocationCitation)> | null;
|
|
1412
|
+
text: string;
|
|
1413
|
+
type: 'text';
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
export type ResponseTextEditorCodeExecutionCreateResultBlock = {
|
|
1417
|
+
is_file_update: boolean;
|
|
1418
|
+
type: 'text_editor_code_execution_create_result';
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
export type ResponseTextEditorCodeExecutionStrReplaceResultBlock = {
|
|
1422
|
+
lines: Array<string> | null;
|
|
1423
|
+
new_lines: number | null;
|
|
1424
|
+
new_start: number | null;
|
|
1425
|
+
old_lines: number | null;
|
|
1426
|
+
old_start: number | null;
|
|
1427
|
+
type: 'text_editor_code_execution_str_replace_result';
|
|
1428
|
+
};
|
|
1429
|
+
|
|
1430
|
+
export type ResponseTextEditorCodeExecutionToolResultBlock = {
|
|
1431
|
+
content: ResponseTextEditorCodeExecutionToolResultError | ResponseTextEditorCodeExecutionViewResultBlock | ResponseTextEditorCodeExecutionCreateResultBlock | ResponseTextEditorCodeExecutionStrReplaceResultBlock;
|
|
1432
|
+
tool_use_id: string;
|
|
1433
|
+
type: 'text_editor_code_execution_tool_result';
|
|
1434
|
+
};
|
|
1435
|
+
|
|
1436
|
+
export type ResponseTextEditorCodeExecutionToolResultError = {
|
|
1437
|
+
error_code: TextEditorCodeExecutionToolResultErrorCode;
|
|
1438
|
+
error_message: string | null;
|
|
1439
|
+
type: 'text_editor_code_execution_tool_result_error';
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
export type ResponseTextEditorCodeExecutionViewResultBlock = {
|
|
1443
|
+
content: string;
|
|
1444
|
+
file_type: 'text' | 'image' | 'pdf';
|
|
1445
|
+
num_lines: number | null;
|
|
1446
|
+
start_line: number | null;
|
|
1447
|
+
total_lines: number | null;
|
|
1448
|
+
type: 'text_editor_code_execution_view_result';
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1451
|
+
export type ResponseThinkingBlock = {
|
|
1452
|
+
signature: string;
|
|
1453
|
+
thinking: string;
|
|
1454
|
+
type: 'thinking';
|
|
1455
|
+
};
|
|
1456
|
+
|
|
1457
|
+
export type ResponseToolReferenceBlock = {
|
|
1458
|
+
tool_name: string;
|
|
1459
|
+
type: 'tool_reference';
|
|
1460
|
+
};
|
|
1461
|
+
|
|
1462
|
+
export type ResponseToolSearchToolResultBlock = {
|
|
1463
|
+
content: ResponseToolSearchToolResultError | ResponseToolSearchToolSearchResultBlock;
|
|
1464
|
+
tool_use_id: string;
|
|
1465
|
+
type: 'tool_search_tool_result';
|
|
1466
|
+
};
|
|
1467
|
+
|
|
1468
|
+
export type ResponseToolSearchToolResultError = {
|
|
1469
|
+
error_code: ToolSearchToolResultErrorCode;
|
|
1470
|
+
error_message: string | null;
|
|
1471
|
+
type: 'tool_search_tool_result_error';
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
export type ResponseToolSearchToolSearchResultBlock = {
|
|
1475
|
+
tool_references: Array<ResponseToolReferenceBlock>;
|
|
1476
|
+
type: 'tool_search_tool_search_result';
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
export type ResponseToolUseBlock = {
|
|
1480
|
+
caller: ({
|
|
1481
|
+
type?: 'direct';
|
|
1482
|
+
} & DirectCaller) | ({
|
|
1483
|
+
type?: 'code_execution_20250825';
|
|
1484
|
+
} & ServerToolCaller) | ({
|
|
1485
|
+
type?: 'code_execution_20260120';
|
|
1486
|
+
} & ServerToolCaller20260120);
|
|
1487
|
+
id: string;
|
|
1488
|
+
input: {
|
|
1489
|
+
[key: string]: unknown;
|
|
1490
|
+
};
|
|
1491
|
+
name: string;
|
|
1492
|
+
type: 'tool_use';
|
|
1493
|
+
};
|
|
1494
|
+
|
|
1495
|
+
export type ResponseWebFetchResultBlock = {
|
|
1496
|
+
content: ResponseDocumentBlock;
|
|
1497
|
+
/**
|
|
1498
|
+
* ISO 8601 timestamp when the content was retrieved
|
|
1499
|
+
*/
|
|
1500
|
+
retrieved_at: string | null;
|
|
1501
|
+
type: 'web_fetch_result';
|
|
1502
|
+
/**
|
|
1503
|
+
* Fetched content URL
|
|
1504
|
+
*/
|
|
1505
|
+
url: string;
|
|
1506
|
+
};
|
|
1507
|
+
|
|
1508
|
+
export type ResponseWebFetchToolResultBlock = {
|
|
1509
|
+
caller: ({
|
|
1510
|
+
type?: 'direct';
|
|
1511
|
+
} & DirectCaller) | ({
|
|
1512
|
+
type?: 'code_execution_20250825';
|
|
1513
|
+
} & ServerToolCaller) | ({
|
|
1514
|
+
type?: 'code_execution_20260120';
|
|
1515
|
+
} & ServerToolCaller20260120);
|
|
1516
|
+
content: ResponseWebFetchToolResultError | ResponseWebFetchResultBlock;
|
|
1517
|
+
tool_use_id: string;
|
|
1518
|
+
type: 'web_fetch_tool_result';
|
|
1519
|
+
};
|
|
1520
|
+
|
|
1521
|
+
export type ResponseWebFetchToolResultError = {
|
|
1522
|
+
error_code: WebFetchToolResultErrorCode;
|
|
1523
|
+
type: 'web_fetch_tool_result_error';
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
export type ResponseWebSearchResultBlock = {
|
|
1527
|
+
encrypted_content: string;
|
|
1528
|
+
page_age: string | null;
|
|
1529
|
+
title: string;
|
|
1530
|
+
type: 'web_search_result';
|
|
1531
|
+
url: string;
|
|
1532
|
+
};
|
|
1533
|
+
|
|
1534
|
+
export type ResponseWebSearchResultLocationCitation = {
|
|
1535
|
+
cited_text: string;
|
|
1536
|
+
encrypted_index: string;
|
|
1537
|
+
title: string | null;
|
|
1538
|
+
type: 'web_search_result_location';
|
|
1539
|
+
url: string;
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
export type ResponseWebSearchToolResultBlock = {
|
|
1543
|
+
caller: ({
|
|
1544
|
+
type?: 'direct';
|
|
1545
|
+
} & DirectCaller) | ({
|
|
1546
|
+
type?: 'code_execution_20250825';
|
|
1547
|
+
} & ServerToolCaller) | ({
|
|
1548
|
+
type?: 'code_execution_20260120';
|
|
1549
|
+
} & ServerToolCaller20260120);
|
|
1550
|
+
content: ResponseWebSearchToolResultError | Array<ResponseWebSearchResultBlock>;
|
|
1551
|
+
tool_use_id: string;
|
|
1552
|
+
type: 'web_search_tool_result';
|
|
1553
|
+
};
|
|
1554
|
+
|
|
1555
|
+
export type ResponseWebSearchToolResultError = {
|
|
1556
|
+
error_code: WebSearchToolResultErrorCode;
|
|
1557
|
+
type: 'web_search_tool_result_error';
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* Tool invocation generated by a server-side tool.
|
|
1562
|
+
*/
|
|
1563
|
+
export type ServerToolCaller = {
|
|
1564
|
+
tool_id: string;
|
|
1565
|
+
type: 'code_execution_20250825';
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
export type ServerToolCaller20260120 = {
|
|
1569
|
+
tool_id: string;
|
|
1570
|
+
type: 'code_execution_20260120';
|
|
1571
|
+
};
|
|
1572
|
+
|
|
1573
|
+
export type ServerToolUsage = {
|
|
1574
|
+
/**
|
|
1575
|
+
* The number of web fetch tool requests.
|
|
1576
|
+
*/
|
|
1577
|
+
web_fetch_requests: number;
|
|
1578
|
+
/**
|
|
1579
|
+
* The number of web search tool requests.
|
|
1580
|
+
*/
|
|
1581
|
+
web_search_requests: number;
|
|
1582
|
+
};
|
|
1583
|
+
|
|
1584
|
+
export type TextEditorCodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded' | 'file_not_found';
|
|
1585
|
+
|
|
1586
|
+
export type TextEditor20250124 = {
|
|
1587
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
1588
|
+
/**
|
|
1589
|
+
* Create a cache control breakpoint at this content block.
|
|
1590
|
+
*/
|
|
1591
|
+
cache_control?: ({
|
|
1592
|
+
type?: 'ephemeral';
|
|
1593
|
+
} & CacheControlEphemeral) | null;
|
|
1594
|
+
/**
|
|
1595
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
1596
|
+
*/
|
|
1597
|
+
defer_loading?: boolean;
|
|
1598
|
+
input_examples?: Array<{
|
|
1599
|
+
[key: string]: JsonValue;
|
|
1600
|
+
}>;
|
|
1601
|
+
/**
|
|
1602
|
+
* Name of the tool.
|
|
1603
|
+
*
|
|
1604
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
1605
|
+
*/
|
|
1606
|
+
name: 'str_replace_editor';
|
|
1607
|
+
/**
|
|
1608
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
1609
|
+
*/
|
|
1610
|
+
strict?: boolean;
|
|
1611
|
+
type: 'text_editor_20250124';
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1614
|
+
export type TextEditor20250429 = {
|
|
1615
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
1616
|
+
/**
|
|
1617
|
+
* Create a cache control breakpoint at this content block.
|
|
1618
|
+
*/
|
|
1619
|
+
cache_control?: ({
|
|
1620
|
+
type?: 'ephemeral';
|
|
1621
|
+
} & CacheControlEphemeral) | null;
|
|
1622
|
+
/**
|
|
1623
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
1624
|
+
*/
|
|
1625
|
+
defer_loading?: boolean;
|
|
1626
|
+
input_examples?: Array<{
|
|
1627
|
+
[key: string]: JsonValue;
|
|
1628
|
+
}>;
|
|
1629
|
+
/**
|
|
1630
|
+
* Name of the tool.
|
|
1631
|
+
*
|
|
1632
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
1633
|
+
*/
|
|
1634
|
+
name: 'str_replace_based_edit_tool';
|
|
1635
|
+
/**
|
|
1636
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
1637
|
+
*/
|
|
1638
|
+
strict?: boolean;
|
|
1639
|
+
type: 'text_editor_20250429';
|
|
1640
|
+
};
|
|
1641
|
+
|
|
1642
|
+
export type TextEditor20250728 = {
|
|
1643
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
1644
|
+
/**
|
|
1645
|
+
* Create a cache control breakpoint at this content block.
|
|
1646
|
+
*/
|
|
1647
|
+
cache_control?: ({
|
|
1648
|
+
type?: 'ephemeral';
|
|
1649
|
+
} & CacheControlEphemeral) | null;
|
|
1650
|
+
/**
|
|
1651
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
1652
|
+
*/
|
|
1653
|
+
defer_loading?: boolean;
|
|
1654
|
+
input_examples?: Array<{
|
|
1655
|
+
[key: string]: JsonValue;
|
|
1656
|
+
}>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
|
|
1659
|
+
*/
|
|
1660
|
+
max_characters?: number | null;
|
|
1661
|
+
/**
|
|
1662
|
+
* Name of the tool.
|
|
1663
|
+
*
|
|
1664
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
1665
|
+
*/
|
|
1666
|
+
name: 'str_replace_based_edit_tool';
|
|
1667
|
+
/**
|
|
1668
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
1669
|
+
*/
|
|
1670
|
+
strict?: boolean;
|
|
1671
|
+
type: 'text_editor_20250728';
|
|
1672
|
+
};
|
|
1673
|
+
|
|
1674
|
+
/**
|
|
1675
|
+
* Thinking capability details.
|
|
1676
|
+
*/
|
|
1677
|
+
export type ThinkingCapability = {
|
|
1678
|
+
/**
|
|
1679
|
+
* Whether this capability is supported by the model.
|
|
1680
|
+
*/
|
|
1681
|
+
supported: boolean;
|
|
1682
|
+
types: ThinkingTypes;
|
|
1683
|
+
};
|
|
1684
|
+
|
|
1685
|
+
export type ThinkingConfigAdaptive = {
|
|
1686
|
+
/**
|
|
1687
|
+
* Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
|
|
1688
|
+
*/
|
|
1689
|
+
display?: ThinkingDisplayMode | null;
|
|
1690
|
+
type: 'adaptive';
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1693
|
+
export type ThinkingConfigDisabled = {
|
|
1694
|
+
type: 'disabled';
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1697
|
+
export type ThinkingConfigEnabled = {
|
|
1698
|
+
/**
|
|
1699
|
+
* Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
|
|
1700
|
+
*
|
|
1701
|
+
* Must be ≥1024 and less than `max_tokens`.
|
|
1702
|
+
*
|
|
1703
|
+
* See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.
|
|
1704
|
+
*/
|
|
1705
|
+
budget_tokens: number;
|
|
1706
|
+
/**
|
|
1707
|
+
* Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
|
|
1708
|
+
*/
|
|
1709
|
+
display?: ThinkingDisplayMode | null;
|
|
1710
|
+
type: 'enabled';
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
export type ThinkingDisplayMode = 'summarized' | 'omitted';
|
|
1714
|
+
|
|
1715
|
+
/**
|
|
1716
|
+
* Supported thinking type configurations.
|
|
1717
|
+
*/
|
|
1718
|
+
export type ThinkingTypes = {
|
|
1719
|
+
/**
|
|
1720
|
+
* Whether the model supports thinking with type 'adaptive' (auto).
|
|
1721
|
+
*/
|
|
1722
|
+
adaptive: CapabilitySupport;
|
|
1723
|
+
/**
|
|
1724
|
+
* Whether the model supports thinking with type 'enabled'.
|
|
1725
|
+
*/
|
|
1726
|
+
enabled: CapabilitySupport;
|
|
1727
|
+
};
|
|
1728
|
+
|
|
1729
|
+
export type Tool = {
|
|
1730
|
+
type?: null | 'custom';
|
|
1731
|
+
/**
|
|
1732
|
+
* Description of what this tool does.
|
|
1733
|
+
*
|
|
1734
|
+
* Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
|
|
1735
|
+
*/
|
|
1736
|
+
description?: string;
|
|
1737
|
+
/**
|
|
1738
|
+
* Name of the tool.
|
|
1739
|
+
*
|
|
1740
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
1741
|
+
*/
|
|
1742
|
+
name: string;
|
|
1743
|
+
/**
|
|
1744
|
+
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
|
1745
|
+
*
|
|
1746
|
+
* This defines the shape of the `input` that your tool accepts and that the model will produce.
|
|
1747
|
+
*/
|
|
1748
|
+
input_schema: InputSchema;
|
|
1749
|
+
/**
|
|
1750
|
+
* Create a cache control breakpoint at this content block.
|
|
1751
|
+
*/
|
|
1752
|
+
cache_control?: ({
|
|
1753
|
+
type?: 'ephemeral';
|
|
1754
|
+
} & CacheControlEphemeral) | null;
|
|
1755
|
+
/**
|
|
1756
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
1757
|
+
*/
|
|
1758
|
+
strict?: boolean;
|
|
1759
|
+
/**
|
|
1760
|
+
* Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.
|
|
1761
|
+
*/
|
|
1762
|
+
eager_input_streaming?: boolean | null;
|
|
1763
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
1764
|
+
/**
|
|
1765
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
1766
|
+
*/
|
|
1767
|
+
defer_loading?: boolean;
|
|
1768
|
+
input_examples?: Array<{
|
|
1769
|
+
[key: string]: JsonValue;
|
|
1770
|
+
}>;
|
|
1771
|
+
};
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* The model will use any available tools.
|
|
1775
|
+
*/
|
|
1776
|
+
export type ToolChoiceAny = {
|
|
1777
|
+
/**
|
|
1778
|
+
* Whether to disable parallel tool use.
|
|
1779
|
+
*
|
|
1780
|
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool use.
|
|
1781
|
+
*/
|
|
1782
|
+
disable_parallel_tool_use?: boolean;
|
|
1783
|
+
type: 'any';
|
|
1784
|
+
};
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* The model will automatically decide whether to use tools.
|
|
1788
|
+
*/
|
|
1789
|
+
export type ToolChoiceAuto = {
|
|
1790
|
+
/**
|
|
1791
|
+
* Whether to disable parallel tool use.
|
|
1792
|
+
*
|
|
1793
|
+
* Defaults to `false`. If set to `true`, the model will output at most one tool use.
|
|
1794
|
+
*/
|
|
1795
|
+
disable_parallel_tool_use?: boolean;
|
|
1796
|
+
type: 'auto';
|
|
1797
|
+
};
|
|
1798
|
+
|
|
1799
|
+
/**
|
|
1800
|
+
* The model will not be allowed to use tools.
|
|
1801
|
+
*/
|
|
1802
|
+
export type ToolChoiceNone = {
|
|
1803
|
+
type: 'none';
|
|
1804
|
+
};
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* The model will use the specified tool with `tool_choice.name`.
|
|
1808
|
+
*/
|
|
1809
|
+
export type ToolChoiceTool = {
|
|
1810
|
+
/**
|
|
1811
|
+
* Whether to disable parallel tool use.
|
|
1812
|
+
*
|
|
1813
|
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool use.
|
|
1814
|
+
*/
|
|
1815
|
+
disable_parallel_tool_use?: boolean;
|
|
1816
|
+
/**
|
|
1817
|
+
* The name of the tool to use.
|
|
1818
|
+
*/
|
|
1819
|
+
name: string;
|
|
1820
|
+
type: 'tool';
|
|
1821
|
+
};
|
|
1822
|
+
|
|
1823
|
+
export type ToolSearchToolBm2520251119 = {
|
|
1824
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
1825
|
+
/**
|
|
1826
|
+
* Create a cache control breakpoint at this content block.
|
|
1827
|
+
*/
|
|
1828
|
+
cache_control?: ({
|
|
1829
|
+
type?: 'ephemeral';
|
|
1830
|
+
} & CacheControlEphemeral) | null;
|
|
1831
|
+
/**
|
|
1832
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
1833
|
+
*/
|
|
1834
|
+
defer_loading?: boolean;
|
|
1835
|
+
/**
|
|
1836
|
+
* Name of the tool.
|
|
1837
|
+
*
|
|
1838
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
1839
|
+
*/
|
|
1840
|
+
name: 'tool_search_tool_bm25';
|
|
1841
|
+
/**
|
|
1842
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
1843
|
+
*/
|
|
1844
|
+
strict?: boolean;
|
|
1845
|
+
type: 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25';
|
|
1846
|
+
};
|
|
1847
|
+
|
|
1848
|
+
export type ToolSearchToolRegex20251119 = {
|
|
1849
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
1850
|
+
/**
|
|
1851
|
+
* Create a cache control breakpoint at this content block.
|
|
1852
|
+
*/
|
|
1853
|
+
cache_control?: ({
|
|
1854
|
+
type?: 'ephemeral';
|
|
1855
|
+
} & CacheControlEphemeral) | null;
|
|
1856
|
+
/**
|
|
1857
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
1858
|
+
*/
|
|
1859
|
+
defer_loading?: boolean;
|
|
1860
|
+
/**
|
|
1861
|
+
* Name of the tool.
|
|
1862
|
+
*
|
|
1863
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
1864
|
+
*/
|
|
1865
|
+
name: 'tool_search_tool_regex';
|
|
1866
|
+
/**
|
|
1867
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
1868
|
+
*/
|
|
1869
|
+
strict?: boolean;
|
|
1870
|
+
type: 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex';
|
|
1871
|
+
};
|
|
1872
|
+
|
|
1873
|
+
export type ToolSearchToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded';
|
|
1874
|
+
|
|
1875
|
+
export type UrlImageSource = {
|
|
1876
|
+
type: 'url';
|
|
1877
|
+
url: string;
|
|
1878
|
+
};
|
|
1879
|
+
|
|
1880
|
+
export type UrlpdfSource = {
|
|
1881
|
+
type: 'url';
|
|
1882
|
+
url: string;
|
|
1883
|
+
};
|
|
1884
|
+
|
|
1885
|
+
export type Usage = {
|
|
1886
|
+
/**
|
|
1887
|
+
* Breakdown of cached tokens by TTL
|
|
1888
|
+
*/
|
|
1889
|
+
cache_creation: CacheCreation | null;
|
|
1890
|
+
/**
|
|
1891
|
+
* The number of input tokens used to create the cache entry.
|
|
1892
|
+
*/
|
|
1893
|
+
cache_creation_input_tokens: number | null;
|
|
1894
|
+
/**
|
|
1895
|
+
* The number of input tokens read from the cache.
|
|
1896
|
+
*/
|
|
1897
|
+
cache_read_input_tokens: number | null;
|
|
1898
|
+
/**
|
|
1899
|
+
* The geographic region where inference was performed for this request.
|
|
1900
|
+
*/
|
|
1901
|
+
inference_geo: string | null;
|
|
1902
|
+
/**
|
|
1903
|
+
* The number of input tokens which were used.
|
|
1904
|
+
*/
|
|
1905
|
+
input_tokens: number;
|
|
1906
|
+
/**
|
|
1907
|
+
* The number of output tokens which were used.
|
|
1908
|
+
*/
|
|
1909
|
+
output_tokens: number;
|
|
1910
|
+
/**
|
|
1911
|
+
* The number of server tool requests.
|
|
1912
|
+
*/
|
|
1913
|
+
server_tool_use: ServerToolUsage | null;
|
|
1914
|
+
/**
|
|
1915
|
+
* If the request used the priority, standard, or batch tier.
|
|
1916
|
+
*/
|
|
1917
|
+
service_tier: ('standard' | 'priority' | 'batch') | null;
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
export type UserLocation = {
|
|
1921
|
+
/**
|
|
1922
|
+
* The city of the user.
|
|
1923
|
+
*/
|
|
1924
|
+
city?: string | null;
|
|
1925
|
+
/**
|
|
1926
|
+
* The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.
|
|
1927
|
+
*/
|
|
1928
|
+
country?: string | null;
|
|
1929
|
+
/**
|
|
1930
|
+
* The region of the user.
|
|
1931
|
+
*/
|
|
1932
|
+
region?: string | null;
|
|
1933
|
+
/**
|
|
1934
|
+
* The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
|
1935
|
+
*/
|
|
1936
|
+
timezone?: string | null;
|
|
1937
|
+
type: 'approximate';
|
|
1938
|
+
};
|
|
1939
|
+
|
|
1940
|
+
export type WebFetchToolResultErrorCode = 'invalid_tool_input' | 'url_too_long' | 'url_not_allowed' | 'url_not_accessible' | 'unsupported_content_type' | 'too_many_requests' | 'max_uses_exceeded' | 'unavailable';
|
|
1941
|
+
|
|
1942
|
+
export type WebFetchTool20250910 = {
|
|
1943
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
1944
|
+
/**
|
|
1945
|
+
* List of domains to allow fetching from
|
|
1946
|
+
*/
|
|
1947
|
+
allowed_domains?: Array<string> | null;
|
|
1948
|
+
/**
|
|
1949
|
+
* List of domains to block fetching from
|
|
1950
|
+
*/
|
|
1951
|
+
blocked_domains?: Array<string> | null;
|
|
1952
|
+
/**
|
|
1953
|
+
* Create a cache control breakpoint at this content block.
|
|
1954
|
+
*/
|
|
1955
|
+
cache_control?: ({
|
|
1956
|
+
type?: 'ephemeral';
|
|
1957
|
+
} & CacheControlEphemeral) | null;
|
|
1958
|
+
/**
|
|
1959
|
+
* Citations configuration for fetched documents. Citations are disabled by default.
|
|
1960
|
+
*/
|
|
1961
|
+
citations?: RequestCitationsConfig | null;
|
|
1962
|
+
/**
|
|
1963
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
1964
|
+
*/
|
|
1965
|
+
defer_loading?: boolean;
|
|
1966
|
+
/**
|
|
1967
|
+
* Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
|
|
1968
|
+
*/
|
|
1969
|
+
max_content_tokens?: number | null;
|
|
1970
|
+
/**
|
|
1971
|
+
* Maximum number of times the tool can be used in the API request.
|
|
1972
|
+
*/
|
|
1973
|
+
max_uses?: number | null;
|
|
1974
|
+
/**
|
|
1975
|
+
* Name of the tool.
|
|
1976
|
+
*
|
|
1977
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
1978
|
+
*/
|
|
1979
|
+
name: 'web_fetch';
|
|
1980
|
+
/**
|
|
1981
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
1982
|
+
*/
|
|
1983
|
+
strict?: boolean;
|
|
1984
|
+
type: 'web_fetch_20250910';
|
|
1985
|
+
};
|
|
1986
|
+
|
|
1987
|
+
export type WebFetchTool20260209 = {
|
|
1988
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
1989
|
+
/**
|
|
1990
|
+
* List of domains to allow fetching from
|
|
1991
|
+
*/
|
|
1992
|
+
allowed_domains?: Array<string> | null;
|
|
1993
|
+
/**
|
|
1994
|
+
* List of domains to block fetching from
|
|
1995
|
+
*/
|
|
1996
|
+
blocked_domains?: Array<string> | null;
|
|
1997
|
+
/**
|
|
1998
|
+
* Create a cache control breakpoint at this content block.
|
|
1999
|
+
*/
|
|
2000
|
+
cache_control?: ({
|
|
2001
|
+
type?: 'ephemeral';
|
|
2002
|
+
} & CacheControlEphemeral) | null;
|
|
2003
|
+
/**
|
|
2004
|
+
* Citations configuration for fetched documents. Citations are disabled by default.
|
|
2005
|
+
*/
|
|
2006
|
+
citations?: RequestCitationsConfig | null;
|
|
2007
|
+
/**
|
|
2008
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
2009
|
+
*/
|
|
2010
|
+
defer_loading?: boolean;
|
|
2011
|
+
/**
|
|
2012
|
+
* Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
|
|
2013
|
+
*/
|
|
2014
|
+
max_content_tokens?: number | null;
|
|
2015
|
+
/**
|
|
2016
|
+
* Maximum number of times the tool can be used in the API request.
|
|
2017
|
+
*/
|
|
2018
|
+
max_uses?: number | null;
|
|
2019
|
+
/**
|
|
2020
|
+
* Name of the tool.
|
|
2021
|
+
*
|
|
2022
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2023
|
+
*/
|
|
2024
|
+
name: 'web_fetch';
|
|
2025
|
+
/**
|
|
2026
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2027
|
+
*/
|
|
2028
|
+
strict?: boolean;
|
|
2029
|
+
type: 'web_fetch_20260209';
|
|
2030
|
+
};
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Web fetch tool with use_cache parameter for bypassing cached content.
|
|
2034
|
+
*/
|
|
2035
|
+
export type WebFetchTool20260309 = {
|
|
2036
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
2037
|
+
/**
|
|
2038
|
+
* List of domains to allow fetching from
|
|
2039
|
+
*/
|
|
2040
|
+
allowed_domains?: Array<string> | null;
|
|
2041
|
+
/**
|
|
2042
|
+
* List of domains to block fetching from
|
|
2043
|
+
*/
|
|
2044
|
+
blocked_domains?: Array<string> | null;
|
|
2045
|
+
/**
|
|
2046
|
+
* Create a cache control breakpoint at this content block.
|
|
2047
|
+
*/
|
|
2048
|
+
cache_control?: ({
|
|
2049
|
+
type?: 'ephemeral';
|
|
2050
|
+
} & CacheControlEphemeral) | null;
|
|
2051
|
+
/**
|
|
2052
|
+
* Citations configuration for fetched documents. Citations are disabled by default.
|
|
2053
|
+
*/
|
|
2054
|
+
citations?: RequestCitationsConfig | null;
|
|
2055
|
+
/**
|
|
2056
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
2057
|
+
*/
|
|
2058
|
+
defer_loading?: boolean;
|
|
2059
|
+
/**
|
|
2060
|
+
* Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
|
|
2061
|
+
*/
|
|
2062
|
+
max_content_tokens?: number | null;
|
|
2063
|
+
/**
|
|
2064
|
+
* Maximum number of times the tool can be used in the API request.
|
|
2065
|
+
*/
|
|
2066
|
+
max_uses?: number | null;
|
|
2067
|
+
/**
|
|
2068
|
+
* Name of the tool.
|
|
2069
|
+
*
|
|
2070
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2071
|
+
*/
|
|
2072
|
+
name: 'web_fetch';
|
|
2073
|
+
/**
|
|
2074
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2075
|
+
*/
|
|
2076
|
+
strict?: boolean;
|
|
2077
|
+
type: 'web_fetch_20260309';
|
|
2078
|
+
/**
|
|
2079
|
+
* Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
|
|
2080
|
+
*/
|
|
2081
|
+
use_cache?: boolean;
|
|
2082
|
+
};
|
|
2083
|
+
|
|
2084
|
+
export type WebSearchToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'max_uses_exceeded' | 'too_many_requests' | 'query_too_long' | 'request_too_large';
|
|
2085
|
+
|
|
2086
|
+
export type WebSearchTool20250305 = {
|
|
2087
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
2088
|
+
/**
|
|
2089
|
+
* If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.
|
|
2090
|
+
*/
|
|
2091
|
+
allowed_domains?: Array<string> | null;
|
|
2092
|
+
/**
|
|
2093
|
+
* If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.
|
|
2094
|
+
*/
|
|
2095
|
+
blocked_domains?: Array<string> | null;
|
|
2096
|
+
/**
|
|
2097
|
+
* Create a cache control breakpoint at this content block.
|
|
2098
|
+
*/
|
|
2099
|
+
cache_control?: ({
|
|
2100
|
+
type?: 'ephemeral';
|
|
2101
|
+
} & CacheControlEphemeral) | null;
|
|
2102
|
+
/**
|
|
2103
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
2104
|
+
*/
|
|
2105
|
+
defer_loading?: boolean;
|
|
2106
|
+
/**
|
|
2107
|
+
* Maximum number of times the tool can be used in the API request.
|
|
2108
|
+
*/
|
|
2109
|
+
max_uses?: number | null;
|
|
2110
|
+
/**
|
|
2111
|
+
* Name of the tool.
|
|
2112
|
+
*
|
|
2113
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2114
|
+
*/
|
|
2115
|
+
name: 'web_search';
|
|
2116
|
+
/**
|
|
2117
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2118
|
+
*/
|
|
2119
|
+
strict?: boolean;
|
|
2120
|
+
type: 'web_search_20250305';
|
|
2121
|
+
/**
|
|
2122
|
+
* Parameters for the user's location. Used to provide more relevant search results.
|
|
2123
|
+
*/
|
|
2124
|
+
user_location?: UserLocation | null;
|
|
2125
|
+
};
|
|
2126
|
+
|
|
2127
|
+
export type WebSearchTool20260209 = {
|
|
2128
|
+
allowed_callers?: Array<AllowedCaller>;
|
|
2129
|
+
/**
|
|
2130
|
+
* If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.
|
|
2131
|
+
*/
|
|
2132
|
+
allowed_domains?: Array<string> | null;
|
|
2133
|
+
/**
|
|
2134
|
+
* If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.
|
|
2135
|
+
*/
|
|
2136
|
+
blocked_domains?: Array<string> | null;
|
|
2137
|
+
/**
|
|
2138
|
+
* Create a cache control breakpoint at this content block.
|
|
2139
|
+
*/
|
|
2140
|
+
cache_control?: ({
|
|
2141
|
+
type?: 'ephemeral';
|
|
2142
|
+
} & CacheControlEphemeral) | null;
|
|
2143
|
+
/**
|
|
2144
|
+
* If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
|
|
2145
|
+
*/
|
|
2146
|
+
defer_loading?: boolean;
|
|
2147
|
+
/**
|
|
2148
|
+
* Maximum number of times the tool can be used in the API request.
|
|
2149
|
+
*/
|
|
2150
|
+
max_uses?: number | null;
|
|
2151
|
+
/**
|
|
2152
|
+
* Name of the tool.
|
|
2153
|
+
*
|
|
2154
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
2155
|
+
*/
|
|
2156
|
+
name: 'web_search';
|
|
2157
|
+
/**
|
|
2158
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
2159
|
+
*/
|
|
2160
|
+
strict?: boolean;
|
|
2161
|
+
type: 'web_search_20260209';
|
|
2162
|
+
/**
|
|
2163
|
+
* Parameters for the user's location. Used to provide more relevant search results.
|
|
2164
|
+
*/
|
|
2165
|
+
user_location?: UserLocation | null;
|
|
2166
|
+
};
|
|
2167
|
+
|
|
2168
|
+
export type AnthropicBeta = string | ('message-batches-2024-09-24' | 'prompt-caching-2024-07-31' | 'computer-use-2024-10-22' | 'computer-use-2025-01-24' | 'pdfs-2024-09-25' | 'token-counting-2024-11-01' | 'token-efficient-tools-2025-02-19' | 'output-128k-2025-02-19' | 'files-api-2025-04-14' | 'mcp-client-2025-04-04' | 'mcp-client-2025-11-20' | 'dev-full-thinking-2025-05-14' | 'interleaved-thinking-2025-05-14' | 'code-execution-2025-05-22' | 'extended-cache-ttl-2025-04-11' | 'context-1m-2025-08-07' | 'context-management-2025-06-27' | 'model-context-window-exceeded-2025-08-26' | 'skills-2025-10-02' | 'fast-mode-2026-02-01' | 'output-300k-2026-03-24' | 'advisor-tool-2026-03-01');
|
|
2169
|
+
|
|
2170
|
+
/**
|
|
2171
|
+
* Configuration for enabling Claude's extended thinking.
|
|
2172
|
+
*
|
|
2173
|
+
* When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.
|
|
2174
|
+
*
|
|
2175
|
+
* See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.
|
|
2176
|
+
*/
|
|
2177
|
+
export type ThinkingConfigParam = ({
|
|
2178
|
+
type?: 'enabled';
|
|
2179
|
+
} & ThinkingConfigEnabled) | ({
|
|
2180
|
+
type?: 'disabled';
|
|
2181
|
+
} & ThinkingConfigDisabled) | ({
|
|
2182
|
+
type?: 'adaptive';
|
|
2183
|
+
} & ThinkingConfigAdaptive);
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
|
|
2187
|
+
*/
|
|
2188
|
+
export type ToolChoice = ({
|
|
2189
|
+
type?: 'auto';
|
|
2190
|
+
} & ToolChoiceAuto) | ({
|
|
2191
|
+
type?: 'any';
|
|
2192
|
+
} & ToolChoiceAny) | ({
|
|
2193
|
+
type?: 'tool';
|
|
2194
|
+
} & ToolChoiceTool) | ({
|
|
2195
|
+
type?: 'none';
|
|
2196
|
+
} & ToolChoiceNone);
|
|
2197
|
+
|
|
2198
|
+
export type ContentBlock = ({
|
|
2199
|
+
type?: 'text';
|
|
2200
|
+
} & ResponseTextBlock) | ({
|
|
2201
|
+
type?: 'thinking';
|
|
2202
|
+
} & ResponseThinkingBlock) | ({
|
|
2203
|
+
type?: 'redacted_thinking';
|
|
2204
|
+
} & ResponseRedactedThinkingBlock) | ({
|
|
2205
|
+
type?: 'tool_use';
|
|
2206
|
+
} & ResponseToolUseBlock) | ({
|
|
2207
|
+
type?: 'server_tool_use';
|
|
2208
|
+
} & ResponseServerToolUseBlock) | ({
|
|
2209
|
+
type?: 'web_search_tool_result';
|
|
2210
|
+
} & ResponseWebSearchToolResultBlock) | ({
|
|
2211
|
+
type?: 'web_fetch_tool_result';
|
|
2212
|
+
} & ResponseWebFetchToolResultBlock) | ({
|
|
2213
|
+
type?: 'code_execution_tool_result';
|
|
2214
|
+
} & ResponseCodeExecutionToolResultBlock) | ({
|
|
2215
|
+
type?: 'bash_code_execution_tool_result';
|
|
2216
|
+
} & ResponseBashCodeExecutionToolResultBlock) | ({
|
|
2217
|
+
type?: 'text_editor_code_execution_tool_result';
|
|
2218
|
+
} & ResponseTextEditorCodeExecutionToolResultBlock) | ({
|
|
2219
|
+
type?: 'tool_search_tool_result';
|
|
2220
|
+
} & ResponseToolSearchToolResultBlock) | ({
|
|
2221
|
+
type?: 'container_upload';
|
|
2222
|
+
} & ResponseContainerUploadBlock);
|
|
2223
|
+
|
|
2224
|
+
export type InputContentBlock = ({
|
|
2225
|
+
type?: 'text';
|
|
2226
|
+
} & RequestTextBlock) | ({
|
|
2227
|
+
type?: 'image';
|
|
2228
|
+
} & RequestImageBlock) | ({
|
|
2229
|
+
type?: 'document';
|
|
2230
|
+
} & RequestDocumentBlock) | ({
|
|
2231
|
+
type?: 'search_result';
|
|
2232
|
+
} & RequestSearchResultBlock) | ({
|
|
2233
|
+
type?: 'thinking';
|
|
2234
|
+
} & RequestThinkingBlock) | ({
|
|
2235
|
+
type?: 'redacted_thinking';
|
|
2236
|
+
} & RequestRedactedThinkingBlock) | ({
|
|
2237
|
+
type?: 'tool_use';
|
|
2238
|
+
} & RequestToolUseBlock) | ({
|
|
2239
|
+
type?: 'tool_result';
|
|
2240
|
+
} & RequestToolResultBlock) | ({
|
|
2241
|
+
type?: 'server_tool_use';
|
|
2242
|
+
} & RequestServerToolUseBlock) | ({
|
|
2243
|
+
type?: 'web_search_tool_result';
|
|
2244
|
+
} & RequestWebSearchToolResultBlock) | ({
|
|
2245
|
+
type?: 'web_fetch_tool_result';
|
|
2246
|
+
} & RequestWebFetchToolResultBlock) | ({
|
|
2247
|
+
type?: 'code_execution_tool_result';
|
|
2248
|
+
} & RequestCodeExecutionToolResultBlock) | ({
|
|
2249
|
+
type?: 'bash_code_execution_tool_result';
|
|
2250
|
+
} & RequestBashCodeExecutionToolResultBlock) | ({
|
|
2251
|
+
type?: 'text_editor_code_execution_tool_result';
|
|
2252
|
+
} & RequestTextEditorCodeExecutionToolResultBlock) | ({
|
|
2253
|
+
type?: 'tool_search_tool_result';
|
|
2254
|
+
} & RequestToolSearchToolResultBlock) | ({
|
|
2255
|
+
type?: 'container_upload';
|
|
2256
|
+
} & RequestContainerUploadBlock);
|
|
2257
|
+
|
|
2258
|
+
export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'refusal';
|
|
2259
|
+
|
|
2260
|
+
/**
|
|
2261
|
+
* The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
|
|
2262
|
+
*/
|
|
2263
|
+
export type Model = string | 'claude-mythos-preview' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-1-20250805' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-3-haiku-20240307';
|
|
2264
|
+
|
|
2265
|
+
export type MessagesPostData = {
|
|
2266
|
+
body: CreateMessageParams;
|
|
2267
|
+
headers?: {
|
|
2268
|
+
/**
|
|
2269
|
+
* The version of the Claude API you want to use.
|
|
2270
|
+
*
|
|
2271
|
+
* Read more about versioning and our version history [here](https://docs.claude.com/en/api/versioning).
|
|
2272
|
+
*/
|
|
2273
|
+
'anthropic-version'?: string;
|
|
2274
|
+
};
|
|
2275
|
+
path?: never;
|
|
2276
|
+
query?: never;
|
|
2277
|
+
url: '/v1/messages';
|
|
2278
|
+
};
|
|
2279
|
+
|
|
2280
|
+
export type MessagesPostErrors = {
|
|
2281
|
+
/**
|
|
2282
|
+
* Error response.
|
|
2283
|
+
*
|
|
2284
|
+
* See our [errors documentation](https://docs.claude.com/en/api/errors) for more details.
|
|
2285
|
+
*/
|
|
2286
|
+
'4XX': ErrorResponse;
|
|
2287
|
+
};
|
|
2288
|
+
|
|
2289
|
+
export type MessagesPostError = MessagesPostErrors[keyof MessagesPostErrors];
|
|
2290
|
+
|
|
2291
|
+
export type MessagesPostResponses = {
|
|
2292
|
+
/**
|
|
2293
|
+
* Message object.
|
|
2294
|
+
*/
|
|
2295
|
+
200: Message;
|
|
2296
|
+
};
|
|
2297
|
+
|
|
2298
|
+
export type MessagesPostResponse = MessagesPostResponses[keyof MessagesPostResponses];
|
|
2299
|
+
|
|
2300
|
+
export type ModelsListData = {
|
|
2301
|
+
body?: never;
|
|
2302
|
+
headers?: {
|
|
2303
|
+
/**
|
|
2304
|
+
* The version of the Claude API you want to use.
|
|
2305
|
+
*
|
|
2306
|
+
* Read more about versioning and our version history [here](https://docs.claude.com/en/api/versioning).
|
|
2307
|
+
*/
|
|
2308
|
+
'anthropic-version'?: string;
|
|
2309
|
+
/**
|
|
2310
|
+
* Your unique API key for authentication.
|
|
2311
|
+
*
|
|
2312
|
+
* This key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace.
|
|
2313
|
+
*/
|
|
2314
|
+
'x-api-key'?: string;
|
|
2315
|
+
/**
|
|
2316
|
+
* Optional header to specify the beta version(s) you want to use.
|
|
2317
|
+
*
|
|
2318
|
+
* To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
|
|
2319
|
+
*/
|
|
2320
|
+
'anthropic-beta'?: string;
|
|
2321
|
+
};
|
|
2322
|
+
path?: never;
|
|
2323
|
+
query?: {
|
|
2324
|
+
/**
|
|
2325
|
+
* ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.
|
|
2326
|
+
*/
|
|
2327
|
+
before_id?: string;
|
|
2328
|
+
/**
|
|
2329
|
+
* ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.
|
|
2330
|
+
*/
|
|
2331
|
+
after_id?: string;
|
|
2332
|
+
/**
|
|
2333
|
+
* Number of items to return per page.
|
|
2334
|
+
*
|
|
2335
|
+
* Defaults to `20`. Ranges from `1` to `1000`.
|
|
2336
|
+
*/
|
|
2337
|
+
limit?: number;
|
|
2338
|
+
};
|
|
2339
|
+
url: '/v1/models';
|
|
2340
|
+
};
|
|
2341
|
+
|
|
2342
|
+
export type ModelsListErrors = {
|
|
2343
|
+
/**
|
|
2344
|
+
* Error response.
|
|
2345
|
+
*
|
|
2346
|
+
* See our [errors documentation](https://docs.claude.com/en/api/errors) for more details.
|
|
2347
|
+
*/
|
|
2348
|
+
'4XX': ErrorResponse;
|
|
2349
|
+
};
|
|
2350
|
+
|
|
2351
|
+
export type ModelsListError = ModelsListErrors[keyof ModelsListErrors];
|
|
2352
|
+
|
|
2353
|
+
export type ModelsListResponses = {
|
|
2354
|
+
/**
|
|
2355
|
+
* Successful Response
|
|
2356
|
+
*/
|
|
2357
|
+
200: ListResponseModelInfo;
|
|
2358
|
+
};
|
|
2359
|
+
|
|
2360
|
+
export type ModelsListResponse = ModelsListResponses[keyof ModelsListResponses];
|
|
2361
|
+
|
|
2362
|
+
export type ModelsGetData = {
|
|
2363
|
+
body?: never;
|
|
2364
|
+
headers?: {
|
|
2365
|
+
/**
|
|
2366
|
+
* The version of the Claude API you want to use.
|
|
2367
|
+
*
|
|
2368
|
+
* Read more about versioning and our version history [here](https://docs.claude.com/en/api/versioning).
|
|
2369
|
+
*/
|
|
2370
|
+
'anthropic-version'?: string;
|
|
2371
|
+
/**
|
|
2372
|
+
* Your unique API key for authentication.
|
|
2373
|
+
*
|
|
2374
|
+
* This key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace.
|
|
2375
|
+
*/
|
|
2376
|
+
'x-api-key'?: string;
|
|
2377
|
+
/**
|
|
2378
|
+
* Optional header to specify the beta version(s) you want to use.
|
|
2379
|
+
*
|
|
2380
|
+
* To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
|
|
2381
|
+
*/
|
|
2382
|
+
'anthropic-beta'?: string;
|
|
2383
|
+
};
|
|
2384
|
+
path: {
|
|
2385
|
+
/**
|
|
2386
|
+
* Model identifier or alias.
|
|
2387
|
+
*/
|
|
2388
|
+
model_id: string;
|
|
2389
|
+
};
|
|
2390
|
+
query?: never;
|
|
2391
|
+
url: '/v1/models/{model_id}';
|
|
2392
|
+
};
|
|
2393
|
+
|
|
2394
|
+
export type ModelsGetErrors = {
|
|
2395
|
+
/**
|
|
2396
|
+
* Error response.
|
|
2397
|
+
*
|
|
2398
|
+
* See our [errors documentation](https://docs.claude.com/en/api/errors) for more details.
|
|
2399
|
+
*/
|
|
2400
|
+
'4XX': ErrorResponse;
|
|
2401
|
+
};
|
|
2402
|
+
|
|
2403
|
+
export type ModelsGetError = ModelsGetErrors[keyof ModelsGetErrors];
|
|
2404
|
+
|
|
2405
|
+
export type ModelsGetResponses = {
|
|
2406
|
+
/**
|
|
2407
|
+
* Successful Response
|
|
2408
|
+
*/
|
|
2409
|
+
200: ModelInfo;
|
|
2410
|
+
};
|
|
2411
|
+
|
|
2412
|
+
export type ModelsGetResponse = ModelsGetResponses[keyof ModelsGetResponses];
|
|
2413
|
+
|
|
2414
|
+
export type ClientOptions = {
|
|
2415
|
+
baseUrl: 'https://api.anthropic.com' | (string & {});
|
|
2416
|
+
};
|