@cloudflare/workers-types 4.20260317.1 → 4.20260329.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -480,6 +480,11 @@ export type ExportedHandlerFetchHandler<
480
480
  env: Env,
481
481
  ctx: ExecutionContext<Props>,
482
482
  ) => Response | Promise<Response>;
483
+ export type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
484
+ socket: Socket,
485
+ env: Env,
486
+ ctx: ExecutionContext<Props>,
487
+ ) => void | Promise<void>;
483
488
  export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
484
489
  events: TraceItem[],
485
490
  env: Env,
@@ -521,6 +526,7 @@ export interface ExportedHandler<
521
526
  Props = unknown,
522
527
  > {
523
528
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
529
+ connect?: ExportedHandlerConnectHandler<Env, Props>;
524
530
  tail?: ExportedHandlerTailHandler<Env, Props>;
525
531
  trace?: ExportedHandlerTraceHandler<Env, Props>;
526
532
  tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
@@ -535,12 +541,14 @@ export interface StructuredSerializeOptions {
535
541
  export interface AlarmInvocationInfo {
536
542
  readonly isRetry: boolean;
537
543
  readonly retryCount: number;
544
+ readonly scheduledTime: number;
538
545
  }
539
546
  export interface Cloudflare {
540
547
  readonly compatibilityFlags: Record<string, boolean>;
541
548
  }
542
549
  export interface DurableObject {
543
550
  fetch(request: Request): Response | Promise<Response>;
551
+ connect?(socket: Socket): void | Promise<void>;
544
552
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
545
553
  webSocketMessage?(
546
554
  ws: WebSocket,
@@ -558,7 +566,7 @@ export type DurableObjectStub<
558
566
  T extends Rpc.DurableObjectBranded | undefined = undefined,
559
567
  > = Fetcher<
560
568
  T,
561
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
569
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
562
570
  > & {
563
571
  readonly id: DurableObjectId;
564
572
  readonly name?: string;
@@ -567,6 +575,7 @@ export interface DurableObjectId {
567
575
  toString(): string;
568
576
  equals(other: DurableObjectId): boolean;
569
577
  readonly name?: string;
578
+ readonly jurisdiction?: string;
570
579
  }
571
580
  export declare abstract class DurableObjectNamespace<
572
581
  T extends Rpc.DurableObjectBranded | undefined = undefined,
@@ -3087,6 +3096,7 @@ export interface TraceItem {
3087
3096
  | (
3088
3097
  | TraceItemFetchEventInfo
3089
3098
  | TraceItemJsRpcEventInfo
3099
+ | TraceItemConnectEventInfo
3090
3100
  | TraceItemScheduledEventInfo
3091
3101
  | TraceItemAlarmEventInfo
3092
3102
  | TraceItemQueueEventInfo
@@ -3105,6 +3115,7 @@ export interface TraceItem {
3105
3115
  readonly scriptVersion?: ScriptVersion;
3106
3116
  readonly dispatchNamespace?: string;
3107
3117
  readonly scriptTags?: string[];
3118
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3108
3119
  readonly durableObjectId?: string;
3109
3120
  readonly outcome: string;
3110
3121
  readonly executionModel: string;
@@ -3115,6 +3126,7 @@ export interface TraceItem {
3115
3126
  export interface TraceItemAlarmEventInfo {
3116
3127
  readonly scheduledTime: Date;
3117
3128
  }
3129
+ export interface TraceItemConnectEventInfo {}
3118
3130
  export interface TraceItemCustomEventInfo {}
3119
3131
  export interface TraceItemScheduledEventInfo {
3120
3132
  readonly scheduledTime: number;
@@ -3655,7 +3667,7 @@ export interface ContainerStartupOptions {
3655
3667
  entrypoint?: string[];
3656
3668
  enableInternet: boolean;
3657
3669
  env?: Record<string, string>;
3658
- hardTimeout?: number | bigint;
3670
+ labels?: Record<string, string>;
3659
3671
  }
3660
3672
  /**
3661
3673
  * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
@@ -4224,6 +4236,402 @@ export declare abstract class BaseAiTranslation {
4224
4236
  inputs: AiTranslationInput;
4225
4237
  postProcessedOutputs: AiTranslationOutput;
4226
4238
  }
4239
+ /**
4240
+ * Workers AI support for OpenAI's Chat Completions API
4241
+ */
4242
+ export type ChatCompletionContentPartText = {
4243
+ type: "text";
4244
+ text: string;
4245
+ };
4246
+ export type ChatCompletionContentPartImage = {
4247
+ type: "image_url";
4248
+ image_url: {
4249
+ url: string;
4250
+ detail?: "auto" | "low" | "high";
4251
+ };
4252
+ };
4253
+ export type ChatCompletionContentPartInputAudio = {
4254
+ type: "input_audio";
4255
+ input_audio: {
4256
+ /** Base64 encoded audio data. */
4257
+ data: string;
4258
+ format: "wav" | "mp3";
4259
+ };
4260
+ };
4261
+ export type ChatCompletionContentPartFile = {
4262
+ type: "file";
4263
+ file: {
4264
+ /** Base64 encoded file data. */
4265
+ file_data?: string;
4266
+ /** The ID of an uploaded file. */
4267
+ file_id?: string;
4268
+ filename?: string;
4269
+ };
4270
+ };
4271
+ export type ChatCompletionContentPartRefusal = {
4272
+ type: "refusal";
4273
+ refusal: string;
4274
+ };
4275
+ export type ChatCompletionContentPart =
4276
+ | ChatCompletionContentPartText
4277
+ | ChatCompletionContentPartImage
4278
+ | ChatCompletionContentPartInputAudio
4279
+ | ChatCompletionContentPartFile;
4280
+ export type FunctionDefinition = {
4281
+ name: string;
4282
+ description?: string;
4283
+ parameters?: Record<string, unknown>;
4284
+ strict?: boolean | null;
4285
+ };
4286
+ export type ChatCompletionFunctionTool = {
4287
+ type: "function";
4288
+ function: FunctionDefinition;
4289
+ };
4290
+ export type ChatCompletionCustomToolGrammarFormat = {
4291
+ type: "grammar";
4292
+ grammar: {
4293
+ definition: string;
4294
+ syntax: "lark" | "regex";
4295
+ };
4296
+ };
4297
+ export type ChatCompletionCustomToolTextFormat = {
4298
+ type: "text";
4299
+ };
4300
+ export type ChatCompletionCustomToolFormat =
4301
+ | ChatCompletionCustomToolTextFormat
4302
+ | ChatCompletionCustomToolGrammarFormat;
4303
+ export type ChatCompletionCustomTool = {
4304
+ type: "custom";
4305
+ custom: {
4306
+ name: string;
4307
+ description?: string;
4308
+ format?: ChatCompletionCustomToolFormat;
4309
+ };
4310
+ };
4311
+ export type ChatCompletionTool =
4312
+ | ChatCompletionFunctionTool
4313
+ | ChatCompletionCustomTool;
4314
+ export type ChatCompletionMessageFunctionToolCall = {
4315
+ id: string;
4316
+ type: "function";
4317
+ function: {
4318
+ name: string;
4319
+ /** JSON-encoded arguments string. */
4320
+ arguments: string;
4321
+ };
4322
+ };
4323
+ export type ChatCompletionMessageCustomToolCall = {
4324
+ id: string;
4325
+ type: "custom";
4326
+ custom: {
4327
+ name: string;
4328
+ input: string;
4329
+ };
4330
+ };
4331
+ export type ChatCompletionMessageToolCall =
4332
+ | ChatCompletionMessageFunctionToolCall
4333
+ | ChatCompletionMessageCustomToolCall;
4334
+ export type ChatCompletionToolChoiceFunction = {
4335
+ type: "function";
4336
+ function: {
4337
+ name: string;
4338
+ };
4339
+ };
4340
+ export type ChatCompletionToolChoiceCustom = {
4341
+ type: "custom";
4342
+ custom: {
4343
+ name: string;
4344
+ };
4345
+ };
4346
+ export type ChatCompletionToolChoiceAllowedTools = {
4347
+ type: "allowed_tools";
4348
+ allowed_tools: {
4349
+ mode: "auto" | "required";
4350
+ tools: Array<Record<string, unknown>>;
4351
+ };
4352
+ };
4353
+ export type ChatCompletionToolChoiceOption =
4354
+ | "none"
4355
+ | "auto"
4356
+ | "required"
4357
+ | ChatCompletionToolChoiceFunction
4358
+ | ChatCompletionToolChoiceCustom
4359
+ | ChatCompletionToolChoiceAllowedTools;
4360
+ export type DeveloperMessage = {
4361
+ role: "developer";
4362
+ content:
4363
+ | string
4364
+ | Array<{
4365
+ type: "text";
4366
+ text: string;
4367
+ }>;
4368
+ name?: string;
4369
+ };
4370
+ export type SystemMessage = {
4371
+ role: "system";
4372
+ content:
4373
+ | string
4374
+ | Array<{
4375
+ type: "text";
4376
+ text: string;
4377
+ }>;
4378
+ name?: string;
4379
+ };
4380
+ /**
4381
+ * Permissive merged content part used inside UserMessage arrays.
4382
+ *
4383
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4384
+ * inside nested array items does not correctly match different branches for
4385
+ * different array elements, so the schema uses a single merged object.
4386
+ */
4387
+ export type UserMessageContentPart = {
4388
+ type: "text" | "image_url" | "input_audio" | "file";
4389
+ text?: string;
4390
+ image_url?: {
4391
+ url?: string;
4392
+ detail?: "auto" | "low" | "high";
4393
+ };
4394
+ input_audio?: {
4395
+ data?: string;
4396
+ format?: "wav" | "mp3";
4397
+ };
4398
+ file?: {
4399
+ file_data?: string;
4400
+ file_id?: string;
4401
+ filename?: string;
4402
+ };
4403
+ };
4404
+ export type UserMessage = {
4405
+ role: "user";
4406
+ content: string | Array<UserMessageContentPart>;
4407
+ name?: string;
4408
+ };
4409
+ export type AssistantMessageContentPart = {
4410
+ type: "text" | "refusal";
4411
+ text?: string;
4412
+ refusal?: string;
4413
+ };
4414
+ export type AssistantMessage = {
4415
+ role: "assistant";
4416
+ content?: string | null | Array<AssistantMessageContentPart>;
4417
+ refusal?: string | null;
4418
+ name?: string;
4419
+ audio?: {
4420
+ id: string;
4421
+ };
4422
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4423
+ function_call?: {
4424
+ name: string;
4425
+ arguments: string;
4426
+ };
4427
+ };
4428
+ export type ToolMessage = {
4429
+ role: "tool";
4430
+ content:
4431
+ | string
4432
+ | Array<{
4433
+ type: "text";
4434
+ text: string;
4435
+ }>;
4436
+ tool_call_id: string;
4437
+ };
4438
+ export type FunctionMessage = {
4439
+ role: "function";
4440
+ content: string;
4441
+ name: string;
4442
+ };
4443
+ export type ChatCompletionMessageParam =
4444
+ | DeveloperMessage
4445
+ | SystemMessage
4446
+ | UserMessage
4447
+ | AssistantMessage
4448
+ | ToolMessage
4449
+ | FunctionMessage;
4450
+ export type ChatCompletionsResponseFormatText = {
4451
+ type: "text";
4452
+ };
4453
+ export type ChatCompletionsResponseFormatJSONObject = {
4454
+ type: "json_object";
4455
+ };
4456
+ export type ResponseFormatJSONSchema = {
4457
+ type: "json_schema";
4458
+ json_schema: {
4459
+ name: string;
4460
+ description?: string;
4461
+ schema?: Record<string, unknown>;
4462
+ strict?: boolean | null;
4463
+ };
4464
+ };
4465
+ export type ResponseFormat =
4466
+ | ChatCompletionsResponseFormatText
4467
+ | ChatCompletionsResponseFormatJSONObject
4468
+ | ResponseFormatJSONSchema;
4469
+ export type ChatCompletionsStreamOptions = {
4470
+ include_usage?: boolean;
4471
+ include_obfuscation?: boolean;
4472
+ };
4473
+ export type PredictionContent = {
4474
+ type: "content";
4475
+ content:
4476
+ | string
4477
+ | Array<{
4478
+ type: "text";
4479
+ text: string;
4480
+ }>;
4481
+ };
4482
+ export type AudioParams = {
4483
+ voice:
4484
+ | string
4485
+ | {
4486
+ id: string;
4487
+ };
4488
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4489
+ };
4490
+ export type WebSearchUserLocation = {
4491
+ type: "approximate";
4492
+ approximate: {
4493
+ city?: string;
4494
+ country?: string;
4495
+ region?: string;
4496
+ timezone?: string;
4497
+ };
4498
+ };
4499
+ export type WebSearchOptions = {
4500
+ search_context_size?: "low" | "medium" | "high";
4501
+ user_location?: WebSearchUserLocation;
4502
+ };
4503
+ export type ChatTemplateKwargs = {
4504
+ /** Whether to enable reasoning, enabled by default. */
4505
+ enable_thinking?: boolean;
4506
+ /** If false, preserves reasoning context between turns. */
4507
+ clear_thinking?: boolean;
4508
+ };
4509
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4510
+ export type ChatCompletionsCommonOptions = {
4511
+ model?: string;
4512
+ audio?: AudioParams;
4513
+ frequency_penalty?: number | null;
4514
+ logit_bias?: Record<string, unknown> | null;
4515
+ logprobs?: boolean | null;
4516
+ top_logprobs?: number | null;
4517
+ max_tokens?: number | null;
4518
+ max_completion_tokens?: number | null;
4519
+ metadata?: Record<string, unknown> | null;
4520
+ modalities?: Array<"text" | "audio"> | null;
4521
+ n?: number | null;
4522
+ parallel_tool_calls?: boolean;
4523
+ prediction?: PredictionContent;
4524
+ presence_penalty?: number | null;
4525
+ reasoning_effort?: "low" | "medium" | "high" | null;
4526
+ chat_template_kwargs?: ChatTemplateKwargs;
4527
+ response_format?: ResponseFormat;
4528
+ seed?: number | null;
4529
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4530
+ stop?: string | Array<string> | null;
4531
+ store?: boolean | null;
4532
+ stream?: boolean | null;
4533
+ stream_options?: ChatCompletionsStreamOptions;
4534
+ temperature?: number | null;
4535
+ tool_choice?: ChatCompletionToolChoiceOption;
4536
+ tools?: Array<ChatCompletionTool>;
4537
+ top_p?: number | null;
4538
+ user?: string;
4539
+ web_search_options?: WebSearchOptions;
4540
+ function_call?:
4541
+ | "none"
4542
+ | "auto"
4543
+ | {
4544
+ name: string;
4545
+ };
4546
+ functions?: Array<FunctionDefinition>;
4547
+ };
4548
+ export type PromptTokensDetails = {
4549
+ cached_tokens?: number;
4550
+ audio_tokens?: number;
4551
+ };
4552
+ export type CompletionTokensDetails = {
4553
+ reasoning_tokens?: number;
4554
+ audio_tokens?: number;
4555
+ accepted_prediction_tokens?: number;
4556
+ rejected_prediction_tokens?: number;
4557
+ };
4558
+ export type CompletionUsage = {
4559
+ prompt_tokens: number;
4560
+ completion_tokens: number;
4561
+ total_tokens: number;
4562
+ prompt_tokens_details?: PromptTokensDetails;
4563
+ completion_tokens_details?: CompletionTokensDetails;
4564
+ };
4565
+ export type ChatCompletionTopLogprob = {
4566
+ token: string;
4567
+ logprob: number;
4568
+ bytes: Array<number> | null;
4569
+ };
4570
+ export type ChatCompletionTokenLogprob = {
4571
+ token: string;
4572
+ logprob: number;
4573
+ bytes: Array<number> | null;
4574
+ top_logprobs: Array<ChatCompletionTopLogprob>;
4575
+ };
4576
+ export type ChatCompletionAudio = {
4577
+ id: string;
4578
+ /** Base64 encoded audio bytes. */
4579
+ data: string;
4580
+ expires_at: number;
4581
+ transcript: string;
4582
+ };
4583
+ export type ChatCompletionUrlCitation = {
4584
+ type: "url_citation";
4585
+ url_citation: {
4586
+ url: string;
4587
+ title: string;
4588
+ start_index: number;
4589
+ end_index: number;
4590
+ };
4591
+ };
4592
+ export type ChatCompletionResponseMessage = {
4593
+ role: "assistant";
4594
+ content: string | null;
4595
+ refusal: string | null;
4596
+ annotations?: Array<ChatCompletionUrlCitation>;
4597
+ audio?: ChatCompletionAudio;
4598
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4599
+ function_call?: {
4600
+ name: string;
4601
+ arguments: string;
4602
+ } | null;
4603
+ };
4604
+ export type ChatCompletionLogprobs = {
4605
+ content: Array<ChatCompletionTokenLogprob> | null;
4606
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
4607
+ };
4608
+ export type ChatCompletionChoice = {
4609
+ index: number;
4610
+ message: ChatCompletionResponseMessage;
4611
+ finish_reason:
4612
+ | "stop"
4613
+ | "length"
4614
+ | "tool_calls"
4615
+ | "content_filter"
4616
+ | "function_call";
4617
+ logprobs: ChatCompletionLogprobs | null;
4618
+ };
4619
+ export type ChatCompletionsPromptInput = {
4620
+ prompt: string;
4621
+ } & ChatCompletionsCommonOptions;
4622
+ export type ChatCompletionsMessagesInput = {
4623
+ messages: Array<ChatCompletionMessageParam>;
4624
+ } & ChatCompletionsCommonOptions;
4625
+ export type ChatCompletionsOutput = {
4626
+ id: string;
4627
+ object: string;
4628
+ created: number;
4629
+ model: string;
4630
+ choices: Array<ChatCompletionChoice>;
4631
+ usage?: CompletionUsage;
4632
+ system_fingerprint?: string | null;
4633
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4634
+ };
4227
4635
  /**
4228
4636
  * Workers AI support for OpenAI's Responses API
4229
4637
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4646,6 +5054,12 @@ export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4646
5054
  export type StreamOptions = {
4647
5055
  include_obfuscation?: boolean;
4648
5056
  };
5057
+ /** Marks keys from T that aren't in U as optional never */
5058
+ export type Without<T, U> = {
5059
+ [P in Exclude<keyof T, keyof U>]?: never;
5060
+ };
5061
+ /** Either T or U, but not both (mutually exclusive) */
5062
+ export type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4649
5063
  export type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4650
5064
  | {
4651
5065
  text: string | string[];
@@ -4938,10 +5352,12 @@ export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
4938
5352
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
4939
5353
  }
4940
5354
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
4941
- /**
4942
- * Base64 encoded value of the audio data.
4943
- */
4944
- audio: string;
5355
+ audio:
5356
+ | string
5357
+ | {
5358
+ body?: object;
5359
+ contentType?: string;
5360
+ };
4945
5361
  /**
4946
5362
  * Supported tasks are 'translate' or 'transcribe'.
4947
5363
  */
@@ -4959,9 +5375,33 @@ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
4959
5375
  */
4960
5376
  initial_prompt?: string;
4961
5377
  /**
4962
- * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
5378
+ * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
4963
5379
  */
4964
5380
  prefix?: string;
5381
+ /**
5382
+ * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
5383
+ */
5384
+ beam_size?: number;
5385
+ /**
5386
+ * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
5387
+ */
5388
+ condition_on_previous_text?: boolean;
5389
+ /**
5390
+ * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
5391
+ */
5392
+ no_speech_threshold?: number;
5393
+ /**
5394
+ * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
5395
+ */
5396
+ compression_ratio_threshold?: number;
5397
+ /**
5398
+ * Threshold for filtering out segments with low average log probability, indicating low confidence.
5399
+ */
5400
+ log_prob_threshold?: number;
5401
+ /**
5402
+ * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
5403
+ */
5404
+ hallucination_silence_threshold?: number;
4965
5405
  }
4966
5406
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
4967
5407
  transcription_info?: {
@@ -5108,11 +5548,11 @@ export interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5108
5548
  truncate_inputs?: boolean;
5109
5549
  }
5110
5550
  export type Ai_Cf_Baai_Bge_M3_Output =
5111
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5551
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5112
5552
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5113
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5553
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5114
5554
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5115
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5555
+ export interface Ai_Cf_Baai_Bge_M3_Output_Query {
5116
5556
  response?: {
5117
5557
  /**
5118
5558
  * Index of the context in the request
@@ -5132,7 +5572,7 @@ export interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5132
5572
  */
5133
5573
  pooling?: "mean" | "cls";
5134
5574
  }
5135
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
5575
+ export interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5136
5576
  shape?: number[];
5137
5577
  /**
5138
5578
  * Embeddings of the requested text values
@@ -5237,7 +5677,7 @@ export interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5237
5677
  */
5238
5678
  role?: string;
5239
5679
  /**
5240
- * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001
5680
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5241
5681
  */
5242
5682
  tool_call_id?: string;
5243
5683
  content?:
@@ -5492,10 +5932,18 @@ export interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5492
5932
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5493
5933
  */
5494
5934
  role: string;
5495
- /**
5496
- * The content of the message as a string.
5497
- */
5498
- content: string;
5935
+ content:
5936
+ | string
5937
+ | {
5938
+ /**
5939
+ * Type of the content (text)
5940
+ */
5941
+ type?: string;
5942
+ /**
5943
+ * Text content
5944
+ */
5945
+ text?: string;
5946
+ }[];
5499
5947
  }[];
5500
5948
  functions?: {
5501
5949
  name: string;
@@ -6151,7 +6599,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6151
6599
  */
6152
6600
  role?: string;
6153
6601
  /**
6154
- * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001
6602
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
6155
6603
  */
6156
6604
  tool_call_id?: string;
6157
6605
  content?:
@@ -6278,7 +6726,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6278
6726
  }
6279
6727
  )[];
6280
6728
  /**
6281
- * JSON schema that should be fulfilled for the response.
6729
+ * JSON schema that should be fufilled for the response.
6282
6730
  */
6283
6731
  guided_json?: object;
6284
6732
  /**
@@ -6552,7 +7000,7 @@ export interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6552
7000
  }
6553
7001
  )[];
6554
7002
  /**
6555
- * JSON schema that should be fulfilled for the response.
7003
+ * JSON schema that should be fufilled for the response.
6556
7004
  */
6557
7005
  guided_json?: object;
6558
7006
  /**
@@ -6645,7 +7093,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6645
7093
  */
6646
7094
  prompt: string;
6647
7095
  /**
6648
- * JSON schema that should be fulfilled for the response.
7096
+ * JSON schema that should be fufilled for the response.
6649
7097
  */
6650
7098
  guided_json?: object;
6651
7099
  /**
@@ -6809,7 +7257,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6809
7257
  }
6810
7258
  )[];
6811
7259
  /**
6812
- * JSON schema that should be fulfilled for the response.
7260
+ * JSON schema that should be fufilled for the response.
6813
7261
  */
6814
7262
  guided_json?: object;
6815
7263
  /**
@@ -7090,7 +7538,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7090
7538
  )[];
7091
7539
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7092
7540
  /**
7093
- * JSON schema that should be fulfilled for the response.
7541
+ * JSON schema that should be fufilled for the response.
7094
7542
  */
7095
7543
  guided_json?: object;
7096
7544
  /**
@@ -7329,7 +7777,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7329
7777
  )[];
7330
7778
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7331
7779
  /**
7332
- * JSON schema that should be fulfilled for the response.
7780
+ * JSON schema that should be fufilled for the response.
7333
7781
  */
7334
7782
  guided_json?: object;
7335
7783
  /**
@@ -7494,10 +7942,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7494
7942
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7495
7943
  */
7496
7944
  role: string;
7497
- /**
7498
- * The content of the message as a string.
7499
- */
7500
- content: string;
7945
+ content:
7946
+ | string
7947
+ | {
7948
+ /**
7949
+ * Type of the content (text)
7950
+ */
7951
+ type?: string;
7952
+ /**
7953
+ * Text content
7954
+ */
7955
+ text?: string;
7956
+ }[];
7501
7957
  }[];
7502
7958
  functions?: {
7503
7959
  name: string;
@@ -7709,10 +8165,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7709
8165
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7710
8166
  */
7711
8167
  role: string;
7712
- /**
7713
- * The content of the message as a string.
7714
- */
7715
- content: string;
8168
+ content:
8169
+ | string
8170
+ | {
8171
+ /**
8172
+ * Type of the content (text)
8173
+ */
8174
+ type?: string;
8175
+ /**
8176
+ * Text content
8177
+ */
8178
+ text?: string;
8179
+ }[];
7716
8180
  }[];
7717
8181
  functions?: {
7718
8182
  name: string;
@@ -8280,12 +8744,12 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8280
8744
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8281
8745
  }
8282
8746
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8283
- inputs: ResponsesInput;
8284
- postProcessedOutputs: ResponsesOutput;
8747
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8748
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8285
8749
  }
8286
8750
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8287
- inputs: ResponsesInput;
8288
- postProcessedOutputs: ResponsesOutput;
8751
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8752
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8289
8753
  }
8290
8754
  export interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8291
8755
  /**
@@ -8417,7 +8881,7 @@ export interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8417
8881
  */
8418
8882
  text: string | string[];
8419
8883
  /**
8420
- * Target language to translate to
8884
+ * Target langauge to translate to
8421
8885
  */
8422
8886
  target_language:
8423
8887
  | "asm_Beng"
@@ -8533,10 +8997,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8533
8997
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8534
8998
  */
8535
8999
  role: string;
8536
- /**
8537
- * The content of the message as a string.
8538
- */
8539
- content: string;
9000
+ content:
9001
+ | string
9002
+ | {
9003
+ /**
9004
+ * Type of the content (text)
9005
+ */
9006
+ type?: string;
9007
+ /**
9008
+ * Text content
9009
+ */
9010
+ text?: string;
9011
+ }[];
8540
9012
  }[];
8541
9013
  functions?: {
8542
9014
  name: string;
@@ -8748,10 +9220,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8748
9220
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8749
9221
  */
8750
9222
  role: string;
8751
- /**
8752
- * The content of the message as a string.
8753
- */
8754
- content: string;
9223
+ content:
9224
+ | string
9225
+ | {
9226
+ /**
9227
+ * Type of the content (text)
9228
+ */
9229
+ type?: string;
9230
+ /**
9231
+ * Text content
9232
+ */
9233
+ text?: string;
9234
+ }[];
8755
9235
  }[];
8756
9236
  functions?: {
8757
9237
  name: string;
@@ -9306,6 +9786,66 @@ export declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9306
9786
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9307
9787
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9308
9788
  }
9789
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
9790
+ multipart: {
9791
+ body?: object;
9792
+ contentType?: string;
9793
+ };
9794
+ }
9795
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
9796
+ /**
9797
+ * Generated image as Base64 string.
9798
+ */
9799
+ image?: string;
9800
+ }
9801
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
9802
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
9803
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
9804
+ }
9805
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
9806
+ multipart: {
9807
+ body?: object;
9808
+ contentType?: string;
9809
+ };
9810
+ }
9811
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
9812
+ /**
9813
+ * Generated image as Base64 string.
9814
+ */
9815
+ image?: string;
9816
+ }
9817
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
9818
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
9819
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
9820
+ }
9821
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
9822
+ multipart: {
9823
+ body?: object;
9824
+ contentType?: string;
9825
+ };
9826
+ }
9827
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
9828
+ /**
9829
+ * Generated image as Base64 string.
9830
+ */
9831
+ image?: string;
9832
+ }
9833
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
9834
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
9835
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
9836
+ }
9837
+ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
9838
+ inputs: ChatCompletionsInput;
9839
+ postProcessedOutputs: ChatCompletionsOutput;
9840
+ }
9841
+ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
9842
+ inputs: ChatCompletionsInput;
9843
+ postProcessedOutputs: ChatCompletionsOutput;
9844
+ }
9845
+ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
9846
+ inputs: ChatCompletionsInput;
9847
+ postProcessedOutputs: ChatCompletionsOutput;
9848
+ }
9309
9849
  export interface AiModels {
9310
9850
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9311
9851
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9324,7 +9864,6 @@ export interface AiModels {
9324
9864
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9325
9865
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9326
9866
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9327
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9328
9867
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9329
9868
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9330
9869
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9391,6 +9930,12 @@ export interface AiModels {
9391
9930
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9392
9931
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9393
9932
  "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
9933
+ "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
9934
+ "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
9935
+ "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
9936
+ "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
9937
+ "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
9938
+ "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
9394
9939
  }
9395
9940
  export type AiOptions = {
9396
9941
  /**
@@ -9442,6 +9987,16 @@ export type AiModelsSearchObject = {
9442
9987
  value: string;
9443
9988
  }[];
9444
9989
  };
9990
+ export type ChatCompletionsBase = XOR<
9991
+ ChatCompletionsPromptInput,
9992
+ ChatCompletionsMessagesInput
9993
+ >;
9994
+ export type ChatCompletionsInput = XOR<
9995
+ ChatCompletionsBase,
9996
+ {
9997
+ requests: ChatCompletionsBase[];
9998
+ }
9999
+ >;
9445
10000
  export interface InferenceUpstreamError extends Error {}
9446
10001
  export interface AiInternalError extends Error {}
9447
10002
  export type AiModelListType = Record<string, any>;
@@ -9918,6 +10473,41 @@ export interface RequestInitCfProperties extends Record<string, unknown> {
9918
10473
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
9919
10474
  */
9920
10475
  cacheTtlByStatus?: Record<string, number>;
10476
+ /**
10477
+ * Explicit Cache-Control header value to set on the response stored in cache.
10478
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10479
+ *
10480
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10481
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10482
+ *
10483
+ * Can be used together with `cacheTtlByStatus`.
10484
+ */
10485
+ cacheControl?: string;
10486
+ /**
10487
+ * Whether the response should be eligible for Cache Reserve storage.
10488
+ */
10489
+ cacheReserveEligible?: boolean;
10490
+ /**
10491
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10492
+ */
10493
+ respectStrongEtag?: boolean;
10494
+ /**
10495
+ * Whether to strip ETag headers from the origin response before caching.
10496
+ */
10497
+ stripEtags?: boolean;
10498
+ /**
10499
+ * Whether to strip Last-Modified headers from the origin response before caching.
10500
+ */
10501
+ stripLastModified?: boolean;
10502
+ /**
10503
+ * Whether to enable Cache Deception Armor, which protects against web cache
10504
+ * deception attacks by verifying the Content-Type matches the URL extension.
10505
+ */
10506
+ cacheDeceptionArmor?: boolean;
10507
+ /**
10508
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10509
+ */
10510
+ cacheReserveMinimumFileSize?: number;
9921
10511
  scrapeShield?: boolean;
9922
10512
  apps?: boolean;
9923
10513
  image?: RequestInitCfPropertiesImage;
@@ -11786,6 +12376,7 @@ export declare namespace CloudflareWorkersModule {
11786
12376
  constructor(ctx: ExecutionContext, env: Env);
11787
12377
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11788
12378
  fetch?(request: Request): Response | Promise<Response>;
12379
+ connect?(socket: Socket): void | Promise<void>;
11789
12380
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11790
12381
  scheduled?(controller: ScheduledController): void | Promise<void>;
11791
12382
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11806,6 +12397,7 @@ export declare namespace CloudflareWorkersModule {
11806
12397
  constructor(ctx: DurableObjectState, env: Env);
11807
12398
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11808
12399
  fetch?(request: Request): Response | Promise<Response>;
12400
+ connect?(socket: Socket): void | Promise<void>;
11809
12401
  webSocketMessage?(
11810
12402
  ws: WebSocket,
11811
12403
  message: string | ArrayBuffer,
@@ -11946,17 +12538,6 @@ export interface StreamBinding {
11946
12538
  * @returns A handle for per-video operations.
11947
12539
  */
11948
12540
  video(id: string): StreamVideoHandle;
11949
- /**
11950
- * Uploads a new video from a File.
11951
- * @param file The video file to upload.
11952
- * @returns The uploaded video details.
11953
- * @throws {BadRequestError} if the upload parameter is invalid
11954
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
11955
- * @throws {MaxFileSizeError} if the file size is too large
11956
- * @throws {RateLimitedError} if the server received too many requests
11957
- * @throws {InternalError} if an unexpected error occurs
11958
- */
11959
- upload(file: File): Promise<StreamVideo>;
11960
12541
  /**
11961
12542
  * Uploads a new video from a provided URL.
11962
12543
  * @param url The URL to upload from.
@@ -12806,6 +13387,9 @@ export declare namespace TailStream {
12806
13387
  readonly type: "fetch";
12807
13388
  readonly statusCode: number;
12808
13389
  }
13390
+ interface ConnectEventInfo {
13391
+ readonly type: "connect";
13392
+ }
12809
13393
  type EventOutcome =
12810
13394
  | "ok"
12811
13395
  | "canceled"
@@ -12836,6 +13420,7 @@ export declare namespace TailStream {
12836
13420
  readonly scriptVersion?: ScriptVersion;
12837
13421
  readonly info:
12838
13422
  | FetchEventInfo
13423
+ | ConnectEventInfo
12839
13424
  | JsRpcEventInfo
12840
13425
  | ScheduledEventInfo
12841
13426
  | AlarmEventInfo