@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.
@@ -481,6 +481,11 @@ type ExportedHandlerFetchHandler<
481
481
  env: Env,
482
482
  ctx: ExecutionContext<Props>,
483
483
  ) => Response | Promise<Response>;
484
+ type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
485
+ socket: Socket,
486
+ env: Env,
487
+ ctx: ExecutionContext<Props>,
488
+ ) => void | Promise<void>;
484
489
  type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
485
490
  events: TraceItem[],
486
491
  env: Env,
@@ -522,6 +527,7 @@ interface ExportedHandler<
522
527
  Props = unknown,
523
528
  > {
524
529
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
530
+ connect?: ExportedHandlerConnectHandler<Env, Props>;
525
531
  tail?: ExportedHandlerTailHandler<Env, Props>;
526
532
  trace?: ExportedHandlerTraceHandler<Env, Props>;
527
533
  tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
@@ -541,12 +547,14 @@ declare abstract class Navigator {
541
547
  interface AlarmInvocationInfo {
542
548
  readonly isRetry: boolean;
543
549
  readonly retryCount: number;
550
+ readonly scheduledTime: number;
544
551
  }
545
552
  interface Cloudflare {
546
553
  readonly compatibilityFlags: Record<string, boolean>;
547
554
  }
548
555
  interface DurableObject {
549
556
  fetch(request: Request): Response | Promise<Response>;
557
+ connect?(socket: Socket): void | Promise<void>;
550
558
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
551
559
  webSocketMessage?(
552
560
  ws: WebSocket,
@@ -564,7 +572,7 @@ type DurableObjectStub<
564
572
  T extends Rpc.DurableObjectBranded | undefined = undefined,
565
573
  > = Fetcher<
566
574
  T,
567
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
575
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
568
576
  > & {
569
577
  readonly id: DurableObjectId;
570
578
  readonly name?: string;
@@ -573,6 +581,7 @@ interface DurableObjectId {
573
581
  toString(): string;
574
582
  equals(other: DurableObjectId): boolean;
575
583
  readonly name?: string;
584
+ readonly jurisdiction?: string;
576
585
  }
577
586
  declare abstract class DurableObjectNamespace<
578
587
  T extends Rpc.DurableObjectBranded | undefined = undefined,
@@ -3097,6 +3106,7 @@ interface TraceItem {
3097
3106
  | (
3098
3107
  | TraceItemFetchEventInfo
3099
3108
  | TraceItemJsRpcEventInfo
3109
+ | TraceItemConnectEventInfo
3100
3110
  | TraceItemScheduledEventInfo
3101
3111
  | TraceItemAlarmEventInfo
3102
3112
  | TraceItemQueueEventInfo
@@ -3115,6 +3125,7 @@ interface TraceItem {
3115
3125
  readonly scriptVersion?: ScriptVersion;
3116
3126
  readonly dispatchNamespace?: string;
3117
3127
  readonly scriptTags?: string[];
3128
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3118
3129
  readonly durableObjectId?: string;
3119
3130
  readonly outcome: string;
3120
3131
  readonly executionModel: string;
@@ -3125,6 +3136,7 @@ interface TraceItem {
3125
3136
  interface TraceItemAlarmEventInfo {
3126
3137
  readonly scheduledTime: Date;
3127
3138
  }
3139
+ interface TraceItemConnectEventInfo {}
3128
3140
  interface TraceItemCustomEventInfo {}
3129
3141
  interface TraceItemScheduledEventInfo {
3130
3142
  readonly scheduledTime: number;
@@ -3725,7 +3737,7 @@ interface ContainerStartupOptions {
3725
3737
  entrypoint?: string[];
3726
3738
  enableInternet: boolean;
3727
3739
  env?: Record<string, string>;
3728
- hardTimeout?: number | bigint;
3740
+ labels?: Record<string, string>;
3729
3741
  }
3730
3742
  /**
3731
3743
  * 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.
@@ -4294,6 +4306,400 @@ declare abstract class BaseAiTranslation {
4294
4306
  inputs: AiTranslationInput;
4295
4307
  postProcessedOutputs: AiTranslationOutput;
4296
4308
  }
4309
+ /**
4310
+ * Workers AI support for OpenAI's Chat Completions API
4311
+ */
4312
+ type ChatCompletionContentPartText = {
4313
+ type: "text";
4314
+ text: string;
4315
+ };
4316
+ type ChatCompletionContentPartImage = {
4317
+ type: "image_url";
4318
+ image_url: {
4319
+ url: string;
4320
+ detail?: "auto" | "low" | "high";
4321
+ };
4322
+ };
4323
+ type ChatCompletionContentPartInputAudio = {
4324
+ type: "input_audio";
4325
+ input_audio: {
4326
+ /** Base64 encoded audio data. */
4327
+ data: string;
4328
+ format: "wav" | "mp3";
4329
+ };
4330
+ };
4331
+ type ChatCompletionContentPartFile = {
4332
+ type: "file";
4333
+ file: {
4334
+ /** Base64 encoded file data. */
4335
+ file_data?: string;
4336
+ /** The ID of an uploaded file. */
4337
+ file_id?: string;
4338
+ filename?: string;
4339
+ };
4340
+ };
4341
+ type ChatCompletionContentPartRefusal = {
4342
+ type: "refusal";
4343
+ refusal: string;
4344
+ };
4345
+ type ChatCompletionContentPart =
4346
+ | ChatCompletionContentPartText
4347
+ | ChatCompletionContentPartImage
4348
+ | ChatCompletionContentPartInputAudio
4349
+ | ChatCompletionContentPartFile;
4350
+ type FunctionDefinition = {
4351
+ name: string;
4352
+ description?: string;
4353
+ parameters?: Record<string, unknown>;
4354
+ strict?: boolean | null;
4355
+ };
4356
+ type ChatCompletionFunctionTool = {
4357
+ type: "function";
4358
+ function: FunctionDefinition;
4359
+ };
4360
+ type ChatCompletionCustomToolGrammarFormat = {
4361
+ type: "grammar";
4362
+ grammar: {
4363
+ definition: string;
4364
+ syntax: "lark" | "regex";
4365
+ };
4366
+ };
4367
+ type ChatCompletionCustomToolTextFormat = {
4368
+ type: "text";
4369
+ };
4370
+ type ChatCompletionCustomToolFormat =
4371
+ | ChatCompletionCustomToolTextFormat
4372
+ | ChatCompletionCustomToolGrammarFormat;
4373
+ type ChatCompletionCustomTool = {
4374
+ type: "custom";
4375
+ custom: {
4376
+ name: string;
4377
+ description?: string;
4378
+ format?: ChatCompletionCustomToolFormat;
4379
+ };
4380
+ };
4381
+ type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;
4382
+ type ChatCompletionMessageFunctionToolCall = {
4383
+ id: string;
4384
+ type: "function";
4385
+ function: {
4386
+ name: string;
4387
+ /** JSON-encoded arguments string. */
4388
+ arguments: string;
4389
+ };
4390
+ };
4391
+ type ChatCompletionMessageCustomToolCall = {
4392
+ id: string;
4393
+ type: "custom";
4394
+ custom: {
4395
+ name: string;
4396
+ input: string;
4397
+ };
4398
+ };
4399
+ type ChatCompletionMessageToolCall =
4400
+ | ChatCompletionMessageFunctionToolCall
4401
+ | ChatCompletionMessageCustomToolCall;
4402
+ type ChatCompletionToolChoiceFunction = {
4403
+ type: "function";
4404
+ function: {
4405
+ name: string;
4406
+ };
4407
+ };
4408
+ type ChatCompletionToolChoiceCustom = {
4409
+ type: "custom";
4410
+ custom: {
4411
+ name: string;
4412
+ };
4413
+ };
4414
+ type ChatCompletionToolChoiceAllowedTools = {
4415
+ type: "allowed_tools";
4416
+ allowed_tools: {
4417
+ mode: "auto" | "required";
4418
+ tools: Array<Record<string, unknown>>;
4419
+ };
4420
+ };
4421
+ type ChatCompletionToolChoiceOption =
4422
+ | "none"
4423
+ | "auto"
4424
+ | "required"
4425
+ | ChatCompletionToolChoiceFunction
4426
+ | ChatCompletionToolChoiceCustom
4427
+ | ChatCompletionToolChoiceAllowedTools;
4428
+ type DeveloperMessage = {
4429
+ role: "developer";
4430
+ content:
4431
+ | string
4432
+ | Array<{
4433
+ type: "text";
4434
+ text: string;
4435
+ }>;
4436
+ name?: string;
4437
+ };
4438
+ type SystemMessage = {
4439
+ role: "system";
4440
+ content:
4441
+ | string
4442
+ | Array<{
4443
+ type: "text";
4444
+ text: string;
4445
+ }>;
4446
+ name?: string;
4447
+ };
4448
+ /**
4449
+ * Permissive merged content part used inside UserMessage arrays.
4450
+ *
4451
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4452
+ * inside nested array items does not correctly match different branches for
4453
+ * different array elements, so the schema uses a single merged object.
4454
+ */
4455
+ type UserMessageContentPart = {
4456
+ type: "text" | "image_url" | "input_audio" | "file";
4457
+ text?: string;
4458
+ image_url?: {
4459
+ url?: string;
4460
+ detail?: "auto" | "low" | "high";
4461
+ };
4462
+ input_audio?: {
4463
+ data?: string;
4464
+ format?: "wav" | "mp3";
4465
+ };
4466
+ file?: {
4467
+ file_data?: string;
4468
+ file_id?: string;
4469
+ filename?: string;
4470
+ };
4471
+ };
4472
+ type UserMessage = {
4473
+ role: "user";
4474
+ content: string | Array<UserMessageContentPart>;
4475
+ name?: string;
4476
+ };
4477
+ type AssistantMessageContentPart = {
4478
+ type: "text" | "refusal";
4479
+ text?: string;
4480
+ refusal?: string;
4481
+ };
4482
+ type AssistantMessage = {
4483
+ role: "assistant";
4484
+ content?: string | null | Array<AssistantMessageContentPart>;
4485
+ refusal?: string | null;
4486
+ name?: string;
4487
+ audio?: {
4488
+ id: string;
4489
+ };
4490
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4491
+ function_call?: {
4492
+ name: string;
4493
+ arguments: string;
4494
+ };
4495
+ };
4496
+ type ToolMessage = {
4497
+ role: "tool";
4498
+ content:
4499
+ | string
4500
+ | Array<{
4501
+ type: "text";
4502
+ text: string;
4503
+ }>;
4504
+ tool_call_id: string;
4505
+ };
4506
+ type FunctionMessage = {
4507
+ role: "function";
4508
+ content: string;
4509
+ name: string;
4510
+ };
4511
+ type ChatCompletionMessageParam =
4512
+ | DeveloperMessage
4513
+ | SystemMessage
4514
+ | UserMessage
4515
+ | AssistantMessage
4516
+ | ToolMessage
4517
+ | FunctionMessage;
4518
+ type ChatCompletionsResponseFormatText = {
4519
+ type: "text";
4520
+ };
4521
+ type ChatCompletionsResponseFormatJSONObject = {
4522
+ type: "json_object";
4523
+ };
4524
+ type ResponseFormatJSONSchema = {
4525
+ type: "json_schema";
4526
+ json_schema: {
4527
+ name: string;
4528
+ description?: string;
4529
+ schema?: Record<string, unknown>;
4530
+ strict?: boolean | null;
4531
+ };
4532
+ };
4533
+ type ResponseFormat =
4534
+ | ChatCompletionsResponseFormatText
4535
+ | ChatCompletionsResponseFormatJSONObject
4536
+ | ResponseFormatJSONSchema;
4537
+ type ChatCompletionsStreamOptions = {
4538
+ include_usage?: boolean;
4539
+ include_obfuscation?: boolean;
4540
+ };
4541
+ type PredictionContent = {
4542
+ type: "content";
4543
+ content:
4544
+ | string
4545
+ | Array<{
4546
+ type: "text";
4547
+ text: string;
4548
+ }>;
4549
+ };
4550
+ type AudioParams = {
4551
+ voice:
4552
+ | string
4553
+ | {
4554
+ id: string;
4555
+ };
4556
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4557
+ };
4558
+ type WebSearchUserLocation = {
4559
+ type: "approximate";
4560
+ approximate: {
4561
+ city?: string;
4562
+ country?: string;
4563
+ region?: string;
4564
+ timezone?: string;
4565
+ };
4566
+ };
4567
+ type WebSearchOptions = {
4568
+ search_context_size?: "low" | "medium" | "high";
4569
+ user_location?: WebSearchUserLocation;
4570
+ };
4571
+ type ChatTemplateKwargs = {
4572
+ /** Whether to enable reasoning, enabled by default. */
4573
+ enable_thinking?: boolean;
4574
+ /** If false, preserves reasoning context between turns. */
4575
+ clear_thinking?: boolean;
4576
+ };
4577
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4578
+ type ChatCompletionsCommonOptions = {
4579
+ model?: string;
4580
+ audio?: AudioParams;
4581
+ frequency_penalty?: number | null;
4582
+ logit_bias?: Record<string, unknown> | null;
4583
+ logprobs?: boolean | null;
4584
+ top_logprobs?: number | null;
4585
+ max_tokens?: number | null;
4586
+ max_completion_tokens?: number | null;
4587
+ metadata?: Record<string, unknown> | null;
4588
+ modalities?: Array<"text" | "audio"> | null;
4589
+ n?: number | null;
4590
+ parallel_tool_calls?: boolean;
4591
+ prediction?: PredictionContent;
4592
+ presence_penalty?: number | null;
4593
+ reasoning_effort?: "low" | "medium" | "high" | null;
4594
+ chat_template_kwargs?: ChatTemplateKwargs;
4595
+ response_format?: ResponseFormat;
4596
+ seed?: number | null;
4597
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4598
+ stop?: string | Array<string> | null;
4599
+ store?: boolean | null;
4600
+ stream?: boolean | null;
4601
+ stream_options?: ChatCompletionsStreamOptions;
4602
+ temperature?: number | null;
4603
+ tool_choice?: ChatCompletionToolChoiceOption;
4604
+ tools?: Array<ChatCompletionTool>;
4605
+ top_p?: number | null;
4606
+ user?: string;
4607
+ web_search_options?: WebSearchOptions;
4608
+ function_call?:
4609
+ | "none"
4610
+ | "auto"
4611
+ | {
4612
+ name: string;
4613
+ };
4614
+ functions?: Array<FunctionDefinition>;
4615
+ };
4616
+ type PromptTokensDetails = {
4617
+ cached_tokens?: number;
4618
+ audio_tokens?: number;
4619
+ };
4620
+ type CompletionTokensDetails = {
4621
+ reasoning_tokens?: number;
4622
+ audio_tokens?: number;
4623
+ accepted_prediction_tokens?: number;
4624
+ rejected_prediction_tokens?: number;
4625
+ };
4626
+ type CompletionUsage = {
4627
+ prompt_tokens: number;
4628
+ completion_tokens: number;
4629
+ total_tokens: number;
4630
+ prompt_tokens_details?: PromptTokensDetails;
4631
+ completion_tokens_details?: CompletionTokensDetails;
4632
+ };
4633
+ type ChatCompletionTopLogprob = {
4634
+ token: string;
4635
+ logprob: number;
4636
+ bytes: Array<number> | null;
4637
+ };
4638
+ type ChatCompletionTokenLogprob = {
4639
+ token: string;
4640
+ logprob: number;
4641
+ bytes: Array<number> | null;
4642
+ top_logprobs: Array<ChatCompletionTopLogprob>;
4643
+ };
4644
+ type ChatCompletionAudio = {
4645
+ id: string;
4646
+ /** Base64 encoded audio bytes. */
4647
+ data: string;
4648
+ expires_at: number;
4649
+ transcript: string;
4650
+ };
4651
+ type ChatCompletionUrlCitation = {
4652
+ type: "url_citation";
4653
+ url_citation: {
4654
+ url: string;
4655
+ title: string;
4656
+ start_index: number;
4657
+ end_index: number;
4658
+ };
4659
+ };
4660
+ type ChatCompletionResponseMessage = {
4661
+ role: "assistant";
4662
+ content: string | null;
4663
+ refusal: string | null;
4664
+ annotations?: Array<ChatCompletionUrlCitation>;
4665
+ audio?: ChatCompletionAudio;
4666
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4667
+ function_call?: {
4668
+ name: string;
4669
+ arguments: string;
4670
+ } | null;
4671
+ };
4672
+ type ChatCompletionLogprobs = {
4673
+ content: Array<ChatCompletionTokenLogprob> | null;
4674
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
4675
+ };
4676
+ type ChatCompletionChoice = {
4677
+ index: number;
4678
+ message: ChatCompletionResponseMessage;
4679
+ finish_reason:
4680
+ | "stop"
4681
+ | "length"
4682
+ | "tool_calls"
4683
+ | "content_filter"
4684
+ | "function_call";
4685
+ logprobs: ChatCompletionLogprobs | null;
4686
+ };
4687
+ type ChatCompletionsPromptInput = {
4688
+ prompt: string;
4689
+ } & ChatCompletionsCommonOptions;
4690
+ type ChatCompletionsMessagesInput = {
4691
+ messages: Array<ChatCompletionMessageParam>;
4692
+ } & ChatCompletionsCommonOptions;
4693
+ type ChatCompletionsOutput = {
4694
+ id: string;
4695
+ object: string;
4696
+ created: number;
4697
+ model: string;
4698
+ choices: Array<ChatCompletionChoice>;
4699
+ usage?: CompletionUsage;
4700
+ system_fingerprint?: string | null;
4701
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4702
+ };
4297
4703
  /**
4298
4704
  * Workers AI support for OpenAI's Responses API
4299
4705
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4715,6 +5121,12 @@ type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4715
5121
  type StreamOptions = {
4716
5122
  include_obfuscation?: boolean;
4717
5123
  };
5124
+ /** Marks keys from T that aren't in U as optional never */
5125
+ type Without<T, U> = {
5126
+ [P in Exclude<keyof T, keyof U>]?: never;
5127
+ };
5128
+ /** Either T or U, but not both (mutually exclusive) */
5129
+ type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4718
5130
  type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4719
5131
  | {
4720
5132
  text: string | string[];
@@ -5007,10 +5419,12 @@ declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
5007
5419
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
5008
5420
  }
5009
5421
  interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5010
- /**
5011
- * Base64 encoded value of the audio data.
5012
- */
5013
- audio: string;
5422
+ audio:
5423
+ | string
5424
+ | {
5425
+ body?: object;
5426
+ contentType?: string;
5427
+ };
5014
5428
  /**
5015
5429
  * Supported tasks are 'translate' or 'transcribe'.
5016
5430
  */
@@ -5028,9 +5442,33 @@ interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5028
5442
  */
5029
5443
  initial_prompt?: string;
5030
5444
  /**
5031
- * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
5445
+ * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
5032
5446
  */
5033
5447
  prefix?: string;
5448
+ /**
5449
+ * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
5450
+ */
5451
+ beam_size?: number;
5452
+ /**
5453
+ * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
5454
+ */
5455
+ condition_on_previous_text?: boolean;
5456
+ /**
5457
+ * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
5458
+ */
5459
+ no_speech_threshold?: number;
5460
+ /**
5461
+ * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
5462
+ */
5463
+ compression_ratio_threshold?: number;
5464
+ /**
5465
+ * Threshold for filtering out segments with low average log probability, indicating low confidence.
5466
+ */
5467
+ log_prob_threshold?: number;
5468
+ /**
5469
+ * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
5470
+ */
5471
+ hallucination_silence_threshold?: number;
5034
5472
  }
5035
5473
  interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
5036
5474
  transcription_info?: {
@@ -5177,11 +5615,11 @@ interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5177
5615
  truncate_inputs?: boolean;
5178
5616
  }
5179
5617
  type Ai_Cf_Baai_Bge_M3_Output =
5180
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5618
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5181
5619
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5182
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5620
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5183
5621
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5184
- interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5622
+ interface Ai_Cf_Baai_Bge_M3_Output_Query {
5185
5623
  response?: {
5186
5624
  /**
5187
5625
  * Index of the context in the request
@@ -5201,7 +5639,7 @@ interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5201
5639
  */
5202
5640
  pooling?: "mean" | "cls";
5203
5641
  }
5204
- interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
5642
+ interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5205
5643
  shape?: number[];
5206
5644
  /**
5207
5645
  * Embeddings of the requested text values
@@ -5306,7 +5744,7 @@ interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5306
5744
  */
5307
5745
  role?: string;
5308
5746
  /**
5309
- * 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
5747
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5310
5748
  */
5311
5749
  tool_call_id?: string;
5312
5750
  content?:
@@ -5561,10 +5999,18 @@ interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5561
5999
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5562
6000
  */
5563
6001
  role: string;
5564
- /**
5565
- * The content of the message as a string.
5566
- */
5567
- content: string;
6002
+ content:
6003
+ | string
6004
+ | {
6005
+ /**
6006
+ * Type of the content (text)
6007
+ */
6008
+ type?: string;
6009
+ /**
6010
+ * Text content
6011
+ */
6012
+ text?: string;
6013
+ }[];
5568
6014
  }[];
5569
6015
  functions?: {
5570
6016
  name: string;
@@ -6220,7 +6666,7 @@ interface Ai_Cf_Qwen_Qwq_32B_Messages {
6220
6666
  */
6221
6667
  role?: string;
6222
6668
  /**
6223
- * 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
6669
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
6224
6670
  */
6225
6671
  tool_call_id?: string;
6226
6672
  content?:
@@ -6347,7 +6793,7 @@ interface Ai_Cf_Qwen_Qwq_32B_Messages {
6347
6793
  }
6348
6794
  )[];
6349
6795
  /**
6350
- * JSON schema that should be fulfilled for the response.
6796
+ * JSON schema that should be fufilled for the response.
6351
6797
  */
6352
6798
  guided_json?: object;
6353
6799
  /**
@@ -6621,7 +7067,7 @@ interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6621
7067
  }
6622
7068
  )[];
6623
7069
  /**
6624
- * JSON schema that should be fulfilled for the response.
7070
+ * JSON schema that should be fufilled for the response.
6625
7071
  */
6626
7072
  guided_json?: object;
6627
7073
  /**
@@ -6714,7 +7160,7 @@ interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6714
7160
  */
6715
7161
  prompt: string;
6716
7162
  /**
6717
- * JSON schema that should be fulfilled for the response.
7163
+ * JSON schema that should be fufilled for the response.
6718
7164
  */
6719
7165
  guided_json?: object;
6720
7166
  /**
@@ -6878,7 +7324,7 @@ interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6878
7324
  }
6879
7325
  )[];
6880
7326
  /**
6881
- * JSON schema that should be fulfilled for the response.
7327
+ * JSON schema that should be fufilled for the response.
6882
7328
  */
6883
7329
  guided_json?: object;
6884
7330
  /**
@@ -7159,7 +7605,7 @@ interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7159
7605
  )[];
7160
7606
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7161
7607
  /**
7162
- * JSON schema that should be fulfilled for the response.
7608
+ * JSON schema that should be fufilled for the response.
7163
7609
  */
7164
7610
  guided_json?: object;
7165
7611
  /**
@@ -7398,7 +7844,7 @@ interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7398
7844
  )[];
7399
7845
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7400
7846
  /**
7401
- * JSON schema that should be fulfilled for the response.
7847
+ * JSON schema that should be fufilled for the response.
7402
7848
  */
7403
7849
  guided_json?: object;
7404
7850
  /**
@@ -7563,10 +8009,18 @@ interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7563
8009
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7564
8010
  */
7565
8011
  role: string;
7566
- /**
7567
- * The content of the message as a string.
7568
- */
7569
- content: string;
8012
+ content:
8013
+ | string
8014
+ | {
8015
+ /**
8016
+ * Type of the content (text)
8017
+ */
8018
+ type?: string;
8019
+ /**
8020
+ * Text content
8021
+ */
8022
+ text?: string;
8023
+ }[];
7570
8024
  }[];
7571
8025
  functions?: {
7572
8026
  name: string;
@@ -7778,10 +8232,18 @@ interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7778
8232
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7779
8233
  */
7780
8234
  role: string;
7781
- /**
7782
- * The content of the message as a string.
7783
- */
7784
- content: string;
8235
+ content:
8236
+ | string
8237
+ | {
8238
+ /**
8239
+ * Type of the content (text)
8240
+ */
8241
+ type?: string;
8242
+ /**
8243
+ * Text content
8244
+ */
8245
+ text?: string;
8246
+ }[];
7785
8247
  }[];
7786
8248
  functions?: {
7787
8249
  name: string;
@@ -8349,12 +8811,12 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8349
8811
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8350
8812
  }
8351
8813
  declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8352
- inputs: ResponsesInput;
8353
- postProcessedOutputs: ResponsesOutput;
8814
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8815
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8354
8816
  }
8355
8817
  declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8356
- inputs: ResponsesInput;
8357
- postProcessedOutputs: ResponsesOutput;
8818
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8819
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8358
8820
  }
8359
8821
  interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8360
8822
  /**
@@ -8486,7 +8948,7 @@ interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8486
8948
  */
8487
8949
  text: string | string[];
8488
8950
  /**
8489
- * Target language to translate to
8951
+ * Target langauge to translate to
8490
8952
  */
8491
8953
  target_language:
8492
8954
  | "asm_Beng"
@@ -8602,10 +9064,18 @@ interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8602
9064
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8603
9065
  */
8604
9066
  role: string;
8605
- /**
8606
- * The content of the message as a string.
8607
- */
8608
- content: string;
9067
+ content:
9068
+ | string
9069
+ | {
9070
+ /**
9071
+ * Type of the content (text)
9072
+ */
9073
+ type?: string;
9074
+ /**
9075
+ * Text content
9076
+ */
9077
+ text?: string;
9078
+ }[];
8609
9079
  }[];
8610
9080
  functions?: {
8611
9081
  name: string;
@@ -8817,10 +9287,18 @@ interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8817
9287
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8818
9288
  */
8819
9289
  role: string;
8820
- /**
8821
- * The content of the message as a string.
8822
- */
8823
- content: string;
9290
+ content:
9291
+ | string
9292
+ | {
9293
+ /**
9294
+ * Type of the content (text)
9295
+ */
9296
+ type?: string;
9297
+ /**
9298
+ * Text content
9299
+ */
9300
+ text?: string;
9301
+ }[];
8824
9302
  }[];
8825
9303
  functions?: {
8826
9304
  name: string;
@@ -9375,6 +9853,66 @@ declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9375
9853
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9376
9854
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9377
9855
  }
9856
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
9857
+ multipart: {
9858
+ body?: object;
9859
+ contentType?: string;
9860
+ };
9861
+ }
9862
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
9863
+ /**
9864
+ * Generated image as Base64 string.
9865
+ */
9866
+ image?: string;
9867
+ }
9868
+ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
9869
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
9870
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
9871
+ }
9872
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
9873
+ multipart: {
9874
+ body?: object;
9875
+ contentType?: string;
9876
+ };
9877
+ }
9878
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
9879
+ /**
9880
+ * Generated image as Base64 string.
9881
+ */
9882
+ image?: string;
9883
+ }
9884
+ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
9885
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
9886
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
9887
+ }
9888
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
9889
+ multipart: {
9890
+ body?: object;
9891
+ contentType?: string;
9892
+ };
9893
+ }
9894
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
9895
+ /**
9896
+ * Generated image as Base64 string.
9897
+ */
9898
+ image?: string;
9899
+ }
9900
+ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
9901
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
9902
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
9903
+ }
9904
+ declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
9905
+ inputs: ChatCompletionsInput;
9906
+ postProcessedOutputs: ChatCompletionsOutput;
9907
+ }
9908
+ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
9909
+ inputs: ChatCompletionsInput;
9910
+ postProcessedOutputs: ChatCompletionsOutput;
9911
+ }
9912
+ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
9913
+ inputs: ChatCompletionsInput;
9914
+ postProcessedOutputs: ChatCompletionsOutput;
9915
+ }
9378
9916
  interface AiModels {
9379
9917
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9380
9918
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9393,7 +9931,6 @@ interface AiModels {
9393
9931
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9394
9932
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9395
9933
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9396
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9397
9934
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9398
9935
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9399
9936
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9460,6 +9997,12 @@ interface AiModels {
9460
9997
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9461
9998
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9462
9999
  "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
10000
+ "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
10001
+ "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
10002
+ "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
10003
+ "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
10004
+ "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
10005
+ "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
9463
10006
  }
9464
10007
  type AiOptions = {
9465
10008
  /**
@@ -9511,6 +10054,16 @@ type AiModelsSearchObject = {
9511
10054
  value: string;
9512
10055
  }[];
9513
10056
  };
10057
+ type ChatCompletionsBase = XOR<
10058
+ ChatCompletionsPromptInput,
10059
+ ChatCompletionsMessagesInput
10060
+ >;
10061
+ type ChatCompletionsInput = XOR<
10062
+ ChatCompletionsBase,
10063
+ {
10064
+ requests: ChatCompletionsBase[];
10065
+ }
10066
+ >;
9514
10067
  interface InferenceUpstreamError extends Error {}
9515
10068
  interface AiInternalError extends Error {}
9516
10069
  type AiModelListType = Record<string, any>;
@@ -9985,6 +10538,41 @@ interface RequestInitCfProperties extends Record<string, unknown> {
9985
10538
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
9986
10539
  */
9987
10540
  cacheTtlByStatus?: Record<string, number>;
10541
+ /**
10542
+ * Explicit Cache-Control header value to set on the response stored in cache.
10543
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10544
+ *
10545
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10546
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10547
+ *
10548
+ * Can be used together with `cacheTtlByStatus`.
10549
+ */
10550
+ cacheControl?: string;
10551
+ /**
10552
+ * Whether the response should be eligible for Cache Reserve storage.
10553
+ */
10554
+ cacheReserveEligible?: boolean;
10555
+ /**
10556
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10557
+ */
10558
+ respectStrongEtag?: boolean;
10559
+ /**
10560
+ * Whether to strip ETag headers from the origin response before caching.
10561
+ */
10562
+ stripEtags?: boolean;
10563
+ /**
10564
+ * Whether to strip Last-Modified headers from the origin response before caching.
10565
+ */
10566
+ stripLastModified?: boolean;
10567
+ /**
10568
+ * Whether to enable Cache Deception Armor, which protects against web cache
10569
+ * deception attacks by verifying the Content-Type matches the URL extension.
10570
+ */
10571
+ cacheDeceptionArmor?: boolean;
10572
+ /**
10573
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10574
+ */
10575
+ cacheReserveMinimumFileSize?: number;
9988
10576
  scrapeShield?: boolean;
9989
10577
  apps?: boolean;
9990
10578
  image?: RequestInitCfPropertiesImage;
@@ -11897,6 +12485,7 @@ declare namespace CloudflareWorkersModule {
11897
12485
  constructor(ctx: ExecutionContext, env: Env);
11898
12486
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11899
12487
  fetch?(request: Request): Response | Promise<Response>;
12488
+ connect?(socket: Socket): void | Promise<void>;
11900
12489
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11901
12490
  scheduled?(controller: ScheduledController): void | Promise<void>;
11902
12491
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11917,6 +12506,7 @@ declare namespace CloudflareWorkersModule {
11917
12506
  constructor(ctx: DurableObjectState, env: Env);
11918
12507
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11919
12508
  fetch?(request: Request): Response | Promise<Response>;
12509
+ connect?(socket: Socket): void | Promise<void>;
11920
12510
  webSocketMessage?(
11921
12511
  ws: WebSocket,
11922
12512
  message: string | ArrayBuffer,
@@ -12067,17 +12657,6 @@ interface StreamBinding {
12067
12657
  * @returns A handle for per-video operations.
12068
12658
  */
12069
12659
  video(id: string): StreamVideoHandle;
12070
- /**
12071
- * Uploads a new video from a File.
12072
- * @param file The video file to upload.
12073
- * @returns The uploaded video details.
12074
- * @throws {BadRequestError} if the upload parameter is invalid
12075
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
12076
- * @throws {MaxFileSizeError} if the file size is too large
12077
- * @throws {RateLimitedError} if the server received too many requests
12078
- * @throws {InternalError} if an unexpected error occurs
12079
- */
12080
- upload(file: File): Promise<StreamVideo>;
12081
12660
  /**
12082
12661
  * Uploads a new video from a provided URL.
12083
12662
  * @param url The URL to upload from.
@@ -12927,6 +13506,9 @@ declare namespace TailStream {
12927
13506
  readonly type: "fetch";
12928
13507
  readonly statusCode: number;
12929
13508
  }
13509
+ interface ConnectEventInfo {
13510
+ readonly type: "connect";
13511
+ }
12930
13512
  type EventOutcome =
12931
13513
  | "ok"
12932
13514
  | "canceled"
@@ -12957,6 +13539,7 @@ declare namespace TailStream {
12957
13539
  readonly scriptVersion?: ScriptVersion;
12958
13540
  readonly info:
12959
13541
  | FetchEventInfo
13542
+ | ConnectEventInfo
12960
13543
  | JsRpcEventInfo
12961
13544
  | ScheduledEventInfo
12962
13545
  | AlarmEventInfo