@cloudflare/workers-types 4.20260316.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.
@@ -483,6 +483,11 @@ export type ExportedHandlerFetchHandler<
483
483
  env: Env,
484
484
  ctx: ExecutionContext<Props>,
485
485
  ) => Response | Promise<Response>;
486
+ export type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
487
+ socket: Socket,
488
+ env: Env,
489
+ ctx: ExecutionContext<Props>,
490
+ ) => void | Promise<void>;
486
491
  export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
487
492
  events: TraceItem[],
488
493
  env: Env,
@@ -524,6 +529,7 @@ export interface ExportedHandler<
524
529
  Props = unknown,
525
530
  > {
526
531
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
532
+ connect?: ExportedHandlerConnectHandler<Env, Props>;
527
533
  tail?: ExportedHandlerTailHandler<Env, Props>;
528
534
  trace?: ExportedHandlerTraceHandler<Env, Props>;
529
535
  tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
@@ -543,12 +549,14 @@ export declare abstract class Navigator {
543
549
  export interface AlarmInvocationInfo {
544
550
  readonly isRetry: boolean;
545
551
  readonly retryCount: number;
552
+ readonly scheduledTime: number;
546
553
  }
547
554
  export interface Cloudflare {
548
555
  readonly compatibilityFlags: Record<string, boolean>;
549
556
  }
550
557
  export interface DurableObject {
551
558
  fetch(request: Request): Response | Promise<Response>;
559
+ connect?(socket: Socket): void | Promise<void>;
552
560
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
553
561
  webSocketMessage?(
554
562
  ws: WebSocket,
@@ -566,7 +574,7 @@ export type DurableObjectStub<
566
574
  T extends Rpc.DurableObjectBranded | undefined = undefined,
567
575
  > = Fetcher<
568
576
  T,
569
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
577
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
570
578
  > & {
571
579
  readonly id: DurableObjectId;
572
580
  readonly name?: string;
@@ -575,6 +583,7 @@ export interface DurableObjectId {
575
583
  toString(): string;
576
584
  equals(other: DurableObjectId): boolean;
577
585
  readonly name?: string;
586
+ readonly jurisdiction?: string;
578
587
  }
579
588
  export declare abstract class DurableObjectNamespace<
580
589
  T extends Rpc.DurableObjectBranded | undefined = undefined,
@@ -3103,6 +3112,7 @@ export interface TraceItem {
3103
3112
  | (
3104
3113
  | TraceItemFetchEventInfo
3105
3114
  | TraceItemJsRpcEventInfo
3115
+ | TraceItemConnectEventInfo
3106
3116
  | TraceItemScheduledEventInfo
3107
3117
  | TraceItemAlarmEventInfo
3108
3118
  | TraceItemQueueEventInfo
@@ -3121,6 +3131,7 @@ export interface TraceItem {
3121
3131
  readonly scriptVersion?: ScriptVersion;
3122
3132
  readonly dispatchNamespace?: string;
3123
3133
  readonly scriptTags?: string[];
3134
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3124
3135
  readonly durableObjectId?: string;
3125
3136
  readonly outcome: string;
3126
3137
  readonly executionModel: string;
@@ -3131,6 +3142,7 @@ export interface TraceItem {
3131
3142
  export interface TraceItemAlarmEventInfo {
3132
3143
  readonly scheduledTime: Date;
3133
3144
  }
3145
+ export interface TraceItemConnectEventInfo {}
3134
3146
  export interface TraceItemCustomEventInfo {}
3135
3147
  export interface TraceItemScheduledEventInfo {
3136
3148
  readonly scheduledTime: number;
@@ -3731,7 +3743,7 @@ export interface ContainerStartupOptions {
3731
3743
  entrypoint?: string[];
3732
3744
  enableInternet: boolean;
3733
3745
  env?: Record<string, string>;
3734
- hardTimeout?: number | bigint;
3746
+ labels?: Record<string, string>;
3735
3747
  }
3736
3748
  /**
3737
3749
  * 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.
@@ -4300,6 +4312,402 @@ export declare abstract class BaseAiTranslation {
4300
4312
  inputs: AiTranslationInput;
4301
4313
  postProcessedOutputs: AiTranslationOutput;
4302
4314
  }
4315
+ /**
4316
+ * Workers AI support for OpenAI's Chat Completions API
4317
+ */
4318
+ export type ChatCompletionContentPartText = {
4319
+ type: "text";
4320
+ text: string;
4321
+ };
4322
+ export type ChatCompletionContentPartImage = {
4323
+ type: "image_url";
4324
+ image_url: {
4325
+ url: string;
4326
+ detail?: "auto" | "low" | "high";
4327
+ };
4328
+ };
4329
+ export type ChatCompletionContentPartInputAudio = {
4330
+ type: "input_audio";
4331
+ input_audio: {
4332
+ /** Base64 encoded audio data. */
4333
+ data: string;
4334
+ format: "wav" | "mp3";
4335
+ };
4336
+ };
4337
+ export type ChatCompletionContentPartFile = {
4338
+ type: "file";
4339
+ file: {
4340
+ /** Base64 encoded file data. */
4341
+ file_data?: string;
4342
+ /** The ID of an uploaded file. */
4343
+ file_id?: string;
4344
+ filename?: string;
4345
+ };
4346
+ };
4347
+ export type ChatCompletionContentPartRefusal = {
4348
+ type: "refusal";
4349
+ refusal: string;
4350
+ };
4351
+ export type ChatCompletionContentPart =
4352
+ | ChatCompletionContentPartText
4353
+ | ChatCompletionContentPartImage
4354
+ | ChatCompletionContentPartInputAudio
4355
+ | ChatCompletionContentPartFile;
4356
+ export type FunctionDefinition = {
4357
+ name: string;
4358
+ description?: string;
4359
+ parameters?: Record<string, unknown>;
4360
+ strict?: boolean | null;
4361
+ };
4362
+ export type ChatCompletionFunctionTool = {
4363
+ type: "function";
4364
+ function: FunctionDefinition;
4365
+ };
4366
+ export type ChatCompletionCustomToolGrammarFormat = {
4367
+ type: "grammar";
4368
+ grammar: {
4369
+ definition: string;
4370
+ syntax: "lark" | "regex";
4371
+ };
4372
+ };
4373
+ export type ChatCompletionCustomToolTextFormat = {
4374
+ type: "text";
4375
+ };
4376
+ export type ChatCompletionCustomToolFormat =
4377
+ | ChatCompletionCustomToolTextFormat
4378
+ | ChatCompletionCustomToolGrammarFormat;
4379
+ export type ChatCompletionCustomTool = {
4380
+ type: "custom";
4381
+ custom: {
4382
+ name: string;
4383
+ description?: string;
4384
+ format?: ChatCompletionCustomToolFormat;
4385
+ };
4386
+ };
4387
+ export type ChatCompletionTool =
4388
+ | ChatCompletionFunctionTool
4389
+ | ChatCompletionCustomTool;
4390
+ export type ChatCompletionMessageFunctionToolCall = {
4391
+ id: string;
4392
+ type: "function";
4393
+ function: {
4394
+ name: string;
4395
+ /** JSON-encoded arguments string. */
4396
+ arguments: string;
4397
+ };
4398
+ };
4399
+ export type ChatCompletionMessageCustomToolCall = {
4400
+ id: string;
4401
+ type: "custom";
4402
+ custom: {
4403
+ name: string;
4404
+ input: string;
4405
+ };
4406
+ };
4407
+ export type ChatCompletionMessageToolCall =
4408
+ | ChatCompletionMessageFunctionToolCall
4409
+ | ChatCompletionMessageCustomToolCall;
4410
+ export type ChatCompletionToolChoiceFunction = {
4411
+ type: "function";
4412
+ function: {
4413
+ name: string;
4414
+ };
4415
+ };
4416
+ export type ChatCompletionToolChoiceCustom = {
4417
+ type: "custom";
4418
+ custom: {
4419
+ name: string;
4420
+ };
4421
+ };
4422
+ export type ChatCompletionToolChoiceAllowedTools = {
4423
+ type: "allowed_tools";
4424
+ allowed_tools: {
4425
+ mode: "auto" | "required";
4426
+ tools: Array<Record<string, unknown>>;
4427
+ };
4428
+ };
4429
+ export type ChatCompletionToolChoiceOption =
4430
+ | "none"
4431
+ | "auto"
4432
+ | "required"
4433
+ | ChatCompletionToolChoiceFunction
4434
+ | ChatCompletionToolChoiceCustom
4435
+ | ChatCompletionToolChoiceAllowedTools;
4436
+ export type DeveloperMessage = {
4437
+ role: "developer";
4438
+ content:
4439
+ | string
4440
+ | Array<{
4441
+ type: "text";
4442
+ text: string;
4443
+ }>;
4444
+ name?: string;
4445
+ };
4446
+ export type SystemMessage = {
4447
+ role: "system";
4448
+ content:
4449
+ | string
4450
+ | Array<{
4451
+ type: "text";
4452
+ text: string;
4453
+ }>;
4454
+ name?: string;
4455
+ };
4456
+ /**
4457
+ * Permissive merged content part used inside UserMessage arrays.
4458
+ *
4459
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4460
+ * inside nested array items does not correctly match different branches for
4461
+ * different array elements, so the schema uses a single merged object.
4462
+ */
4463
+ export type UserMessageContentPart = {
4464
+ type: "text" | "image_url" | "input_audio" | "file";
4465
+ text?: string;
4466
+ image_url?: {
4467
+ url?: string;
4468
+ detail?: "auto" | "low" | "high";
4469
+ };
4470
+ input_audio?: {
4471
+ data?: string;
4472
+ format?: "wav" | "mp3";
4473
+ };
4474
+ file?: {
4475
+ file_data?: string;
4476
+ file_id?: string;
4477
+ filename?: string;
4478
+ };
4479
+ };
4480
+ export type UserMessage = {
4481
+ role: "user";
4482
+ content: string | Array<UserMessageContentPart>;
4483
+ name?: string;
4484
+ };
4485
+ export type AssistantMessageContentPart = {
4486
+ type: "text" | "refusal";
4487
+ text?: string;
4488
+ refusal?: string;
4489
+ };
4490
+ export type AssistantMessage = {
4491
+ role: "assistant";
4492
+ content?: string | null | Array<AssistantMessageContentPart>;
4493
+ refusal?: string | null;
4494
+ name?: string;
4495
+ audio?: {
4496
+ id: string;
4497
+ };
4498
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4499
+ function_call?: {
4500
+ name: string;
4501
+ arguments: string;
4502
+ };
4503
+ };
4504
+ export type ToolMessage = {
4505
+ role: "tool";
4506
+ content:
4507
+ | string
4508
+ | Array<{
4509
+ type: "text";
4510
+ text: string;
4511
+ }>;
4512
+ tool_call_id: string;
4513
+ };
4514
+ export type FunctionMessage = {
4515
+ role: "function";
4516
+ content: string;
4517
+ name: string;
4518
+ };
4519
+ export type ChatCompletionMessageParam =
4520
+ | DeveloperMessage
4521
+ | SystemMessage
4522
+ | UserMessage
4523
+ | AssistantMessage
4524
+ | ToolMessage
4525
+ | FunctionMessage;
4526
+ export type ChatCompletionsResponseFormatText = {
4527
+ type: "text";
4528
+ };
4529
+ export type ChatCompletionsResponseFormatJSONObject = {
4530
+ type: "json_object";
4531
+ };
4532
+ export type ResponseFormatJSONSchema = {
4533
+ type: "json_schema";
4534
+ json_schema: {
4535
+ name: string;
4536
+ description?: string;
4537
+ schema?: Record<string, unknown>;
4538
+ strict?: boolean | null;
4539
+ };
4540
+ };
4541
+ export type ResponseFormat =
4542
+ | ChatCompletionsResponseFormatText
4543
+ | ChatCompletionsResponseFormatJSONObject
4544
+ | ResponseFormatJSONSchema;
4545
+ export type ChatCompletionsStreamOptions = {
4546
+ include_usage?: boolean;
4547
+ include_obfuscation?: boolean;
4548
+ };
4549
+ export type PredictionContent = {
4550
+ type: "content";
4551
+ content:
4552
+ | string
4553
+ | Array<{
4554
+ type: "text";
4555
+ text: string;
4556
+ }>;
4557
+ };
4558
+ export type AudioParams = {
4559
+ voice:
4560
+ | string
4561
+ | {
4562
+ id: string;
4563
+ };
4564
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4565
+ };
4566
+ export type WebSearchUserLocation = {
4567
+ type: "approximate";
4568
+ approximate: {
4569
+ city?: string;
4570
+ country?: string;
4571
+ region?: string;
4572
+ timezone?: string;
4573
+ };
4574
+ };
4575
+ export type WebSearchOptions = {
4576
+ search_context_size?: "low" | "medium" | "high";
4577
+ user_location?: WebSearchUserLocation;
4578
+ };
4579
+ export type ChatTemplateKwargs = {
4580
+ /** Whether to enable reasoning, enabled by default. */
4581
+ enable_thinking?: boolean;
4582
+ /** If false, preserves reasoning context between turns. */
4583
+ clear_thinking?: boolean;
4584
+ };
4585
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4586
+ export type ChatCompletionsCommonOptions = {
4587
+ model?: string;
4588
+ audio?: AudioParams;
4589
+ frequency_penalty?: number | null;
4590
+ logit_bias?: Record<string, unknown> | null;
4591
+ logprobs?: boolean | null;
4592
+ top_logprobs?: number | null;
4593
+ max_tokens?: number | null;
4594
+ max_completion_tokens?: number | null;
4595
+ metadata?: Record<string, unknown> | null;
4596
+ modalities?: Array<"text" | "audio"> | null;
4597
+ n?: number | null;
4598
+ parallel_tool_calls?: boolean;
4599
+ prediction?: PredictionContent;
4600
+ presence_penalty?: number | null;
4601
+ reasoning_effort?: "low" | "medium" | "high" | null;
4602
+ chat_template_kwargs?: ChatTemplateKwargs;
4603
+ response_format?: ResponseFormat;
4604
+ seed?: number | null;
4605
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4606
+ stop?: string | Array<string> | null;
4607
+ store?: boolean | null;
4608
+ stream?: boolean | null;
4609
+ stream_options?: ChatCompletionsStreamOptions;
4610
+ temperature?: number | null;
4611
+ tool_choice?: ChatCompletionToolChoiceOption;
4612
+ tools?: Array<ChatCompletionTool>;
4613
+ top_p?: number | null;
4614
+ user?: string;
4615
+ web_search_options?: WebSearchOptions;
4616
+ function_call?:
4617
+ | "none"
4618
+ | "auto"
4619
+ | {
4620
+ name: string;
4621
+ };
4622
+ functions?: Array<FunctionDefinition>;
4623
+ };
4624
+ export type PromptTokensDetails = {
4625
+ cached_tokens?: number;
4626
+ audio_tokens?: number;
4627
+ };
4628
+ export type CompletionTokensDetails = {
4629
+ reasoning_tokens?: number;
4630
+ audio_tokens?: number;
4631
+ accepted_prediction_tokens?: number;
4632
+ rejected_prediction_tokens?: number;
4633
+ };
4634
+ export type CompletionUsage = {
4635
+ prompt_tokens: number;
4636
+ completion_tokens: number;
4637
+ total_tokens: number;
4638
+ prompt_tokens_details?: PromptTokensDetails;
4639
+ completion_tokens_details?: CompletionTokensDetails;
4640
+ };
4641
+ export type ChatCompletionTopLogprob = {
4642
+ token: string;
4643
+ logprob: number;
4644
+ bytes: Array<number> | null;
4645
+ };
4646
+ export type ChatCompletionTokenLogprob = {
4647
+ token: string;
4648
+ logprob: number;
4649
+ bytes: Array<number> | null;
4650
+ top_logprobs: Array<ChatCompletionTopLogprob>;
4651
+ };
4652
+ export type ChatCompletionAudio = {
4653
+ id: string;
4654
+ /** Base64 encoded audio bytes. */
4655
+ data: string;
4656
+ expires_at: number;
4657
+ transcript: string;
4658
+ };
4659
+ export type ChatCompletionUrlCitation = {
4660
+ type: "url_citation";
4661
+ url_citation: {
4662
+ url: string;
4663
+ title: string;
4664
+ start_index: number;
4665
+ end_index: number;
4666
+ };
4667
+ };
4668
+ export type ChatCompletionResponseMessage = {
4669
+ role: "assistant";
4670
+ content: string | null;
4671
+ refusal: string | null;
4672
+ annotations?: Array<ChatCompletionUrlCitation>;
4673
+ audio?: ChatCompletionAudio;
4674
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4675
+ function_call?: {
4676
+ name: string;
4677
+ arguments: string;
4678
+ } | null;
4679
+ };
4680
+ export type ChatCompletionLogprobs = {
4681
+ content: Array<ChatCompletionTokenLogprob> | null;
4682
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
4683
+ };
4684
+ export type ChatCompletionChoice = {
4685
+ index: number;
4686
+ message: ChatCompletionResponseMessage;
4687
+ finish_reason:
4688
+ | "stop"
4689
+ | "length"
4690
+ | "tool_calls"
4691
+ | "content_filter"
4692
+ | "function_call";
4693
+ logprobs: ChatCompletionLogprobs | null;
4694
+ };
4695
+ export type ChatCompletionsPromptInput = {
4696
+ prompt: string;
4697
+ } & ChatCompletionsCommonOptions;
4698
+ export type ChatCompletionsMessagesInput = {
4699
+ messages: Array<ChatCompletionMessageParam>;
4700
+ } & ChatCompletionsCommonOptions;
4701
+ export type ChatCompletionsOutput = {
4702
+ id: string;
4703
+ object: string;
4704
+ created: number;
4705
+ model: string;
4706
+ choices: Array<ChatCompletionChoice>;
4707
+ usage?: CompletionUsage;
4708
+ system_fingerprint?: string | null;
4709
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4710
+ };
4303
4711
  /**
4304
4712
  * Workers AI support for OpenAI's Responses API
4305
4713
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4722,6 +5130,12 @@ export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4722
5130
  export type StreamOptions = {
4723
5131
  include_obfuscation?: boolean;
4724
5132
  };
5133
+ /** Marks keys from T that aren't in U as optional never */
5134
+ export type Without<T, U> = {
5135
+ [P in Exclude<keyof T, keyof U>]?: never;
5136
+ };
5137
+ /** Either T or U, but not both (mutually exclusive) */
5138
+ export type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4725
5139
  export type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4726
5140
  | {
4727
5141
  text: string | string[];
@@ -5014,10 +5428,12 @@ export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
5014
5428
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
5015
5429
  }
5016
5430
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5017
- /**
5018
- * Base64 encoded value of the audio data.
5019
- */
5020
- audio: string;
5431
+ audio:
5432
+ | string
5433
+ | {
5434
+ body?: object;
5435
+ contentType?: string;
5436
+ };
5021
5437
  /**
5022
5438
  * Supported tasks are 'translate' or 'transcribe'.
5023
5439
  */
@@ -5035,9 +5451,33 @@ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5035
5451
  */
5036
5452
  initial_prompt?: string;
5037
5453
  /**
5038
- * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
5454
+ * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
5039
5455
  */
5040
5456
  prefix?: string;
5457
+ /**
5458
+ * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
5459
+ */
5460
+ beam_size?: number;
5461
+ /**
5462
+ * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
5463
+ */
5464
+ condition_on_previous_text?: boolean;
5465
+ /**
5466
+ * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
5467
+ */
5468
+ no_speech_threshold?: number;
5469
+ /**
5470
+ * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
5471
+ */
5472
+ compression_ratio_threshold?: number;
5473
+ /**
5474
+ * Threshold for filtering out segments with low average log probability, indicating low confidence.
5475
+ */
5476
+ log_prob_threshold?: number;
5477
+ /**
5478
+ * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
5479
+ */
5480
+ hallucination_silence_threshold?: number;
5041
5481
  }
5042
5482
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
5043
5483
  transcription_info?: {
@@ -5184,11 +5624,11 @@ export interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5184
5624
  truncate_inputs?: boolean;
5185
5625
  }
5186
5626
  export type Ai_Cf_Baai_Bge_M3_Output =
5187
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5627
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5188
5628
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5189
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5629
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5190
5630
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5191
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5631
+ export interface Ai_Cf_Baai_Bge_M3_Output_Query {
5192
5632
  response?: {
5193
5633
  /**
5194
5634
  * Index of the context in the request
@@ -5208,7 +5648,7 @@ export interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5208
5648
  */
5209
5649
  pooling?: "mean" | "cls";
5210
5650
  }
5211
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
5651
+ export interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5212
5652
  shape?: number[];
5213
5653
  /**
5214
5654
  * Embeddings of the requested text values
@@ -5313,7 +5753,7 @@ export interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5313
5753
  */
5314
5754
  role?: string;
5315
5755
  /**
5316
- * 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
5756
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5317
5757
  */
5318
5758
  tool_call_id?: string;
5319
5759
  content?:
@@ -5568,10 +6008,18 @@ export interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5568
6008
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5569
6009
  */
5570
6010
  role: string;
5571
- /**
5572
- * The content of the message as a string.
5573
- */
5574
- content: string;
6011
+ content:
6012
+ | string
6013
+ | {
6014
+ /**
6015
+ * Type of the content (text)
6016
+ */
6017
+ type?: string;
6018
+ /**
6019
+ * Text content
6020
+ */
6021
+ text?: string;
6022
+ }[];
5575
6023
  }[];
5576
6024
  functions?: {
5577
6025
  name: string;
@@ -6227,7 +6675,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6227
6675
  */
6228
6676
  role?: string;
6229
6677
  /**
6230
- * 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
6678
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
6231
6679
  */
6232
6680
  tool_call_id?: string;
6233
6681
  content?:
@@ -6354,7 +6802,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6354
6802
  }
6355
6803
  )[];
6356
6804
  /**
6357
- * JSON schema that should be fulfilled for the response.
6805
+ * JSON schema that should be fufilled for the response.
6358
6806
  */
6359
6807
  guided_json?: object;
6360
6808
  /**
@@ -6628,7 +7076,7 @@ export interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6628
7076
  }
6629
7077
  )[];
6630
7078
  /**
6631
- * JSON schema that should be fulfilled for the response.
7079
+ * JSON schema that should be fufilled for the response.
6632
7080
  */
6633
7081
  guided_json?: object;
6634
7082
  /**
@@ -6721,7 +7169,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6721
7169
  */
6722
7170
  prompt: string;
6723
7171
  /**
6724
- * JSON schema that should be fulfilled for the response.
7172
+ * JSON schema that should be fufilled for the response.
6725
7173
  */
6726
7174
  guided_json?: object;
6727
7175
  /**
@@ -6885,7 +7333,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6885
7333
  }
6886
7334
  )[];
6887
7335
  /**
6888
- * JSON schema that should be fulfilled for the response.
7336
+ * JSON schema that should be fufilled for the response.
6889
7337
  */
6890
7338
  guided_json?: object;
6891
7339
  /**
@@ -7166,7 +7614,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7166
7614
  )[];
7167
7615
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7168
7616
  /**
7169
- * JSON schema that should be fulfilled for the response.
7617
+ * JSON schema that should be fufilled for the response.
7170
7618
  */
7171
7619
  guided_json?: object;
7172
7620
  /**
@@ -7405,7 +7853,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7405
7853
  )[];
7406
7854
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7407
7855
  /**
7408
- * JSON schema that should be fulfilled for the response.
7856
+ * JSON schema that should be fufilled for the response.
7409
7857
  */
7410
7858
  guided_json?: object;
7411
7859
  /**
@@ -7570,10 +8018,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7570
8018
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7571
8019
  */
7572
8020
  role: string;
7573
- /**
7574
- * The content of the message as a string.
7575
- */
7576
- content: string;
8021
+ content:
8022
+ | string
8023
+ | {
8024
+ /**
8025
+ * Type of the content (text)
8026
+ */
8027
+ type?: string;
8028
+ /**
8029
+ * Text content
8030
+ */
8031
+ text?: string;
8032
+ }[];
7577
8033
  }[];
7578
8034
  functions?: {
7579
8035
  name: string;
@@ -7785,10 +8241,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7785
8241
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7786
8242
  */
7787
8243
  role: string;
7788
- /**
7789
- * The content of the message as a string.
7790
- */
7791
- content: string;
8244
+ content:
8245
+ | string
8246
+ | {
8247
+ /**
8248
+ * Type of the content (text)
8249
+ */
8250
+ type?: string;
8251
+ /**
8252
+ * Text content
8253
+ */
8254
+ text?: string;
8255
+ }[];
7792
8256
  }[];
7793
8257
  functions?: {
7794
8258
  name: string;
@@ -8356,12 +8820,12 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8356
8820
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8357
8821
  }
8358
8822
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8359
- inputs: ResponsesInput;
8360
- postProcessedOutputs: ResponsesOutput;
8823
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8824
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8361
8825
  }
8362
8826
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8363
- inputs: ResponsesInput;
8364
- postProcessedOutputs: ResponsesOutput;
8827
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8828
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8365
8829
  }
8366
8830
  export interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8367
8831
  /**
@@ -8493,7 +8957,7 @@ export interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8493
8957
  */
8494
8958
  text: string | string[];
8495
8959
  /**
8496
- * Target language to translate to
8960
+ * Target langauge to translate to
8497
8961
  */
8498
8962
  target_language:
8499
8963
  | "asm_Beng"
@@ -8609,10 +9073,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8609
9073
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8610
9074
  */
8611
9075
  role: string;
8612
- /**
8613
- * The content of the message as a string.
8614
- */
8615
- content: string;
9076
+ content:
9077
+ | string
9078
+ | {
9079
+ /**
9080
+ * Type of the content (text)
9081
+ */
9082
+ type?: string;
9083
+ /**
9084
+ * Text content
9085
+ */
9086
+ text?: string;
9087
+ }[];
8616
9088
  }[];
8617
9089
  functions?: {
8618
9090
  name: string;
@@ -8824,10 +9296,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8824
9296
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8825
9297
  */
8826
9298
  role: string;
8827
- /**
8828
- * The content of the message as a string.
8829
- */
8830
- content: string;
9299
+ content:
9300
+ | string
9301
+ | {
9302
+ /**
9303
+ * Type of the content (text)
9304
+ */
9305
+ type?: string;
9306
+ /**
9307
+ * Text content
9308
+ */
9309
+ text?: string;
9310
+ }[];
8831
9311
  }[];
8832
9312
  functions?: {
8833
9313
  name: string;
@@ -9382,6 +9862,66 @@ export declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9382
9862
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9383
9863
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9384
9864
  }
9865
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
9866
+ multipart: {
9867
+ body?: object;
9868
+ contentType?: string;
9869
+ };
9870
+ }
9871
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
9872
+ /**
9873
+ * Generated image as Base64 string.
9874
+ */
9875
+ image?: string;
9876
+ }
9877
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
9878
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
9879
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
9880
+ }
9881
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
9882
+ multipart: {
9883
+ body?: object;
9884
+ contentType?: string;
9885
+ };
9886
+ }
9887
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
9888
+ /**
9889
+ * Generated image as Base64 string.
9890
+ */
9891
+ image?: string;
9892
+ }
9893
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
9894
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
9895
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
9896
+ }
9897
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
9898
+ multipart: {
9899
+ body?: object;
9900
+ contentType?: string;
9901
+ };
9902
+ }
9903
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
9904
+ /**
9905
+ * Generated image as Base64 string.
9906
+ */
9907
+ image?: string;
9908
+ }
9909
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
9910
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
9911
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
9912
+ }
9913
+ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
9914
+ inputs: ChatCompletionsInput;
9915
+ postProcessedOutputs: ChatCompletionsOutput;
9916
+ }
9917
+ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
9918
+ inputs: ChatCompletionsInput;
9919
+ postProcessedOutputs: ChatCompletionsOutput;
9920
+ }
9921
+ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
9922
+ inputs: ChatCompletionsInput;
9923
+ postProcessedOutputs: ChatCompletionsOutput;
9924
+ }
9385
9925
  export interface AiModels {
9386
9926
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9387
9927
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9400,7 +9940,6 @@ export interface AiModels {
9400
9940
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9401
9941
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9402
9942
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9403
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9404
9943
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9405
9944
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9406
9945
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9467,6 +10006,12 @@ export interface AiModels {
9467
10006
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9468
10007
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9469
10008
  "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
10009
+ "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
10010
+ "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
10011
+ "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
10012
+ "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
10013
+ "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
10014
+ "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
9470
10015
  }
9471
10016
  export type AiOptions = {
9472
10017
  /**
@@ -9518,6 +10063,16 @@ export type AiModelsSearchObject = {
9518
10063
  value: string;
9519
10064
  }[];
9520
10065
  };
10066
+ export type ChatCompletionsBase = XOR<
10067
+ ChatCompletionsPromptInput,
10068
+ ChatCompletionsMessagesInput
10069
+ >;
10070
+ export type ChatCompletionsInput = XOR<
10071
+ ChatCompletionsBase,
10072
+ {
10073
+ requests: ChatCompletionsBase[];
10074
+ }
10075
+ >;
9521
10076
  export interface InferenceUpstreamError extends Error {}
9522
10077
  export interface AiInternalError extends Error {}
9523
10078
  export type AiModelListType = Record<string, any>;
@@ -9994,6 +10549,41 @@ export interface RequestInitCfProperties extends Record<string, unknown> {
9994
10549
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
9995
10550
  */
9996
10551
  cacheTtlByStatus?: Record<string, number>;
10552
+ /**
10553
+ * Explicit Cache-Control header value to set on the response stored in cache.
10554
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10555
+ *
10556
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10557
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10558
+ *
10559
+ * Can be used together with `cacheTtlByStatus`.
10560
+ */
10561
+ cacheControl?: string;
10562
+ /**
10563
+ * Whether the response should be eligible for Cache Reserve storage.
10564
+ */
10565
+ cacheReserveEligible?: boolean;
10566
+ /**
10567
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10568
+ */
10569
+ respectStrongEtag?: boolean;
10570
+ /**
10571
+ * Whether to strip ETag headers from the origin response before caching.
10572
+ */
10573
+ stripEtags?: boolean;
10574
+ /**
10575
+ * Whether to strip Last-Modified headers from the origin response before caching.
10576
+ */
10577
+ stripLastModified?: boolean;
10578
+ /**
10579
+ * Whether to enable Cache Deception Armor, which protects against web cache
10580
+ * deception attacks by verifying the Content-Type matches the URL extension.
10581
+ */
10582
+ cacheDeceptionArmor?: boolean;
10583
+ /**
10584
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10585
+ */
10586
+ cacheReserveMinimumFileSize?: number;
9997
10587
  scrapeShield?: boolean;
9998
10588
  apps?: boolean;
9999
10589
  image?: RequestInitCfPropertiesImage;
@@ -11862,6 +12452,7 @@ export declare namespace CloudflareWorkersModule {
11862
12452
  constructor(ctx: ExecutionContext, env: Env);
11863
12453
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11864
12454
  fetch?(request: Request): Response | Promise<Response>;
12455
+ connect?(socket: Socket): void | Promise<void>;
11865
12456
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11866
12457
  scheduled?(controller: ScheduledController): void | Promise<void>;
11867
12458
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11882,6 +12473,7 @@ export declare namespace CloudflareWorkersModule {
11882
12473
  constructor(ctx: DurableObjectState, env: Env);
11883
12474
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11884
12475
  fetch?(request: Request): Response | Promise<Response>;
12476
+ connect?(socket: Socket): void | Promise<void>;
11885
12477
  webSocketMessage?(
11886
12478
  ws: WebSocket,
11887
12479
  message: string | ArrayBuffer,
@@ -12022,17 +12614,6 @@ export interface StreamBinding {
12022
12614
  * @returns A handle for per-video operations.
12023
12615
  */
12024
12616
  video(id: string): StreamVideoHandle;
12025
- /**
12026
- * Uploads a new video from a File.
12027
- * @param file The video file to upload.
12028
- * @returns The uploaded video details.
12029
- * @throws {BadRequestError} if the upload parameter is invalid
12030
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
12031
- * @throws {MaxFileSizeError} if the file size is too large
12032
- * @throws {RateLimitedError} if the server received too many requests
12033
- * @throws {InternalError} if an unexpected error occurs
12034
- */
12035
- upload(file: File): Promise<StreamVideo>;
12036
12617
  /**
12037
12618
  * Uploads a new video from a provided URL.
12038
12619
  * @param url The URL to upload from.
@@ -12882,6 +13463,9 @@ export declare namespace TailStream {
12882
13463
  readonly type: "fetch";
12883
13464
  readonly statusCode: number;
12884
13465
  }
13466
+ interface ConnectEventInfo {
13467
+ readonly type: "connect";
13468
+ }
12885
13469
  type EventOutcome =
12886
13470
  | "ok"
12887
13471
  | "canceled"
@@ -12912,6 +13496,7 @@ export declare namespace TailStream {
12912
13496
  readonly scriptVersion?: ScriptVersion;
12913
13497
  readonly info:
12914
13498
  | FetchEventInfo
13499
+ | ConnectEventInfo
12915
13500
  | JsRpcEventInfo
12916
13501
  | ScheduledEventInfo
12917
13502
  | AlarmEventInfo