@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.
@@ -478,6 +478,11 @@ type ExportedHandlerFetchHandler<
478
478
  env: Env,
479
479
  ctx: ExecutionContext<Props>,
480
480
  ) => Response | Promise<Response>;
481
+ type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
482
+ socket: Socket,
483
+ env: Env,
484
+ ctx: ExecutionContext<Props>,
485
+ ) => void | Promise<void>;
481
486
  type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
482
487
  events: TraceItem[],
483
488
  env: Env,
@@ -519,6 +524,7 @@ interface ExportedHandler<
519
524
  Props = unknown,
520
525
  > {
521
526
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
527
+ connect?: ExportedHandlerConnectHandler<Env, Props>;
522
528
  tail?: ExportedHandlerTailHandler<Env, Props>;
523
529
  trace?: ExportedHandlerTraceHandler<Env, Props>;
524
530
  tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
@@ -533,12 +539,14 @@ interface StructuredSerializeOptions {
533
539
  interface AlarmInvocationInfo {
534
540
  readonly isRetry: boolean;
535
541
  readonly retryCount: number;
542
+ readonly scheduledTime: number;
536
543
  }
537
544
  interface Cloudflare {
538
545
  readonly compatibilityFlags: Record<string, boolean>;
539
546
  }
540
547
  interface DurableObject {
541
548
  fetch(request: Request): Response | Promise<Response>;
549
+ connect?(socket: Socket): void | Promise<void>;
542
550
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
543
551
  webSocketMessage?(
544
552
  ws: WebSocket,
@@ -556,7 +564,7 @@ type DurableObjectStub<
556
564
  T extends Rpc.DurableObjectBranded | undefined = undefined,
557
565
  > = Fetcher<
558
566
  T,
559
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
567
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
560
568
  > & {
561
569
  readonly id: DurableObjectId;
562
570
  readonly name?: string;
@@ -565,6 +573,7 @@ interface DurableObjectId {
565
573
  toString(): string;
566
574
  equals(other: DurableObjectId): boolean;
567
575
  readonly name?: string;
576
+ readonly jurisdiction?: string;
568
577
  }
569
578
  declare abstract class DurableObjectNamespace<
570
579
  T extends Rpc.DurableObjectBranded | undefined = undefined,
@@ -3081,6 +3090,7 @@ interface TraceItem {
3081
3090
  | (
3082
3091
  | TraceItemFetchEventInfo
3083
3092
  | TraceItemJsRpcEventInfo
3093
+ | TraceItemConnectEventInfo
3084
3094
  | TraceItemScheduledEventInfo
3085
3095
  | TraceItemAlarmEventInfo
3086
3096
  | TraceItemQueueEventInfo
@@ -3099,6 +3109,7 @@ interface TraceItem {
3099
3109
  readonly scriptVersion?: ScriptVersion;
3100
3110
  readonly dispatchNamespace?: string;
3101
3111
  readonly scriptTags?: string[];
3112
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3102
3113
  readonly durableObjectId?: string;
3103
3114
  readonly outcome: string;
3104
3115
  readonly executionModel: string;
@@ -3109,6 +3120,7 @@ interface TraceItem {
3109
3120
  interface TraceItemAlarmEventInfo {
3110
3121
  readonly scheduledTime: Date;
3111
3122
  }
3123
+ interface TraceItemConnectEventInfo {}
3112
3124
  interface TraceItemCustomEventInfo {}
3113
3125
  interface TraceItemScheduledEventInfo {
3114
3126
  readonly scheduledTime: number;
@@ -3649,7 +3661,7 @@ interface ContainerStartupOptions {
3649
3661
  entrypoint?: string[];
3650
3662
  enableInternet: boolean;
3651
3663
  env?: Record<string, string>;
3652
- hardTimeout?: number | bigint;
3664
+ labels?: Record<string, string>;
3653
3665
  }
3654
3666
  /**
3655
3667
  * 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.
@@ -4218,6 +4230,400 @@ declare abstract class BaseAiTranslation {
4218
4230
  inputs: AiTranslationInput;
4219
4231
  postProcessedOutputs: AiTranslationOutput;
4220
4232
  }
4233
+ /**
4234
+ * Workers AI support for OpenAI's Chat Completions API
4235
+ */
4236
+ type ChatCompletionContentPartText = {
4237
+ type: "text";
4238
+ text: string;
4239
+ };
4240
+ type ChatCompletionContentPartImage = {
4241
+ type: "image_url";
4242
+ image_url: {
4243
+ url: string;
4244
+ detail?: "auto" | "low" | "high";
4245
+ };
4246
+ };
4247
+ type ChatCompletionContentPartInputAudio = {
4248
+ type: "input_audio";
4249
+ input_audio: {
4250
+ /** Base64 encoded audio data. */
4251
+ data: string;
4252
+ format: "wav" | "mp3";
4253
+ };
4254
+ };
4255
+ type ChatCompletionContentPartFile = {
4256
+ type: "file";
4257
+ file: {
4258
+ /** Base64 encoded file data. */
4259
+ file_data?: string;
4260
+ /** The ID of an uploaded file. */
4261
+ file_id?: string;
4262
+ filename?: string;
4263
+ };
4264
+ };
4265
+ type ChatCompletionContentPartRefusal = {
4266
+ type: "refusal";
4267
+ refusal: string;
4268
+ };
4269
+ type ChatCompletionContentPart =
4270
+ | ChatCompletionContentPartText
4271
+ | ChatCompletionContentPartImage
4272
+ | ChatCompletionContentPartInputAudio
4273
+ | ChatCompletionContentPartFile;
4274
+ type FunctionDefinition = {
4275
+ name: string;
4276
+ description?: string;
4277
+ parameters?: Record<string, unknown>;
4278
+ strict?: boolean | null;
4279
+ };
4280
+ type ChatCompletionFunctionTool = {
4281
+ type: "function";
4282
+ function: FunctionDefinition;
4283
+ };
4284
+ type ChatCompletionCustomToolGrammarFormat = {
4285
+ type: "grammar";
4286
+ grammar: {
4287
+ definition: string;
4288
+ syntax: "lark" | "regex";
4289
+ };
4290
+ };
4291
+ type ChatCompletionCustomToolTextFormat = {
4292
+ type: "text";
4293
+ };
4294
+ type ChatCompletionCustomToolFormat =
4295
+ | ChatCompletionCustomToolTextFormat
4296
+ | ChatCompletionCustomToolGrammarFormat;
4297
+ type ChatCompletionCustomTool = {
4298
+ type: "custom";
4299
+ custom: {
4300
+ name: string;
4301
+ description?: string;
4302
+ format?: ChatCompletionCustomToolFormat;
4303
+ };
4304
+ };
4305
+ type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;
4306
+ type ChatCompletionMessageFunctionToolCall = {
4307
+ id: string;
4308
+ type: "function";
4309
+ function: {
4310
+ name: string;
4311
+ /** JSON-encoded arguments string. */
4312
+ arguments: string;
4313
+ };
4314
+ };
4315
+ type ChatCompletionMessageCustomToolCall = {
4316
+ id: string;
4317
+ type: "custom";
4318
+ custom: {
4319
+ name: string;
4320
+ input: string;
4321
+ };
4322
+ };
4323
+ type ChatCompletionMessageToolCall =
4324
+ | ChatCompletionMessageFunctionToolCall
4325
+ | ChatCompletionMessageCustomToolCall;
4326
+ type ChatCompletionToolChoiceFunction = {
4327
+ type: "function";
4328
+ function: {
4329
+ name: string;
4330
+ };
4331
+ };
4332
+ type ChatCompletionToolChoiceCustom = {
4333
+ type: "custom";
4334
+ custom: {
4335
+ name: string;
4336
+ };
4337
+ };
4338
+ type ChatCompletionToolChoiceAllowedTools = {
4339
+ type: "allowed_tools";
4340
+ allowed_tools: {
4341
+ mode: "auto" | "required";
4342
+ tools: Array<Record<string, unknown>>;
4343
+ };
4344
+ };
4345
+ type ChatCompletionToolChoiceOption =
4346
+ | "none"
4347
+ | "auto"
4348
+ | "required"
4349
+ | ChatCompletionToolChoiceFunction
4350
+ | ChatCompletionToolChoiceCustom
4351
+ | ChatCompletionToolChoiceAllowedTools;
4352
+ type DeveloperMessage = {
4353
+ role: "developer";
4354
+ content:
4355
+ | string
4356
+ | Array<{
4357
+ type: "text";
4358
+ text: string;
4359
+ }>;
4360
+ name?: string;
4361
+ };
4362
+ type SystemMessage = {
4363
+ role: "system";
4364
+ content:
4365
+ | string
4366
+ | Array<{
4367
+ type: "text";
4368
+ text: string;
4369
+ }>;
4370
+ name?: string;
4371
+ };
4372
+ /**
4373
+ * Permissive merged content part used inside UserMessage arrays.
4374
+ *
4375
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4376
+ * inside nested array items does not correctly match different branches for
4377
+ * different array elements, so the schema uses a single merged object.
4378
+ */
4379
+ type UserMessageContentPart = {
4380
+ type: "text" | "image_url" | "input_audio" | "file";
4381
+ text?: string;
4382
+ image_url?: {
4383
+ url?: string;
4384
+ detail?: "auto" | "low" | "high";
4385
+ };
4386
+ input_audio?: {
4387
+ data?: string;
4388
+ format?: "wav" | "mp3";
4389
+ };
4390
+ file?: {
4391
+ file_data?: string;
4392
+ file_id?: string;
4393
+ filename?: string;
4394
+ };
4395
+ };
4396
+ type UserMessage = {
4397
+ role: "user";
4398
+ content: string | Array<UserMessageContentPart>;
4399
+ name?: string;
4400
+ };
4401
+ type AssistantMessageContentPart = {
4402
+ type: "text" | "refusal";
4403
+ text?: string;
4404
+ refusal?: string;
4405
+ };
4406
+ type AssistantMessage = {
4407
+ role: "assistant";
4408
+ content?: string | null | Array<AssistantMessageContentPart>;
4409
+ refusal?: string | null;
4410
+ name?: string;
4411
+ audio?: {
4412
+ id: string;
4413
+ };
4414
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4415
+ function_call?: {
4416
+ name: string;
4417
+ arguments: string;
4418
+ };
4419
+ };
4420
+ type ToolMessage = {
4421
+ role: "tool";
4422
+ content:
4423
+ | string
4424
+ | Array<{
4425
+ type: "text";
4426
+ text: string;
4427
+ }>;
4428
+ tool_call_id: string;
4429
+ };
4430
+ type FunctionMessage = {
4431
+ role: "function";
4432
+ content: string;
4433
+ name: string;
4434
+ };
4435
+ type ChatCompletionMessageParam =
4436
+ | DeveloperMessage
4437
+ | SystemMessage
4438
+ | UserMessage
4439
+ | AssistantMessage
4440
+ | ToolMessage
4441
+ | FunctionMessage;
4442
+ type ChatCompletionsResponseFormatText = {
4443
+ type: "text";
4444
+ };
4445
+ type ChatCompletionsResponseFormatJSONObject = {
4446
+ type: "json_object";
4447
+ };
4448
+ type ResponseFormatJSONSchema = {
4449
+ type: "json_schema";
4450
+ json_schema: {
4451
+ name: string;
4452
+ description?: string;
4453
+ schema?: Record<string, unknown>;
4454
+ strict?: boolean | null;
4455
+ };
4456
+ };
4457
+ type ResponseFormat =
4458
+ | ChatCompletionsResponseFormatText
4459
+ | ChatCompletionsResponseFormatJSONObject
4460
+ | ResponseFormatJSONSchema;
4461
+ type ChatCompletionsStreamOptions = {
4462
+ include_usage?: boolean;
4463
+ include_obfuscation?: boolean;
4464
+ };
4465
+ type PredictionContent = {
4466
+ type: "content";
4467
+ content:
4468
+ | string
4469
+ | Array<{
4470
+ type: "text";
4471
+ text: string;
4472
+ }>;
4473
+ };
4474
+ type AudioParams = {
4475
+ voice:
4476
+ | string
4477
+ | {
4478
+ id: string;
4479
+ };
4480
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4481
+ };
4482
+ type WebSearchUserLocation = {
4483
+ type: "approximate";
4484
+ approximate: {
4485
+ city?: string;
4486
+ country?: string;
4487
+ region?: string;
4488
+ timezone?: string;
4489
+ };
4490
+ };
4491
+ type WebSearchOptions = {
4492
+ search_context_size?: "low" | "medium" | "high";
4493
+ user_location?: WebSearchUserLocation;
4494
+ };
4495
+ type ChatTemplateKwargs = {
4496
+ /** Whether to enable reasoning, enabled by default. */
4497
+ enable_thinking?: boolean;
4498
+ /** If false, preserves reasoning context between turns. */
4499
+ clear_thinking?: boolean;
4500
+ };
4501
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4502
+ type ChatCompletionsCommonOptions = {
4503
+ model?: string;
4504
+ audio?: AudioParams;
4505
+ frequency_penalty?: number | null;
4506
+ logit_bias?: Record<string, unknown> | null;
4507
+ logprobs?: boolean | null;
4508
+ top_logprobs?: number | null;
4509
+ max_tokens?: number | null;
4510
+ max_completion_tokens?: number | null;
4511
+ metadata?: Record<string, unknown> | null;
4512
+ modalities?: Array<"text" | "audio"> | null;
4513
+ n?: number | null;
4514
+ parallel_tool_calls?: boolean;
4515
+ prediction?: PredictionContent;
4516
+ presence_penalty?: number | null;
4517
+ reasoning_effort?: "low" | "medium" | "high" | null;
4518
+ chat_template_kwargs?: ChatTemplateKwargs;
4519
+ response_format?: ResponseFormat;
4520
+ seed?: number | null;
4521
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4522
+ stop?: string | Array<string> | null;
4523
+ store?: boolean | null;
4524
+ stream?: boolean | null;
4525
+ stream_options?: ChatCompletionsStreamOptions;
4526
+ temperature?: number | null;
4527
+ tool_choice?: ChatCompletionToolChoiceOption;
4528
+ tools?: Array<ChatCompletionTool>;
4529
+ top_p?: number | null;
4530
+ user?: string;
4531
+ web_search_options?: WebSearchOptions;
4532
+ function_call?:
4533
+ | "none"
4534
+ | "auto"
4535
+ | {
4536
+ name: string;
4537
+ };
4538
+ functions?: Array<FunctionDefinition>;
4539
+ };
4540
+ type PromptTokensDetails = {
4541
+ cached_tokens?: number;
4542
+ audio_tokens?: number;
4543
+ };
4544
+ type CompletionTokensDetails = {
4545
+ reasoning_tokens?: number;
4546
+ audio_tokens?: number;
4547
+ accepted_prediction_tokens?: number;
4548
+ rejected_prediction_tokens?: number;
4549
+ };
4550
+ type CompletionUsage = {
4551
+ prompt_tokens: number;
4552
+ completion_tokens: number;
4553
+ total_tokens: number;
4554
+ prompt_tokens_details?: PromptTokensDetails;
4555
+ completion_tokens_details?: CompletionTokensDetails;
4556
+ };
4557
+ type ChatCompletionTopLogprob = {
4558
+ token: string;
4559
+ logprob: number;
4560
+ bytes: Array<number> | null;
4561
+ };
4562
+ type ChatCompletionTokenLogprob = {
4563
+ token: string;
4564
+ logprob: number;
4565
+ bytes: Array<number> | null;
4566
+ top_logprobs: Array<ChatCompletionTopLogprob>;
4567
+ };
4568
+ type ChatCompletionAudio = {
4569
+ id: string;
4570
+ /** Base64 encoded audio bytes. */
4571
+ data: string;
4572
+ expires_at: number;
4573
+ transcript: string;
4574
+ };
4575
+ type ChatCompletionUrlCitation = {
4576
+ type: "url_citation";
4577
+ url_citation: {
4578
+ url: string;
4579
+ title: string;
4580
+ start_index: number;
4581
+ end_index: number;
4582
+ };
4583
+ };
4584
+ type ChatCompletionResponseMessage = {
4585
+ role: "assistant";
4586
+ content: string | null;
4587
+ refusal: string | null;
4588
+ annotations?: Array<ChatCompletionUrlCitation>;
4589
+ audio?: ChatCompletionAudio;
4590
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4591
+ function_call?: {
4592
+ name: string;
4593
+ arguments: string;
4594
+ } | null;
4595
+ };
4596
+ type ChatCompletionLogprobs = {
4597
+ content: Array<ChatCompletionTokenLogprob> | null;
4598
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
4599
+ };
4600
+ type ChatCompletionChoice = {
4601
+ index: number;
4602
+ message: ChatCompletionResponseMessage;
4603
+ finish_reason:
4604
+ | "stop"
4605
+ | "length"
4606
+ | "tool_calls"
4607
+ | "content_filter"
4608
+ | "function_call";
4609
+ logprobs: ChatCompletionLogprobs | null;
4610
+ };
4611
+ type ChatCompletionsPromptInput = {
4612
+ prompt: string;
4613
+ } & ChatCompletionsCommonOptions;
4614
+ type ChatCompletionsMessagesInput = {
4615
+ messages: Array<ChatCompletionMessageParam>;
4616
+ } & ChatCompletionsCommonOptions;
4617
+ type ChatCompletionsOutput = {
4618
+ id: string;
4619
+ object: string;
4620
+ created: number;
4621
+ model: string;
4622
+ choices: Array<ChatCompletionChoice>;
4623
+ usage?: CompletionUsage;
4624
+ system_fingerprint?: string | null;
4625
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4626
+ };
4221
4627
  /**
4222
4628
  * Workers AI support for OpenAI's Responses API
4223
4629
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4639,6 +5045,12 @@ type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4639
5045
  type StreamOptions = {
4640
5046
  include_obfuscation?: boolean;
4641
5047
  };
5048
+ /** Marks keys from T that aren't in U as optional never */
5049
+ type Without<T, U> = {
5050
+ [P in Exclude<keyof T, keyof U>]?: never;
5051
+ };
5052
+ /** Either T or U, but not both (mutually exclusive) */
5053
+ type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4642
5054
  type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4643
5055
  | {
4644
5056
  text: string | string[];
@@ -4931,10 +5343,12 @@ declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
4931
5343
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
4932
5344
  }
4933
5345
  interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
4934
- /**
4935
- * Base64 encoded value of the audio data.
4936
- */
4937
- audio: string;
5346
+ audio:
5347
+ | string
5348
+ | {
5349
+ body?: object;
5350
+ contentType?: string;
5351
+ };
4938
5352
  /**
4939
5353
  * Supported tasks are 'translate' or 'transcribe'.
4940
5354
  */
@@ -4952,9 +5366,33 @@ interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
4952
5366
  */
4953
5367
  initial_prompt?: string;
4954
5368
  /**
4955
- * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
5369
+ * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
4956
5370
  */
4957
5371
  prefix?: string;
5372
+ /**
5373
+ * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
5374
+ */
5375
+ beam_size?: number;
5376
+ /**
5377
+ * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
5378
+ */
5379
+ condition_on_previous_text?: boolean;
5380
+ /**
5381
+ * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
5382
+ */
5383
+ no_speech_threshold?: number;
5384
+ /**
5385
+ * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
5386
+ */
5387
+ compression_ratio_threshold?: number;
5388
+ /**
5389
+ * Threshold for filtering out segments with low average log probability, indicating low confidence.
5390
+ */
5391
+ log_prob_threshold?: number;
5392
+ /**
5393
+ * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
5394
+ */
5395
+ hallucination_silence_threshold?: number;
4958
5396
  }
4959
5397
  interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
4960
5398
  transcription_info?: {
@@ -5101,11 +5539,11 @@ interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5101
5539
  truncate_inputs?: boolean;
5102
5540
  }
5103
5541
  type Ai_Cf_Baai_Bge_M3_Output =
5104
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5542
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5105
5543
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5106
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5544
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5107
5545
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5108
- interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5546
+ interface Ai_Cf_Baai_Bge_M3_Output_Query {
5109
5547
  response?: {
5110
5548
  /**
5111
5549
  * Index of the context in the request
@@ -5125,7 +5563,7 @@ interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5125
5563
  */
5126
5564
  pooling?: "mean" | "cls";
5127
5565
  }
5128
- interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
5566
+ interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5129
5567
  shape?: number[];
5130
5568
  /**
5131
5569
  * Embeddings of the requested text values
@@ -5230,7 +5668,7 @@ interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5230
5668
  */
5231
5669
  role?: string;
5232
5670
  /**
5233
- * 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
5671
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5234
5672
  */
5235
5673
  tool_call_id?: string;
5236
5674
  content?:
@@ -5485,10 +5923,18 @@ interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5485
5923
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5486
5924
  */
5487
5925
  role: string;
5488
- /**
5489
- * The content of the message as a string.
5490
- */
5491
- content: string;
5926
+ content:
5927
+ | string
5928
+ | {
5929
+ /**
5930
+ * Type of the content (text)
5931
+ */
5932
+ type?: string;
5933
+ /**
5934
+ * Text content
5935
+ */
5936
+ text?: string;
5937
+ }[];
5492
5938
  }[];
5493
5939
  functions?: {
5494
5940
  name: string;
@@ -6144,7 +6590,7 @@ interface Ai_Cf_Qwen_Qwq_32B_Messages {
6144
6590
  */
6145
6591
  role?: string;
6146
6592
  /**
6147
- * 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
6593
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
6148
6594
  */
6149
6595
  tool_call_id?: string;
6150
6596
  content?:
@@ -6271,7 +6717,7 @@ interface Ai_Cf_Qwen_Qwq_32B_Messages {
6271
6717
  }
6272
6718
  )[];
6273
6719
  /**
6274
- * JSON schema that should be fulfilled for the response.
6720
+ * JSON schema that should be fufilled for the response.
6275
6721
  */
6276
6722
  guided_json?: object;
6277
6723
  /**
@@ -6545,7 +6991,7 @@ interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6545
6991
  }
6546
6992
  )[];
6547
6993
  /**
6548
- * JSON schema that should be fulfilled for the response.
6994
+ * JSON schema that should be fufilled for the response.
6549
6995
  */
6550
6996
  guided_json?: object;
6551
6997
  /**
@@ -6638,7 +7084,7 @@ interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6638
7084
  */
6639
7085
  prompt: string;
6640
7086
  /**
6641
- * JSON schema that should be fulfilled for the response.
7087
+ * JSON schema that should be fufilled for the response.
6642
7088
  */
6643
7089
  guided_json?: object;
6644
7090
  /**
@@ -6802,7 +7248,7 @@ interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6802
7248
  }
6803
7249
  )[];
6804
7250
  /**
6805
- * JSON schema that should be fulfilled for the response.
7251
+ * JSON schema that should be fufilled for the response.
6806
7252
  */
6807
7253
  guided_json?: object;
6808
7254
  /**
@@ -7083,7 +7529,7 @@ interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7083
7529
  )[];
7084
7530
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7085
7531
  /**
7086
- * JSON schema that should be fulfilled for the response.
7532
+ * JSON schema that should be fufilled for the response.
7087
7533
  */
7088
7534
  guided_json?: object;
7089
7535
  /**
@@ -7322,7 +7768,7 @@ interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7322
7768
  )[];
7323
7769
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7324
7770
  /**
7325
- * JSON schema that should be fulfilled for the response.
7771
+ * JSON schema that should be fufilled for the response.
7326
7772
  */
7327
7773
  guided_json?: object;
7328
7774
  /**
@@ -7487,10 +7933,18 @@ interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7487
7933
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7488
7934
  */
7489
7935
  role: string;
7490
- /**
7491
- * The content of the message as a string.
7492
- */
7493
- content: string;
7936
+ content:
7937
+ | string
7938
+ | {
7939
+ /**
7940
+ * Type of the content (text)
7941
+ */
7942
+ type?: string;
7943
+ /**
7944
+ * Text content
7945
+ */
7946
+ text?: string;
7947
+ }[];
7494
7948
  }[];
7495
7949
  functions?: {
7496
7950
  name: string;
@@ -7702,10 +8156,18 @@ interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7702
8156
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7703
8157
  */
7704
8158
  role: string;
7705
- /**
7706
- * The content of the message as a string.
7707
- */
7708
- content: string;
8159
+ content:
8160
+ | string
8161
+ | {
8162
+ /**
8163
+ * Type of the content (text)
8164
+ */
8165
+ type?: string;
8166
+ /**
8167
+ * Text content
8168
+ */
8169
+ text?: string;
8170
+ }[];
7709
8171
  }[];
7710
8172
  functions?: {
7711
8173
  name: string;
@@ -8273,12 +8735,12 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8273
8735
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8274
8736
  }
8275
8737
  declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8276
- inputs: ResponsesInput;
8277
- postProcessedOutputs: ResponsesOutput;
8738
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8739
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8278
8740
  }
8279
8741
  declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8280
- inputs: ResponsesInput;
8281
- postProcessedOutputs: ResponsesOutput;
8742
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8743
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8282
8744
  }
8283
8745
  interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8284
8746
  /**
@@ -8410,7 +8872,7 @@ interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8410
8872
  */
8411
8873
  text: string | string[];
8412
8874
  /**
8413
- * Target language to translate to
8875
+ * Target langauge to translate to
8414
8876
  */
8415
8877
  target_language:
8416
8878
  | "asm_Beng"
@@ -8526,10 +8988,18 @@ interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8526
8988
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8527
8989
  */
8528
8990
  role: string;
8529
- /**
8530
- * The content of the message as a string.
8531
- */
8532
- content: string;
8991
+ content:
8992
+ | string
8993
+ | {
8994
+ /**
8995
+ * Type of the content (text)
8996
+ */
8997
+ type?: string;
8998
+ /**
8999
+ * Text content
9000
+ */
9001
+ text?: string;
9002
+ }[];
8533
9003
  }[];
8534
9004
  functions?: {
8535
9005
  name: string;
@@ -8741,10 +9211,18 @@ interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8741
9211
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8742
9212
  */
8743
9213
  role: string;
8744
- /**
8745
- * The content of the message as a string.
8746
- */
8747
- content: string;
9214
+ content:
9215
+ | string
9216
+ | {
9217
+ /**
9218
+ * Type of the content (text)
9219
+ */
9220
+ type?: string;
9221
+ /**
9222
+ * Text content
9223
+ */
9224
+ text?: string;
9225
+ }[];
8748
9226
  }[];
8749
9227
  functions?: {
8750
9228
  name: string;
@@ -9299,6 +9777,66 @@ declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9299
9777
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9300
9778
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9301
9779
  }
9780
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
9781
+ multipart: {
9782
+ body?: object;
9783
+ contentType?: string;
9784
+ };
9785
+ }
9786
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
9787
+ /**
9788
+ * Generated image as Base64 string.
9789
+ */
9790
+ image?: string;
9791
+ }
9792
+ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
9793
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
9794
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
9795
+ }
9796
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
9797
+ multipart: {
9798
+ body?: object;
9799
+ contentType?: string;
9800
+ };
9801
+ }
9802
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
9803
+ /**
9804
+ * Generated image as Base64 string.
9805
+ */
9806
+ image?: string;
9807
+ }
9808
+ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
9809
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
9810
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
9811
+ }
9812
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
9813
+ multipart: {
9814
+ body?: object;
9815
+ contentType?: string;
9816
+ };
9817
+ }
9818
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
9819
+ /**
9820
+ * Generated image as Base64 string.
9821
+ */
9822
+ image?: string;
9823
+ }
9824
+ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
9825
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
9826
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
9827
+ }
9828
+ declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
9829
+ inputs: ChatCompletionsInput;
9830
+ postProcessedOutputs: ChatCompletionsOutput;
9831
+ }
9832
+ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
9833
+ inputs: ChatCompletionsInput;
9834
+ postProcessedOutputs: ChatCompletionsOutput;
9835
+ }
9836
+ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
9837
+ inputs: ChatCompletionsInput;
9838
+ postProcessedOutputs: ChatCompletionsOutput;
9839
+ }
9302
9840
  interface AiModels {
9303
9841
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9304
9842
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9317,7 +9855,6 @@ interface AiModels {
9317
9855
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9318
9856
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9319
9857
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9320
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9321
9858
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9322
9859
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9323
9860
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9384,6 +9921,12 @@ interface AiModels {
9384
9921
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9385
9922
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9386
9923
  "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
9924
+ "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
9925
+ "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
9926
+ "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
9927
+ "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
9928
+ "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
9929
+ "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
9387
9930
  }
9388
9931
  type AiOptions = {
9389
9932
  /**
@@ -9435,6 +9978,16 @@ type AiModelsSearchObject = {
9435
9978
  value: string;
9436
9979
  }[];
9437
9980
  };
9981
+ type ChatCompletionsBase = XOR<
9982
+ ChatCompletionsPromptInput,
9983
+ ChatCompletionsMessagesInput
9984
+ >;
9985
+ type ChatCompletionsInput = XOR<
9986
+ ChatCompletionsBase,
9987
+ {
9988
+ requests: ChatCompletionsBase[];
9989
+ }
9990
+ >;
9438
9991
  interface InferenceUpstreamError extends Error {}
9439
9992
  interface AiInternalError extends Error {}
9440
9993
  type AiModelListType = Record<string, any>;
@@ -9909,6 +10462,41 @@ interface RequestInitCfProperties extends Record<string, unknown> {
9909
10462
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
9910
10463
  */
9911
10464
  cacheTtlByStatus?: Record<string, number>;
10465
+ /**
10466
+ * Explicit Cache-Control header value to set on the response stored in cache.
10467
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10468
+ *
10469
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10470
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10471
+ *
10472
+ * Can be used together with `cacheTtlByStatus`.
10473
+ */
10474
+ cacheControl?: string;
10475
+ /**
10476
+ * Whether the response should be eligible for Cache Reserve storage.
10477
+ */
10478
+ cacheReserveEligible?: boolean;
10479
+ /**
10480
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10481
+ */
10482
+ respectStrongEtag?: boolean;
10483
+ /**
10484
+ * Whether to strip ETag headers from the origin response before caching.
10485
+ */
10486
+ stripEtags?: boolean;
10487
+ /**
10488
+ * Whether to strip Last-Modified headers from the origin response before caching.
10489
+ */
10490
+ stripLastModified?: boolean;
10491
+ /**
10492
+ * Whether to enable Cache Deception Armor, which protects against web cache
10493
+ * deception attacks by verifying the Content-Type matches the URL extension.
10494
+ */
10495
+ cacheDeceptionArmor?: boolean;
10496
+ /**
10497
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10498
+ */
10499
+ cacheReserveMinimumFileSize?: number;
9912
10500
  scrapeShield?: boolean;
9913
10501
  apps?: boolean;
9914
10502
  image?: RequestInitCfPropertiesImage;
@@ -11821,6 +12409,7 @@ declare namespace CloudflareWorkersModule {
11821
12409
  constructor(ctx: ExecutionContext, env: Env);
11822
12410
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11823
12411
  fetch?(request: Request): Response | Promise<Response>;
12412
+ connect?(socket: Socket): void | Promise<void>;
11824
12413
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11825
12414
  scheduled?(controller: ScheduledController): void | Promise<void>;
11826
12415
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11841,6 +12430,7 @@ declare namespace CloudflareWorkersModule {
11841
12430
  constructor(ctx: DurableObjectState, env: Env);
11842
12431
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11843
12432
  fetch?(request: Request): Response | Promise<Response>;
12433
+ connect?(socket: Socket): void | Promise<void>;
11844
12434
  webSocketMessage?(
11845
12435
  ws: WebSocket,
11846
12436
  message: string | ArrayBuffer,
@@ -11991,17 +12581,6 @@ interface StreamBinding {
11991
12581
  * @returns A handle for per-video operations.
11992
12582
  */
11993
12583
  video(id: string): StreamVideoHandle;
11994
- /**
11995
- * Uploads a new video from a File.
11996
- * @param file The video file to upload.
11997
- * @returns The uploaded video details.
11998
- * @throws {BadRequestError} if the upload parameter is invalid
11999
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
12000
- * @throws {MaxFileSizeError} if the file size is too large
12001
- * @throws {RateLimitedError} if the server received too many requests
12002
- * @throws {InternalError} if an unexpected error occurs
12003
- */
12004
- upload(file: File): Promise<StreamVideo>;
12005
12584
  /**
12006
12585
  * Uploads a new video from a provided URL.
12007
12586
  * @param url The URL to upload from.
@@ -12851,6 +13430,9 @@ declare namespace TailStream {
12851
13430
  readonly type: "fetch";
12852
13431
  readonly statusCode: number;
12853
13432
  }
13433
+ interface ConnectEventInfo {
13434
+ readonly type: "connect";
13435
+ }
12854
13436
  type EventOutcome =
12855
13437
  | "ok"
12856
13438
  | "canceled"
@@ -12881,6 +13463,7 @@ declare namespace TailStream {
12881
13463
  readonly scriptVersion?: ScriptVersion;
12882
13464
  readonly info:
12883
13465
  | FetchEventInfo
13466
+ | ConnectEventInfo
12884
13467
  | JsRpcEventInfo
12885
13468
  | ScheduledEventInfo
12886
13469
  | AlarmEventInfo