@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.
package/latest/index.ts CHANGED
@@ -491,6 +491,11 @@ export type ExportedHandlerFetchHandler<
491
491
  env: Env,
492
492
  ctx: ExecutionContext<Props>,
493
493
  ) => Response | Promise<Response>;
494
+ export type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
495
+ socket: Socket,
496
+ env: Env,
497
+ ctx: ExecutionContext<Props>,
498
+ ) => void | Promise<void>;
494
499
  export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
495
500
  events: TraceItem[],
496
501
  env: Env,
@@ -532,6 +537,7 @@ export interface ExportedHandler<
532
537
  Props = unknown,
533
538
  > {
534
539
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
540
+ connect?: ExportedHandlerConnectHandler<Env, Props>;
535
541
  tail?: ExportedHandlerTailHandler<Env, Props>;
536
542
  trace?: ExportedHandlerTraceHandler<Env, Props>;
537
543
  tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
@@ -553,12 +559,14 @@ export declare abstract class Navigator {
553
559
  export interface AlarmInvocationInfo {
554
560
  readonly isRetry: boolean;
555
561
  readonly retryCount: number;
562
+ readonly scheduledTime: number;
556
563
  }
557
564
  export interface Cloudflare {
558
565
  readonly compatibilityFlags: Record<string, boolean>;
559
566
  }
560
567
  export interface DurableObject {
561
568
  fetch(request: Request): Response | Promise<Response>;
569
+ connect?(socket: Socket): void | Promise<void>;
562
570
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
563
571
  webSocketMessage?(
564
572
  ws: WebSocket,
@@ -576,7 +584,7 @@ export type DurableObjectStub<
576
584
  T extends Rpc.DurableObjectBranded | undefined = undefined,
577
585
  > = Fetcher<
578
586
  T,
579
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
587
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
580
588
  > & {
581
589
  readonly id: DurableObjectId;
582
590
  readonly name?: string;
@@ -585,6 +593,7 @@ export interface DurableObjectId {
585
593
  toString(): string;
586
594
  equals(other: DurableObjectId): boolean;
587
595
  readonly name?: string;
596
+ readonly jurisdiction?: string;
588
597
  }
589
598
  export declare abstract class DurableObjectNamespace<
590
599
  T extends Rpc.DurableObjectBranded | undefined = undefined,
@@ -3126,6 +3135,7 @@ export interface TraceItem {
3126
3135
  | (
3127
3136
  | TraceItemFetchEventInfo
3128
3137
  | TraceItemJsRpcEventInfo
3138
+ | TraceItemConnectEventInfo
3129
3139
  | TraceItemScheduledEventInfo
3130
3140
  | TraceItemAlarmEventInfo
3131
3141
  | TraceItemQueueEventInfo
@@ -3144,6 +3154,7 @@ export interface TraceItem {
3144
3154
  readonly scriptVersion?: ScriptVersion;
3145
3155
  readonly dispatchNamespace?: string;
3146
3156
  readonly scriptTags?: string[];
3157
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3147
3158
  readonly durableObjectId?: string;
3148
3159
  readonly outcome: string;
3149
3160
  readonly executionModel: string;
@@ -3154,6 +3165,7 @@ export interface TraceItem {
3154
3165
  export interface TraceItemAlarmEventInfo {
3155
3166
  readonly scheduledTime: Date;
3156
3167
  }
3168
+ export interface TraceItemConnectEventInfo {}
3157
3169
  export interface TraceItemCustomEventInfo {}
3158
3170
  export interface TraceItemScheduledEventInfo {
3159
3171
  readonly scheduledTime: number;
@@ -3775,7 +3787,7 @@ export interface ContainerStartupOptions {
3775
3787
  entrypoint?: string[];
3776
3788
  enableInternet: boolean;
3777
3789
  env?: Record<string, string>;
3778
- hardTimeout?: number | bigint;
3790
+ labels?: Record<string, string>;
3779
3791
  }
3780
3792
  /**
3781
3793
  * 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.
@@ -4364,6 +4376,402 @@ export declare abstract class BaseAiTranslation {
4364
4376
  inputs: AiTranslationInput;
4365
4377
  postProcessedOutputs: AiTranslationOutput;
4366
4378
  }
4379
+ /**
4380
+ * Workers AI support for OpenAI's Chat Completions API
4381
+ */
4382
+ export type ChatCompletionContentPartText = {
4383
+ type: "text";
4384
+ text: string;
4385
+ };
4386
+ export type ChatCompletionContentPartImage = {
4387
+ type: "image_url";
4388
+ image_url: {
4389
+ url: string;
4390
+ detail?: "auto" | "low" | "high";
4391
+ };
4392
+ };
4393
+ export type ChatCompletionContentPartInputAudio = {
4394
+ type: "input_audio";
4395
+ input_audio: {
4396
+ /** Base64 encoded audio data. */
4397
+ data: string;
4398
+ format: "wav" | "mp3";
4399
+ };
4400
+ };
4401
+ export type ChatCompletionContentPartFile = {
4402
+ type: "file";
4403
+ file: {
4404
+ /** Base64 encoded file data. */
4405
+ file_data?: string;
4406
+ /** The ID of an uploaded file. */
4407
+ file_id?: string;
4408
+ filename?: string;
4409
+ };
4410
+ };
4411
+ export type ChatCompletionContentPartRefusal = {
4412
+ type: "refusal";
4413
+ refusal: string;
4414
+ };
4415
+ export type ChatCompletionContentPart =
4416
+ | ChatCompletionContentPartText
4417
+ | ChatCompletionContentPartImage
4418
+ | ChatCompletionContentPartInputAudio
4419
+ | ChatCompletionContentPartFile;
4420
+ export type FunctionDefinition = {
4421
+ name: string;
4422
+ description?: string;
4423
+ parameters?: Record<string, unknown>;
4424
+ strict?: boolean | null;
4425
+ };
4426
+ export type ChatCompletionFunctionTool = {
4427
+ type: "function";
4428
+ function: FunctionDefinition;
4429
+ };
4430
+ export type ChatCompletionCustomToolGrammarFormat = {
4431
+ type: "grammar";
4432
+ grammar: {
4433
+ definition: string;
4434
+ syntax: "lark" | "regex";
4435
+ };
4436
+ };
4437
+ export type ChatCompletionCustomToolTextFormat = {
4438
+ type: "text";
4439
+ };
4440
+ export type ChatCompletionCustomToolFormat =
4441
+ | ChatCompletionCustomToolTextFormat
4442
+ | ChatCompletionCustomToolGrammarFormat;
4443
+ export type ChatCompletionCustomTool = {
4444
+ type: "custom";
4445
+ custom: {
4446
+ name: string;
4447
+ description?: string;
4448
+ format?: ChatCompletionCustomToolFormat;
4449
+ };
4450
+ };
4451
+ export type ChatCompletionTool =
4452
+ | ChatCompletionFunctionTool
4453
+ | ChatCompletionCustomTool;
4454
+ export type ChatCompletionMessageFunctionToolCall = {
4455
+ id: string;
4456
+ type: "function";
4457
+ function: {
4458
+ name: string;
4459
+ /** JSON-encoded arguments string. */
4460
+ arguments: string;
4461
+ };
4462
+ };
4463
+ export type ChatCompletionMessageCustomToolCall = {
4464
+ id: string;
4465
+ type: "custom";
4466
+ custom: {
4467
+ name: string;
4468
+ input: string;
4469
+ };
4470
+ };
4471
+ export type ChatCompletionMessageToolCall =
4472
+ | ChatCompletionMessageFunctionToolCall
4473
+ | ChatCompletionMessageCustomToolCall;
4474
+ export type ChatCompletionToolChoiceFunction = {
4475
+ type: "function";
4476
+ function: {
4477
+ name: string;
4478
+ };
4479
+ };
4480
+ export type ChatCompletionToolChoiceCustom = {
4481
+ type: "custom";
4482
+ custom: {
4483
+ name: string;
4484
+ };
4485
+ };
4486
+ export type ChatCompletionToolChoiceAllowedTools = {
4487
+ type: "allowed_tools";
4488
+ allowed_tools: {
4489
+ mode: "auto" | "required";
4490
+ tools: Array<Record<string, unknown>>;
4491
+ };
4492
+ };
4493
+ export type ChatCompletionToolChoiceOption =
4494
+ | "none"
4495
+ | "auto"
4496
+ | "required"
4497
+ | ChatCompletionToolChoiceFunction
4498
+ | ChatCompletionToolChoiceCustom
4499
+ | ChatCompletionToolChoiceAllowedTools;
4500
+ export type DeveloperMessage = {
4501
+ role: "developer";
4502
+ content:
4503
+ | string
4504
+ | Array<{
4505
+ type: "text";
4506
+ text: string;
4507
+ }>;
4508
+ name?: string;
4509
+ };
4510
+ export type SystemMessage = {
4511
+ role: "system";
4512
+ content:
4513
+ | string
4514
+ | Array<{
4515
+ type: "text";
4516
+ text: string;
4517
+ }>;
4518
+ name?: string;
4519
+ };
4520
+ /**
4521
+ * Permissive merged content part used inside UserMessage arrays.
4522
+ *
4523
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4524
+ * inside nested array items does not correctly match different branches for
4525
+ * different array elements, so the schema uses a single merged object.
4526
+ */
4527
+ export type UserMessageContentPart = {
4528
+ type: "text" | "image_url" | "input_audio" | "file";
4529
+ text?: string;
4530
+ image_url?: {
4531
+ url?: string;
4532
+ detail?: "auto" | "low" | "high";
4533
+ };
4534
+ input_audio?: {
4535
+ data?: string;
4536
+ format?: "wav" | "mp3";
4537
+ };
4538
+ file?: {
4539
+ file_data?: string;
4540
+ file_id?: string;
4541
+ filename?: string;
4542
+ };
4543
+ };
4544
+ export type UserMessage = {
4545
+ role: "user";
4546
+ content: string | Array<UserMessageContentPart>;
4547
+ name?: string;
4548
+ };
4549
+ export type AssistantMessageContentPart = {
4550
+ type: "text" | "refusal";
4551
+ text?: string;
4552
+ refusal?: string;
4553
+ };
4554
+ export type AssistantMessage = {
4555
+ role: "assistant";
4556
+ content?: string | null | Array<AssistantMessageContentPart>;
4557
+ refusal?: string | null;
4558
+ name?: string;
4559
+ audio?: {
4560
+ id: string;
4561
+ };
4562
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4563
+ function_call?: {
4564
+ name: string;
4565
+ arguments: string;
4566
+ };
4567
+ };
4568
+ export type ToolMessage = {
4569
+ role: "tool";
4570
+ content:
4571
+ | string
4572
+ | Array<{
4573
+ type: "text";
4574
+ text: string;
4575
+ }>;
4576
+ tool_call_id: string;
4577
+ };
4578
+ export type FunctionMessage = {
4579
+ role: "function";
4580
+ content: string;
4581
+ name: string;
4582
+ };
4583
+ export type ChatCompletionMessageParam =
4584
+ | DeveloperMessage
4585
+ | SystemMessage
4586
+ | UserMessage
4587
+ | AssistantMessage
4588
+ | ToolMessage
4589
+ | FunctionMessage;
4590
+ export type ChatCompletionsResponseFormatText = {
4591
+ type: "text";
4592
+ };
4593
+ export type ChatCompletionsResponseFormatJSONObject = {
4594
+ type: "json_object";
4595
+ };
4596
+ export type ResponseFormatJSONSchema = {
4597
+ type: "json_schema";
4598
+ json_schema: {
4599
+ name: string;
4600
+ description?: string;
4601
+ schema?: Record<string, unknown>;
4602
+ strict?: boolean | null;
4603
+ };
4604
+ };
4605
+ export type ResponseFormat =
4606
+ | ChatCompletionsResponseFormatText
4607
+ | ChatCompletionsResponseFormatJSONObject
4608
+ | ResponseFormatJSONSchema;
4609
+ export type ChatCompletionsStreamOptions = {
4610
+ include_usage?: boolean;
4611
+ include_obfuscation?: boolean;
4612
+ };
4613
+ export type PredictionContent = {
4614
+ type: "content";
4615
+ content:
4616
+ | string
4617
+ | Array<{
4618
+ type: "text";
4619
+ text: string;
4620
+ }>;
4621
+ };
4622
+ export type AudioParams = {
4623
+ voice:
4624
+ | string
4625
+ | {
4626
+ id: string;
4627
+ };
4628
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4629
+ };
4630
+ export type WebSearchUserLocation = {
4631
+ type: "approximate";
4632
+ approximate: {
4633
+ city?: string;
4634
+ country?: string;
4635
+ region?: string;
4636
+ timezone?: string;
4637
+ };
4638
+ };
4639
+ export type WebSearchOptions = {
4640
+ search_context_size?: "low" | "medium" | "high";
4641
+ user_location?: WebSearchUserLocation;
4642
+ };
4643
+ export type ChatTemplateKwargs = {
4644
+ /** Whether to enable reasoning, enabled by default. */
4645
+ enable_thinking?: boolean;
4646
+ /** If false, preserves reasoning context between turns. */
4647
+ clear_thinking?: boolean;
4648
+ };
4649
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4650
+ export type ChatCompletionsCommonOptions = {
4651
+ model?: string;
4652
+ audio?: AudioParams;
4653
+ frequency_penalty?: number | null;
4654
+ logit_bias?: Record<string, unknown> | null;
4655
+ logprobs?: boolean | null;
4656
+ top_logprobs?: number | null;
4657
+ max_tokens?: number | null;
4658
+ max_completion_tokens?: number | null;
4659
+ metadata?: Record<string, unknown> | null;
4660
+ modalities?: Array<"text" | "audio"> | null;
4661
+ n?: number | null;
4662
+ parallel_tool_calls?: boolean;
4663
+ prediction?: PredictionContent;
4664
+ presence_penalty?: number | null;
4665
+ reasoning_effort?: "low" | "medium" | "high" | null;
4666
+ chat_template_kwargs?: ChatTemplateKwargs;
4667
+ response_format?: ResponseFormat;
4668
+ seed?: number | null;
4669
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4670
+ stop?: string | Array<string> | null;
4671
+ store?: boolean | null;
4672
+ stream?: boolean | null;
4673
+ stream_options?: ChatCompletionsStreamOptions;
4674
+ temperature?: number | null;
4675
+ tool_choice?: ChatCompletionToolChoiceOption;
4676
+ tools?: Array<ChatCompletionTool>;
4677
+ top_p?: number | null;
4678
+ user?: string;
4679
+ web_search_options?: WebSearchOptions;
4680
+ function_call?:
4681
+ | "none"
4682
+ | "auto"
4683
+ | {
4684
+ name: string;
4685
+ };
4686
+ functions?: Array<FunctionDefinition>;
4687
+ };
4688
+ export type PromptTokensDetails = {
4689
+ cached_tokens?: number;
4690
+ audio_tokens?: number;
4691
+ };
4692
+ export type CompletionTokensDetails = {
4693
+ reasoning_tokens?: number;
4694
+ audio_tokens?: number;
4695
+ accepted_prediction_tokens?: number;
4696
+ rejected_prediction_tokens?: number;
4697
+ };
4698
+ export type CompletionUsage = {
4699
+ prompt_tokens: number;
4700
+ completion_tokens: number;
4701
+ total_tokens: number;
4702
+ prompt_tokens_details?: PromptTokensDetails;
4703
+ completion_tokens_details?: CompletionTokensDetails;
4704
+ };
4705
+ export type ChatCompletionTopLogprob = {
4706
+ token: string;
4707
+ logprob: number;
4708
+ bytes: Array<number> | null;
4709
+ };
4710
+ export type ChatCompletionTokenLogprob = {
4711
+ token: string;
4712
+ logprob: number;
4713
+ bytes: Array<number> | null;
4714
+ top_logprobs: Array<ChatCompletionTopLogprob>;
4715
+ };
4716
+ export type ChatCompletionAudio = {
4717
+ id: string;
4718
+ /** Base64 encoded audio bytes. */
4719
+ data: string;
4720
+ expires_at: number;
4721
+ transcript: string;
4722
+ };
4723
+ export type ChatCompletionUrlCitation = {
4724
+ type: "url_citation";
4725
+ url_citation: {
4726
+ url: string;
4727
+ title: string;
4728
+ start_index: number;
4729
+ end_index: number;
4730
+ };
4731
+ };
4732
+ export type ChatCompletionResponseMessage = {
4733
+ role: "assistant";
4734
+ content: string | null;
4735
+ refusal: string | null;
4736
+ annotations?: Array<ChatCompletionUrlCitation>;
4737
+ audio?: ChatCompletionAudio;
4738
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4739
+ function_call?: {
4740
+ name: string;
4741
+ arguments: string;
4742
+ } | null;
4743
+ };
4744
+ export type ChatCompletionLogprobs = {
4745
+ content: Array<ChatCompletionTokenLogprob> | null;
4746
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
4747
+ };
4748
+ export type ChatCompletionChoice = {
4749
+ index: number;
4750
+ message: ChatCompletionResponseMessage;
4751
+ finish_reason:
4752
+ | "stop"
4753
+ | "length"
4754
+ | "tool_calls"
4755
+ | "content_filter"
4756
+ | "function_call";
4757
+ logprobs: ChatCompletionLogprobs | null;
4758
+ };
4759
+ export type ChatCompletionsPromptInput = {
4760
+ prompt: string;
4761
+ } & ChatCompletionsCommonOptions;
4762
+ export type ChatCompletionsMessagesInput = {
4763
+ messages: Array<ChatCompletionMessageParam>;
4764
+ } & ChatCompletionsCommonOptions;
4765
+ export type ChatCompletionsOutput = {
4766
+ id: string;
4767
+ object: string;
4768
+ created: number;
4769
+ model: string;
4770
+ choices: Array<ChatCompletionChoice>;
4771
+ usage?: CompletionUsage;
4772
+ system_fingerprint?: string | null;
4773
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4774
+ };
4367
4775
  /**
4368
4776
  * Workers AI support for OpenAI's Responses API
4369
4777
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4786,6 +5194,12 @@ export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4786
5194
  export type StreamOptions = {
4787
5195
  include_obfuscation?: boolean;
4788
5196
  };
5197
+ /** Marks keys from T that aren't in U as optional never */
5198
+ export type Without<T, U> = {
5199
+ [P in Exclude<keyof T, keyof U>]?: never;
5200
+ };
5201
+ /** Either T or U, but not both (mutually exclusive) */
5202
+ export type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4789
5203
  export type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4790
5204
  | {
4791
5205
  text: string | string[];
@@ -5078,10 +5492,12 @@ export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
5078
5492
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
5079
5493
  }
5080
5494
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5081
- /**
5082
- * Base64 encoded value of the audio data.
5083
- */
5084
- audio: string;
5495
+ audio:
5496
+ | string
5497
+ | {
5498
+ body?: object;
5499
+ contentType?: string;
5500
+ };
5085
5501
  /**
5086
5502
  * Supported tasks are 'translate' or 'transcribe'.
5087
5503
  */
@@ -5099,9 +5515,33 @@ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5099
5515
  */
5100
5516
  initial_prompt?: string;
5101
5517
  /**
5102
- * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
5518
+ * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
5103
5519
  */
5104
5520
  prefix?: string;
5521
+ /**
5522
+ * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
5523
+ */
5524
+ beam_size?: number;
5525
+ /**
5526
+ * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
5527
+ */
5528
+ condition_on_previous_text?: boolean;
5529
+ /**
5530
+ * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
5531
+ */
5532
+ no_speech_threshold?: number;
5533
+ /**
5534
+ * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
5535
+ */
5536
+ compression_ratio_threshold?: number;
5537
+ /**
5538
+ * Threshold for filtering out segments with low average log probability, indicating low confidence.
5539
+ */
5540
+ log_prob_threshold?: number;
5541
+ /**
5542
+ * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
5543
+ */
5544
+ hallucination_silence_threshold?: number;
5105
5545
  }
5106
5546
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
5107
5547
  transcription_info?: {
@@ -5248,11 +5688,11 @@ export interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5248
5688
  truncate_inputs?: boolean;
5249
5689
  }
5250
5690
  export type Ai_Cf_Baai_Bge_M3_Output =
5251
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5691
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5252
5692
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5253
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5693
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5254
5694
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5255
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5695
+ export interface Ai_Cf_Baai_Bge_M3_Output_Query {
5256
5696
  response?: {
5257
5697
  /**
5258
5698
  * Index of the context in the request
@@ -5272,7 +5712,7 @@ export interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5272
5712
  */
5273
5713
  pooling?: "mean" | "cls";
5274
5714
  }
5275
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
5715
+ export interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5276
5716
  shape?: number[];
5277
5717
  /**
5278
5718
  * Embeddings of the requested text values
@@ -5377,7 +5817,7 @@ export interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5377
5817
  */
5378
5818
  role?: string;
5379
5819
  /**
5380
- * 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
5820
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5381
5821
  */
5382
5822
  tool_call_id?: string;
5383
5823
  content?:
@@ -5632,10 +6072,18 @@ export interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5632
6072
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5633
6073
  */
5634
6074
  role: string;
5635
- /**
5636
- * The content of the message as a string.
5637
- */
5638
- content: string;
6075
+ content:
6076
+ | string
6077
+ | {
6078
+ /**
6079
+ * Type of the content (text)
6080
+ */
6081
+ type?: string;
6082
+ /**
6083
+ * Text content
6084
+ */
6085
+ text?: string;
6086
+ }[];
5639
6087
  }[];
5640
6088
  functions?: {
5641
6089
  name: string;
@@ -6291,7 +6739,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6291
6739
  */
6292
6740
  role?: string;
6293
6741
  /**
6294
- * 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
6742
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
6295
6743
  */
6296
6744
  tool_call_id?: string;
6297
6745
  content?:
@@ -6418,7 +6866,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6418
6866
  }
6419
6867
  )[];
6420
6868
  /**
6421
- * JSON schema that should be fulfilled for the response.
6869
+ * JSON schema that should be fufilled for the response.
6422
6870
  */
6423
6871
  guided_json?: object;
6424
6872
  /**
@@ -6692,7 +7140,7 @@ export interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6692
7140
  }
6693
7141
  )[];
6694
7142
  /**
6695
- * JSON schema that should be fulfilled for the response.
7143
+ * JSON schema that should be fufilled for the response.
6696
7144
  */
6697
7145
  guided_json?: object;
6698
7146
  /**
@@ -6785,7 +7233,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6785
7233
  */
6786
7234
  prompt: string;
6787
7235
  /**
6788
- * JSON schema that should be fulfilled for the response.
7236
+ * JSON schema that should be fufilled for the response.
6789
7237
  */
6790
7238
  guided_json?: object;
6791
7239
  /**
@@ -6949,7 +7397,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6949
7397
  }
6950
7398
  )[];
6951
7399
  /**
6952
- * JSON schema that should be fulfilled for the response.
7400
+ * JSON schema that should be fufilled for the response.
6953
7401
  */
6954
7402
  guided_json?: object;
6955
7403
  /**
@@ -7230,7 +7678,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7230
7678
  )[];
7231
7679
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7232
7680
  /**
7233
- * JSON schema that should be fulfilled for the response.
7681
+ * JSON schema that should be fufilled for the response.
7234
7682
  */
7235
7683
  guided_json?: object;
7236
7684
  /**
@@ -7469,7 +7917,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7469
7917
  )[];
7470
7918
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7471
7919
  /**
7472
- * JSON schema that should be fulfilled for the response.
7920
+ * JSON schema that should be fufilled for the response.
7473
7921
  */
7474
7922
  guided_json?: object;
7475
7923
  /**
@@ -7634,10 +8082,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7634
8082
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7635
8083
  */
7636
8084
  role: string;
7637
- /**
7638
- * The content of the message as a string.
7639
- */
7640
- content: string;
8085
+ content:
8086
+ | string
8087
+ | {
8088
+ /**
8089
+ * Type of the content (text)
8090
+ */
8091
+ type?: string;
8092
+ /**
8093
+ * Text content
8094
+ */
8095
+ text?: string;
8096
+ }[];
7641
8097
  }[];
7642
8098
  functions?: {
7643
8099
  name: string;
@@ -7849,10 +8305,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7849
8305
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7850
8306
  */
7851
8307
  role: string;
7852
- /**
7853
- * The content of the message as a string.
7854
- */
7855
- content: string;
8308
+ content:
8309
+ | string
8310
+ | {
8311
+ /**
8312
+ * Type of the content (text)
8313
+ */
8314
+ type?: string;
8315
+ /**
8316
+ * Text content
8317
+ */
8318
+ text?: string;
8319
+ }[];
7856
8320
  }[];
7857
8321
  functions?: {
7858
8322
  name: string;
@@ -8420,12 +8884,12 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8420
8884
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8421
8885
  }
8422
8886
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8423
- inputs: ResponsesInput;
8424
- postProcessedOutputs: ResponsesOutput;
8887
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8888
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8425
8889
  }
8426
8890
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8427
- inputs: ResponsesInput;
8428
- postProcessedOutputs: ResponsesOutput;
8891
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8892
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8429
8893
  }
8430
8894
  export interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8431
8895
  /**
@@ -8557,7 +9021,7 @@ export interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8557
9021
  */
8558
9022
  text: string | string[];
8559
9023
  /**
8560
- * Target language to translate to
9024
+ * Target langauge to translate to
8561
9025
  */
8562
9026
  target_language:
8563
9027
  | "asm_Beng"
@@ -8673,10 +9137,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8673
9137
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8674
9138
  */
8675
9139
  role: string;
8676
- /**
8677
- * The content of the message as a string.
8678
- */
8679
- content: string;
9140
+ content:
9141
+ | string
9142
+ | {
9143
+ /**
9144
+ * Type of the content (text)
9145
+ */
9146
+ type?: string;
9147
+ /**
9148
+ * Text content
9149
+ */
9150
+ text?: string;
9151
+ }[];
8680
9152
  }[];
8681
9153
  functions?: {
8682
9154
  name: string;
@@ -8888,10 +9360,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8888
9360
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8889
9361
  */
8890
9362
  role: string;
8891
- /**
8892
- * The content of the message as a string.
8893
- */
8894
- content: string;
9363
+ content:
9364
+ | string
9365
+ | {
9366
+ /**
9367
+ * Type of the content (text)
9368
+ */
9369
+ type?: string;
9370
+ /**
9371
+ * Text content
9372
+ */
9373
+ text?: string;
9374
+ }[];
8895
9375
  }[];
8896
9376
  functions?: {
8897
9377
  name: string;
@@ -9446,6 +9926,66 @@ export declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9446
9926
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9447
9927
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9448
9928
  }
9929
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
9930
+ multipart: {
9931
+ body?: object;
9932
+ contentType?: string;
9933
+ };
9934
+ }
9935
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
9936
+ /**
9937
+ * Generated image as Base64 string.
9938
+ */
9939
+ image?: string;
9940
+ }
9941
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
9942
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
9943
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
9944
+ }
9945
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
9946
+ multipart: {
9947
+ body?: object;
9948
+ contentType?: string;
9949
+ };
9950
+ }
9951
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
9952
+ /**
9953
+ * Generated image as Base64 string.
9954
+ */
9955
+ image?: string;
9956
+ }
9957
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
9958
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
9959
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
9960
+ }
9961
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
9962
+ multipart: {
9963
+ body?: object;
9964
+ contentType?: string;
9965
+ };
9966
+ }
9967
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
9968
+ /**
9969
+ * Generated image as Base64 string.
9970
+ */
9971
+ image?: string;
9972
+ }
9973
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
9974
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
9975
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
9976
+ }
9977
+ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
9978
+ inputs: ChatCompletionsInput;
9979
+ postProcessedOutputs: ChatCompletionsOutput;
9980
+ }
9981
+ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
9982
+ inputs: ChatCompletionsInput;
9983
+ postProcessedOutputs: ChatCompletionsOutput;
9984
+ }
9985
+ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
9986
+ inputs: ChatCompletionsInput;
9987
+ postProcessedOutputs: ChatCompletionsOutput;
9988
+ }
9449
9989
  export interface AiModels {
9450
9990
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9451
9991
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9464,7 +10004,6 @@ export interface AiModels {
9464
10004
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9465
10005
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9466
10006
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9467
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9468
10007
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9469
10008
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9470
10009
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9531,6 +10070,12 @@ export interface AiModels {
9531
10070
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9532
10071
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9533
10072
  "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
10073
+ "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
10074
+ "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
10075
+ "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
10076
+ "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
10077
+ "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
10078
+ "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
9534
10079
  }
9535
10080
  export type AiOptions = {
9536
10081
  /**
@@ -9582,6 +10127,16 @@ export type AiModelsSearchObject = {
9582
10127
  value: string;
9583
10128
  }[];
9584
10129
  };
10130
+ export type ChatCompletionsBase = XOR<
10131
+ ChatCompletionsPromptInput,
10132
+ ChatCompletionsMessagesInput
10133
+ >;
10134
+ export type ChatCompletionsInput = XOR<
10135
+ ChatCompletionsBase,
10136
+ {
10137
+ requests: ChatCompletionsBase[];
10138
+ }
10139
+ >;
9585
10140
  export interface InferenceUpstreamError extends Error {}
9586
10141
  export interface AiInternalError extends Error {}
9587
10142
  export type AiModelListType = Record<string, any>;
@@ -10058,6 +10613,41 @@ export interface RequestInitCfProperties extends Record<string, unknown> {
10058
10613
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
10059
10614
  */
10060
10615
  cacheTtlByStatus?: Record<string, number>;
10616
+ /**
10617
+ * Explicit Cache-Control header value to set on the response stored in cache.
10618
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10619
+ *
10620
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10621
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10622
+ *
10623
+ * Can be used together with `cacheTtlByStatus`.
10624
+ */
10625
+ cacheControl?: string;
10626
+ /**
10627
+ * Whether the response should be eligible for Cache Reserve storage.
10628
+ */
10629
+ cacheReserveEligible?: boolean;
10630
+ /**
10631
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10632
+ */
10633
+ respectStrongEtag?: boolean;
10634
+ /**
10635
+ * Whether to strip ETag headers from the origin response before caching.
10636
+ */
10637
+ stripEtags?: boolean;
10638
+ /**
10639
+ * Whether to strip Last-Modified headers from the origin response before caching.
10640
+ */
10641
+ stripLastModified?: boolean;
10642
+ /**
10643
+ * Whether to enable Cache Deception Armor, which protects against web cache
10644
+ * deception attacks by verifying the Content-Type matches the URL extension.
10645
+ */
10646
+ cacheDeceptionArmor?: boolean;
10647
+ /**
10648
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10649
+ */
10650
+ cacheReserveMinimumFileSize?: number;
10061
10651
  scrapeShield?: boolean;
10062
10652
  apps?: boolean;
10063
10653
  image?: RequestInitCfPropertiesImage;
@@ -11926,6 +12516,7 @@ export declare namespace CloudflareWorkersModule {
11926
12516
  constructor(ctx: ExecutionContext, env: Env);
11927
12517
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11928
12518
  fetch?(request: Request): Response | Promise<Response>;
12519
+ connect?(socket: Socket): void | Promise<void>;
11929
12520
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11930
12521
  scheduled?(controller: ScheduledController): void | Promise<void>;
11931
12522
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11946,6 +12537,7 @@ export declare namespace CloudflareWorkersModule {
11946
12537
  constructor(ctx: DurableObjectState, env: Env);
11947
12538
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11948
12539
  fetch?(request: Request): Response | Promise<Response>;
12540
+ connect?(socket: Socket): void | Promise<void>;
11949
12541
  webSocketMessage?(
11950
12542
  ws: WebSocket,
11951
12543
  message: string | ArrayBuffer,
@@ -12086,17 +12678,6 @@ export interface StreamBinding {
12086
12678
  * @returns A handle for per-video operations.
12087
12679
  */
12088
12680
  video(id: string): StreamVideoHandle;
12089
- /**
12090
- * Uploads a new video from a File.
12091
- * @param file The video file to upload.
12092
- * @returns The uploaded video details.
12093
- * @throws {BadRequestError} if the upload parameter is invalid
12094
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
12095
- * @throws {MaxFileSizeError} if the file size is too large
12096
- * @throws {RateLimitedError} if the server received too many requests
12097
- * @throws {InternalError} if an unexpected error occurs
12098
- */
12099
- upload(file: File): Promise<StreamVideo>;
12100
12681
  /**
12101
12682
  * Uploads a new video from a provided URL.
12102
12683
  * @param url The URL to upload from.
@@ -12946,6 +13527,9 @@ export declare namespace TailStream {
12946
13527
  readonly type: "fetch";
12947
13528
  readonly statusCode: number;
12948
13529
  }
13530
+ interface ConnectEventInfo {
13531
+ readonly type: "connect";
13532
+ }
12949
13533
  type EventOutcome =
12950
13534
  | "ok"
12951
13535
  | "canceled"
@@ -12976,6 +13560,7 @@ export declare namespace TailStream {
12976
13560
  readonly scriptVersion?: ScriptVersion;
12977
13561
  readonly info:
12978
13562
  | FetchEventInfo
13563
+ | ConnectEventInfo
12979
13564
  | JsRpcEventInfo
12980
13565
  | ScheduledEventInfo
12981
13566
  | AlarmEventInfo