@cloudflare/workers-types 4.20260317.1 → 4.20260329.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -480,6 +480,11 @@ export type ExportedHandlerFetchHandler<
480
480
  env: Env,
481
481
  ctx: ExecutionContext<Props>,
482
482
  ) => Response | Promise<Response>;
483
+ export type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
484
+ socket: Socket,
485
+ env: Env,
486
+ ctx: ExecutionContext<Props>,
487
+ ) => void | Promise<void>;
483
488
  export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
484
489
  events: TraceItem[],
485
490
  env: Env,
@@ -521,6 +526,7 @@ export interface ExportedHandler<
521
526
  Props = unknown,
522
527
  > {
523
528
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
529
+ connect?: ExportedHandlerConnectHandler<Env, Props>;
524
530
  tail?: ExportedHandlerTailHandler<Env, Props>;
525
531
  trace?: ExportedHandlerTraceHandler<Env, Props>;
526
532
  tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
@@ -535,12 +541,14 @@ export interface StructuredSerializeOptions {
535
541
  export interface AlarmInvocationInfo {
536
542
  readonly isRetry: boolean;
537
543
  readonly retryCount: number;
544
+ readonly scheduledTime: number;
538
545
  }
539
546
  export interface Cloudflare {
540
547
  readonly compatibilityFlags: Record<string, boolean>;
541
548
  }
542
549
  export interface DurableObject {
543
550
  fetch(request: Request): Response | Promise<Response>;
551
+ connect?(socket: Socket): void | Promise<void>;
544
552
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
545
553
  webSocketMessage?(
546
554
  ws: WebSocket,
@@ -558,7 +566,7 @@ export type DurableObjectStub<
558
566
  T extends Rpc.DurableObjectBranded | undefined = undefined,
559
567
  > = Fetcher<
560
568
  T,
561
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
569
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
562
570
  > & {
563
571
  readonly id: DurableObjectId;
564
572
  readonly name?: string;
@@ -567,6 +575,7 @@ export interface DurableObjectId {
567
575
  toString(): string;
568
576
  equals(other: DurableObjectId): boolean;
569
577
  readonly name?: string;
578
+ readonly jurisdiction?: string;
570
579
  }
571
580
  export declare abstract class DurableObjectNamespace<
572
581
  T extends Rpc.DurableObjectBranded | undefined = undefined,
@@ -3094,6 +3103,7 @@ export interface TraceItem {
3094
3103
  | (
3095
3104
  | TraceItemFetchEventInfo
3096
3105
  | TraceItemJsRpcEventInfo
3106
+ | TraceItemConnectEventInfo
3097
3107
  | TraceItemScheduledEventInfo
3098
3108
  | TraceItemAlarmEventInfo
3099
3109
  | TraceItemQueueEventInfo
@@ -3112,6 +3122,7 @@ export interface TraceItem {
3112
3122
  readonly scriptVersion?: ScriptVersion;
3113
3123
  readonly dispatchNamespace?: string;
3114
3124
  readonly scriptTags?: string[];
3125
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3115
3126
  readonly durableObjectId?: string;
3116
3127
  readonly outcome: string;
3117
3128
  readonly executionModel: string;
@@ -3122,6 +3133,7 @@ export interface TraceItem {
3122
3133
  export interface TraceItemAlarmEventInfo {
3123
3134
  readonly scheduledTime: Date;
3124
3135
  }
3136
+ export interface TraceItemConnectEventInfo {}
3125
3137
  export interface TraceItemCustomEventInfo {}
3126
3138
  export interface TraceItemScheduledEventInfo {
3127
3139
  readonly scheduledTime: number;
@@ -3722,7 +3734,7 @@ export interface ContainerStartupOptions {
3722
3734
  entrypoint?: string[];
3723
3735
  enableInternet: boolean;
3724
3736
  env?: Record<string, string>;
3725
- hardTimeout?: number | bigint;
3737
+ labels?: Record<string, string>;
3726
3738
  }
3727
3739
  /**
3728
3740
  * 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.
@@ -4291,6 +4303,402 @@ export declare abstract class BaseAiTranslation {
4291
4303
  inputs: AiTranslationInput;
4292
4304
  postProcessedOutputs: AiTranslationOutput;
4293
4305
  }
4306
+ /**
4307
+ * Workers AI support for OpenAI's Chat Completions API
4308
+ */
4309
+ export type ChatCompletionContentPartText = {
4310
+ type: "text";
4311
+ text: string;
4312
+ };
4313
+ export type ChatCompletionContentPartImage = {
4314
+ type: "image_url";
4315
+ image_url: {
4316
+ url: string;
4317
+ detail?: "auto" | "low" | "high";
4318
+ };
4319
+ };
4320
+ export type ChatCompletionContentPartInputAudio = {
4321
+ type: "input_audio";
4322
+ input_audio: {
4323
+ /** Base64 encoded audio data. */
4324
+ data: string;
4325
+ format: "wav" | "mp3";
4326
+ };
4327
+ };
4328
+ export type ChatCompletionContentPartFile = {
4329
+ type: "file";
4330
+ file: {
4331
+ /** Base64 encoded file data. */
4332
+ file_data?: string;
4333
+ /** The ID of an uploaded file. */
4334
+ file_id?: string;
4335
+ filename?: string;
4336
+ };
4337
+ };
4338
+ export type ChatCompletionContentPartRefusal = {
4339
+ type: "refusal";
4340
+ refusal: string;
4341
+ };
4342
+ export type ChatCompletionContentPart =
4343
+ | ChatCompletionContentPartText
4344
+ | ChatCompletionContentPartImage
4345
+ | ChatCompletionContentPartInputAudio
4346
+ | ChatCompletionContentPartFile;
4347
+ export type FunctionDefinition = {
4348
+ name: string;
4349
+ description?: string;
4350
+ parameters?: Record<string, unknown>;
4351
+ strict?: boolean | null;
4352
+ };
4353
+ export type ChatCompletionFunctionTool = {
4354
+ type: "function";
4355
+ function: FunctionDefinition;
4356
+ };
4357
+ export type ChatCompletionCustomToolGrammarFormat = {
4358
+ type: "grammar";
4359
+ grammar: {
4360
+ definition: string;
4361
+ syntax: "lark" | "regex";
4362
+ };
4363
+ };
4364
+ export type ChatCompletionCustomToolTextFormat = {
4365
+ type: "text";
4366
+ };
4367
+ export type ChatCompletionCustomToolFormat =
4368
+ | ChatCompletionCustomToolTextFormat
4369
+ | ChatCompletionCustomToolGrammarFormat;
4370
+ export type ChatCompletionCustomTool = {
4371
+ type: "custom";
4372
+ custom: {
4373
+ name: string;
4374
+ description?: string;
4375
+ format?: ChatCompletionCustomToolFormat;
4376
+ };
4377
+ };
4378
+ export type ChatCompletionTool =
4379
+ | ChatCompletionFunctionTool
4380
+ | ChatCompletionCustomTool;
4381
+ export type ChatCompletionMessageFunctionToolCall = {
4382
+ id: string;
4383
+ type: "function";
4384
+ function: {
4385
+ name: string;
4386
+ /** JSON-encoded arguments string. */
4387
+ arguments: string;
4388
+ };
4389
+ };
4390
+ export type ChatCompletionMessageCustomToolCall = {
4391
+ id: string;
4392
+ type: "custom";
4393
+ custom: {
4394
+ name: string;
4395
+ input: string;
4396
+ };
4397
+ };
4398
+ export type ChatCompletionMessageToolCall =
4399
+ | ChatCompletionMessageFunctionToolCall
4400
+ | ChatCompletionMessageCustomToolCall;
4401
+ export type ChatCompletionToolChoiceFunction = {
4402
+ type: "function";
4403
+ function: {
4404
+ name: string;
4405
+ };
4406
+ };
4407
+ export type ChatCompletionToolChoiceCustom = {
4408
+ type: "custom";
4409
+ custom: {
4410
+ name: string;
4411
+ };
4412
+ };
4413
+ export type ChatCompletionToolChoiceAllowedTools = {
4414
+ type: "allowed_tools";
4415
+ allowed_tools: {
4416
+ mode: "auto" | "required";
4417
+ tools: Array<Record<string, unknown>>;
4418
+ };
4419
+ };
4420
+ export type ChatCompletionToolChoiceOption =
4421
+ | "none"
4422
+ | "auto"
4423
+ | "required"
4424
+ | ChatCompletionToolChoiceFunction
4425
+ | ChatCompletionToolChoiceCustom
4426
+ | ChatCompletionToolChoiceAllowedTools;
4427
+ export type DeveloperMessage = {
4428
+ role: "developer";
4429
+ content:
4430
+ | string
4431
+ | Array<{
4432
+ type: "text";
4433
+ text: string;
4434
+ }>;
4435
+ name?: string;
4436
+ };
4437
+ export type SystemMessage = {
4438
+ role: "system";
4439
+ content:
4440
+ | string
4441
+ | Array<{
4442
+ type: "text";
4443
+ text: string;
4444
+ }>;
4445
+ name?: string;
4446
+ };
4447
+ /**
4448
+ * Permissive merged content part used inside UserMessage arrays.
4449
+ *
4450
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4451
+ * inside nested array items does not correctly match different branches for
4452
+ * different array elements, so the schema uses a single merged object.
4453
+ */
4454
+ export type UserMessageContentPart = {
4455
+ type: "text" | "image_url" | "input_audio" | "file";
4456
+ text?: string;
4457
+ image_url?: {
4458
+ url?: string;
4459
+ detail?: "auto" | "low" | "high";
4460
+ };
4461
+ input_audio?: {
4462
+ data?: string;
4463
+ format?: "wav" | "mp3";
4464
+ };
4465
+ file?: {
4466
+ file_data?: string;
4467
+ file_id?: string;
4468
+ filename?: string;
4469
+ };
4470
+ };
4471
+ export type UserMessage = {
4472
+ role: "user";
4473
+ content: string | Array<UserMessageContentPart>;
4474
+ name?: string;
4475
+ };
4476
+ export type AssistantMessageContentPart = {
4477
+ type: "text" | "refusal";
4478
+ text?: string;
4479
+ refusal?: string;
4480
+ };
4481
+ export type AssistantMessage = {
4482
+ role: "assistant";
4483
+ content?: string | null | Array<AssistantMessageContentPart>;
4484
+ refusal?: string | null;
4485
+ name?: string;
4486
+ audio?: {
4487
+ id: string;
4488
+ };
4489
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4490
+ function_call?: {
4491
+ name: string;
4492
+ arguments: string;
4493
+ };
4494
+ };
4495
+ export type ToolMessage = {
4496
+ role: "tool";
4497
+ content:
4498
+ | string
4499
+ | Array<{
4500
+ type: "text";
4501
+ text: string;
4502
+ }>;
4503
+ tool_call_id: string;
4504
+ };
4505
+ export type FunctionMessage = {
4506
+ role: "function";
4507
+ content: string;
4508
+ name: string;
4509
+ };
4510
+ export type ChatCompletionMessageParam =
4511
+ | DeveloperMessage
4512
+ | SystemMessage
4513
+ | UserMessage
4514
+ | AssistantMessage
4515
+ | ToolMessage
4516
+ | FunctionMessage;
4517
+ export type ChatCompletionsResponseFormatText = {
4518
+ type: "text";
4519
+ };
4520
+ export type ChatCompletionsResponseFormatJSONObject = {
4521
+ type: "json_object";
4522
+ };
4523
+ export type ResponseFormatJSONSchema = {
4524
+ type: "json_schema";
4525
+ json_schema: {
4526
+ name: string;
4527
+ description?: string;
4528
+ schema?: Record<string, unknown>;
4529
+ strict?: boolean | null;
4530
+ };
4531
+ };
4532
+ export type ResponseFormat =
4533
+ | ChatCompletionsResponseFormatText
4534
+ | ChatCompletionsResponseFormatJSONObject
4535
+ | ResponseFormatJSONSchema;
4536
+ export type ChatCompletionsStreamOptions = {
4537
+ include_usage?: boolean;
4538
+ include_obfuscation?: boolean;
4539
+ };
4540
+ export type PredictionContent = {
4541
+ type: "content";
4542
+ content:
4543
+ | string
4544
+ | Array<{
4545
+ type: "text";
4546
+ text: string;
4547
+ }>;
4548
+ };
4549
+ export type AudioParams = {
4550
+ voice:
4551
+ | string
4552
+ | {
4553
+ id: string;
4554
+ };
4555
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4556
+ };
4557
+ export type WebSearchUserLocation = {
4558
+ type: "approximate";
4559
+ approximate: {
4560
+ city?: string;
4561
+ country?: string;
4562
+ region?: string;
4563
+ timezone?: string;
4564
+ };
4565
+ };
4566
+ export type WebSearchOptions = {
4567
+ search_context_size?: "low" | "medium" | "high";
4568
+ user_location?: WebSearchUserLocation;
4569
+ };
4570
+ export type ChatTemplateKwargs = {
4571
+ /** Whether to enable reasoning, enabled by default. */
4572
+ enable_thinking?: boolean;
4573
+ /** If false, preserves reasoning context between turns. */
4574
+ clear_thinking?: boolean;
4575
+ };
4576
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4577
+ export type ChatCompletionsCommonOptions = {
4578
+ model?: string;
4579
+ audio?: AudioParams;
4580
+ frequency_penalty?: number | null;
4581
+ logit_bias?: Record<string, unknown> | null;
4582
+ logprobs?: boolean | null;
4583
+ top_logprobs?: number | null;
4584
+ max_tokens?: number | null;
4585
+ max_completion_tokens?: number | null;
4586
+ metadata?: Record<string, unknown> | null;
4587
+ modalities?: Array<"text" | "audio"> | null;
4588
+ n?: number | null;
4589
+ parallel_tool_calls?: boolean;
4590
+ prediction?: PredictionContent;
4591
+ presence_penalty?: number | null;
4592
+ reasoning_effort?: "low" | "medium" | "high" | null;
4593
+ chat_template_kwargs?: ChatTemplateKwargs;
4594
+ response_format?: ResponseFormat;
4595
+ seed?: number | null;
4596
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4597
+ stop?: string | Array<string> | null;
4598
+ store?: boolean | null;
4599
+ stream?: boolean | null;
4600
+ stream_options?: ChatCompletionsStreamOptions;
4601
+ temperature?: number | null;
4602
+ tool_choice?: ChatCompletionToolChoiceOption;
4603
+ tools?: Array<ChatCompletionTool>;
4604
+ top_p?: number | null;
4605
+ user?: string;
4606
+ web_search_options?: WebSearchOptions;
4607
+ function_call?:
4608
+ | "none"
4609
+ | "auto"
4610
+ | {
4611
+ name: string;
4612
+ };
4613
+ functions?: Array<FunctionDefinition>;
4614
+ };
4615
+ export type PromptTokensDetails = {
4616
+ cached_tokens?: number;
4617
+ audio_tokens?: number;
4618
+ };
4619
+ export type CompletionTokensDetails = {
4620
+ reasoning_tokens?: number;
4621
+ audio_tokens?: number;
4622
+ accepted_prediction_tokens?: number;
4623
+ rejected_prediction_tokens?: number;
4624
+ };
4625
+ export type CompletionUsage = {
4626
+ prompt_tokens: number;
4627
+ completion_tokens: number;
4628
+ total_tokens: number;
4629
+ prompt_tokens_details?: PromptTokensDetails;
4630
+ completion_tokens_details?: CompletionTokensDetails;
4631
+ };
4632
+ export type ChatCompletionTopLogprob = {
4633
+ token: string;
4634
+ logprob: number;
4635
+ bytes: Array<number> | null;
4636
+ };
4637
+ export type ChatCompletionTokenLogprob = {
4638
+ token: string;
4639
+ logprob: number;
4640
+ bytes: Array<number> | null;
4641
+ top_logprobs: Array<ChatCompletionTopLogprob>;
4642
+ };
4643
+ export type ChatCompletionAudio = {
4644
+ id: string;
4645
+ /** Base64 encoded audio bytes. */
4646
+ data: string;
4647
+ expires_at: number;
4648
+ transcript: string;
4649
+ };
4650
+ export type ChatCompletionUrlCitation = {
4651
+ type: "url_citation";
4652
+ url_citation: {
4653
+ url: string;
4654
+ title: string;
4655
+ start_index: number;
4656
+ end_index: number;
4657
+ };
4658
+ };
4659
+ export type ChatCompletionResponseMessage = {
4660
+ role: "assistant";
4661
+ content: string | null;
4662
+ refusal: string | null;
4663
+ annotations?: Array<ChatCompletionUrlCitation>;
4664
+ audio?: ChatCompletionAudio;
4665
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4666
+ function_call?: {
4667
+ name: string;
4668
+ arguments: string;
4669
+ } | null;
4670
+ };
4671
+ export type ChatCompletionLogprobs = {
4672
+ content: Array<ChatCompletionTokenLogprob> | null;
4673
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
4674
+ };
4675
+ export type ChatCompletionChoice = {
4676
+ index: number;
4677
+ message: ChatCompletionResponseMessage;
4678
+ finish_reason:
4679
+ | "stop"
4680
+ | "length"
4681
+ | "tool_calls"
4682
+ | "content_filter"
4683
+ | "function_call";
4684
+ logprobs: ChatCompletionLogprobs | null;
4685
+ };
4686
+ export type ChatCompletionsPromptInput = {
4687
+ prompt: string;
4688
+ } & ChatCompletionsCommonOptions;
4689
+ export type ChatCompletionsMessagesInput = {
4690
+ messages: Array<ChatCompletionMessageParam>;
4691
+ } & ChatCompletionsCommonOptions;
4692
+ export type ChatCompletionsOutput = {
4693
+ id: string;
4694
+ object: string;
4695
+ created: number;
4696
+ model: string;
4697
+ choices: Array<ChatCompletionChoice>;
4698
+ usage?: CompletionUsage;
4699
+ system_fingerprint?: string | null;
4700
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4701
+ };
4294
4702
  /**
4295
4703
  * Workers AI support for OpenAI's Responses API
4296
4704
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4713,6 +5121,12 @@ export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4713
5121
  export type StreamOptions = {
4714
5122
  include_obfuscation?: boolean;
4715
5123
  };
5124
+ /** Marks keys from T that aren't in U as optional never */
5125
+ export 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
+ export type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4716
5130
  export type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4717
5131
  | {
4718
5132
  text: string | string[];
@@ -5005,10 +5419,12 @@ export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
5005
5419
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
5006
5420
  }
5007
5421
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5008
- /**
5009
- * Base64 encoded value of the audio data.
5010
- */
5011
- audio: string;
5422
+ audio:
5423
+ | string
5424
+ | {
5425
+ body?: object;
5426
+ contentType?: string;
5427
+ };
5012
5428
  /**
5013
5429
  * Supported tasks are 'translate' or 'transcribe'.
5014
5430
  */
@@ -5026,9 +5442,33 @@ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5026
5442
  */
5027
5443
  initial_prompt?: string;
5028
5444
  /**
5029
- * 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.
5030
5446
  */
5031
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;
5032
5472
  }
5033
5473
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
5034
5474
  transcription_info?: {
@@ -5175,11 +5615,11 @@ export interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5175
5615
  truncate_inputs?: boolean;
5176
5616
  }
5177
5617
  export type Ai_Cf_Baai_Bge_M3_Output =
5178
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5618
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5179
5619
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5180
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5620
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5181
5621
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5182
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5622
+ export interface Ai_Cf_Baai_Bge_M3_Output_Query {
5183
5623
  response?: {
5184
5624
  /**
5185
5625
  * Index of the context in the request
@@ -5199,7 +5639,7 @@ export interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5199
5639
  */
5200
5640
  pooling?: "mean" | "cls";
5201
5641
  }
5202
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
5642
+ export interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5203
5643
  shape?: number[];
5204
5644
  /**
5205
5645
  * Embeddings of the requested text values
@@ -5304,7 +5744,7 @@ export interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5304
5744
  */
5305
5745
  role?: string;
5306
5746
  /**
5307
- * 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
5308
5748
  */
5309
5749
  tool_call_id?: string;
5310
5750
  content?:
@@ -5559,10 +5999,18 @@ export interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5559
5999
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5560
6000
  */
5561
6001
  role: string;
5562
- /**
5563
- * The content of the message as a string.
5564
- */
5565
- 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
+ }[];
5566
6014
  }[];
5567
6015
  functions?: {
5568
6016
  name: string;
@@ -6218,7 +6666,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6218
6666
  */
6219
6667
  role?: string;
6220
6668
  /**
6221
- * 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
6222
6670
  */
6223
6671
  tool_call_id?: string;
6224
6672
  content?:
@@ -6345,7 +6793,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6345
6793
  }
6346
6794
  )[];
6347
6795
  /**
6348
- * JSON schema that should be fulfilled for the response.
6796
+ * JSON schema that should be fufilled for the response.
6349
6797
  */
6350
6798
  guided_json?: object;
6351
6799
  /**
@@ -6619,7 +7067,7 @@ export interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6619
7067
  }
6620
7068
  )[];
6621
7069
  /**
6622
- * JSON schema that should be fulfilled for the response.
7070
+ * JSON schema that should be fufilled for the response.
6623
7071
  */
6624
7072
  guided_json?: object;
6625
7073
  /**
@@ -6712,7 +7160,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6712
7160
  */
6713
7161
  prompt: string;
6714
7162
  /**
6715
- * JSON schema that should be fulfilled for the response.
7163
+ * JSON schema that should be fufilled for the response.
6716
7164
  */
6717
7165
  guided_json?: object;
6718
7166
  /**
@@ -6876,7 +7324,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6876
7324
  }
6877
7325
  )[];
6878
7326
  /**
6879
- * JSON schema that should be fulfilled for the response.
7327
+ * JSON schema that should be fufilled for the response.
6880
7328
  */
6881
7329
  guided_json?: object;
6882
7330
  /**
@@ -7157,7 +7605,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7157
7605
  )[];
7158
7606
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7159
7607
  /**
7160
- * JSON schema that should be fulfilled for the response.
7608
+ * JSON schema that should be fufilled for the response.
7161
7609
  */
7162
7610
  guided_json?: object;
7163
7611
  /**
@@ -7396,7 +7844,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7396
7844
  )[];
7397
7845
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7398
7846
  /**
7399
- * JSON schema that should be fulfilled for the response.
7847
+ * JSON schema that should be fufilled for the response.
7400
7848
  */
7401
7849
  guided_json?: object;
7402
7850
  /**
@@ -7561,10 +8009,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7561
8009
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7562
8010
  */
7563
8011
  role: string;
7564
- /**
7565
- * The content of the message as a string.
7566
- */
7567
- 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
+ }[];
7568
8024
  }[];
7569
8025
  functions?: {
7570
8026
  name: string;
@@ -7776,10 +8232,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7776
8232
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7777
8233
  */
7778
8234
  role: string;
7779
- /**
7780
- * The content of the message as a string.
7781
- */
7782
- 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
+ }[];
7783
8247
  }[];
7784
8248
  functions?: {
7785
8249
  name: string;
@@ -8347,12 +8811,12 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8347
8811
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8348
8812
  }
8349
8813
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8350
- inputs: ResponsesInput;
8351
- postProcessedOutputs: ResponsesOutput;
8814
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8815
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8352
8816
  }
8353
8817
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8354
- inputs: ResponsesInput;
8355
- postProcessedOutputs: ResponsesOutput;
8818
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
8819
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8356
8820
  }
8357
8821
  export interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8358
8822
  /**
@@ -8484,7 +8948,7 @@ export interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8484
8948
  */
8485
8949
  text: string | string[];
8486
8950
  /**
8487
- * Target language to translate to
8951
+ * Target langauge to translate to
8488
8952
  */
8489
8953
  target_language:
8490
8954
  | "asm_Beng"
@@ -8600,10 +9064,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8600
9064
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8601
9065
  */
8602
9066
  role: string;
8603
- /**
8604
- * The content of the message as a string.
8605
- */
8606
- 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
+ }[];
8607
9079
  }[];
8608
9080
  functions?: {
8609
9081
  name: string;
@@ -8815,10 +9287,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8815
9287
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8816
9288
  */
8817
9289
  role: string;
8818
- /**
8819
- * The content of the message as a string.
8820
- */
8821
- 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
+ }[];
8822
9302
  }[];
8823
9303
  functions?: {
8824
9304
  name: string;
@@ -9373,6 +9853,66 @@ export declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9373
9853
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9374
9854
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9375
9855
  }
9856
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
9857
+ multipart: {
9858
+ body?: object;
9859
+ contentType?: string;
9860
+ };
9861
+ }
9862
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
9863
+ /**
9864
+ * Generated image as Base64 string.
9865
+ */
9866
+ image?: string;
9867
+ }
9868
+ export 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
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
9873
+ multipart: {
9874
+ body?: object;
9875
+ contentType?: string;
9876
+ };
9877
+ }
9878
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
9879
+ /**
9880
+ * Generated image as Base64 string.
9881
+ */
9882
+ image?: string;
9883
+ }
9884
+ export 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
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
9889
+ multipart: {
9890
+ body?: object;
9891
+ contentType?: string;
9892
+ };
9893
+ }
9894
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
9895
+ /**
9896
+ * Generated image as Base64 string.
9897
+ */
9898
+ image?: string;
9899
+ }
9900
+ export 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
+ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
9905
+ inputs: ChatCompletionsInput;
9906
+ postProcessedOutputs: ChatCompletionsOutput;
9907
+ }
9908
+ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
9909
+ inputs: ChatCompletionsInput;
9910
+ postProcessedOutputs: ChatCompletionsOutput;
9911
+ }
9912
+ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
9913
+ inputs: ChatCompletionsInput;
9914
+ postProcessedOutputs: ChatCompletionsOutput;
9915
+ }
9376
9916
  export interface AiModels {
9377
9917
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9378
9918
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9391,7 +9931,6 @@ export interface AiModels {
9391
9931
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9392
9932
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9393
9933
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9394
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9395
9934
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9396
9935
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9397
9936
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9458,6 +9997,12 @@ export interface AiModels {
9458
9997
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9459
9998
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9460
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;
9461
10006
  }
9462
10007
  export type AiOptions = {
9463
10008
  /**
@@ -9509,6 +10054,16 @@ export type AiModelsSearchObject = {
9509
10054
  value: string;
9510
10055
  }[];
9511
10056
  };
10057
+ export type ChatCompletionsBase = XOR<
10058
+ ChatCompletionsPromptInput,
10059
+ ChatCompletionsMessagesInput
10060
+ >;
10061
+ export type ChatCompletionsInput = XOR<
10062
+ ChatCompletionsBase,
10063
+ {
10064
+ requests: ChatCompletionsBase[];
10065
+ }
10066
+ >;
9512
10067
  export interface InferenceUpstreamError extends Error {}
9513
10068
  export interface AiInternalError extends Error {}
9514
10069
  export type AiModelListType = Record<string, any>;
@@ -9985,6 +10540,41 @@ export interface RequestInitCfProperties extends Record<string, unknown> {
9985
10540
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
9986
10541
  */
9987
10542
  cacheTtlByStatus?: Record<string, number>;
10543
+ /**
10544
+ * Explicit Cache-Control header value to set on the response stored in cache.
10545
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10546
+ *
10547
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10548
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10549
+ *
10550
+ * Can be used together with `cacheTtlByStatus`.
10551
+ */
10552
+ cacheControl?: string;
10553
+ /**
10554
+ * Whether the response should be eligible for Cache Reserve storage.
10555
+ */
10556
+ cacheReserveEligible?: boolean;
10557
+ /**
10558
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10559
+ */
10560
+ respectStrongEtag?: boolean;
10561
+ /**
10562
+ * Whether to strip ETag headers from the origin response before caching.
10563
+ */
10564
+ stripEtags?: boolean;
10565
+ /**
10566
+ * Whether to strip Last-Modified headers from the origin response before caching.
10567
+ */
10568
+ stripLastModified?: boolean;
10569
+ /**
10570
+ * Whether to enable Cache Deception Armor, which protects against web cache
10571
+ * deception attacks by verifying the Content-Type matches the URL extension.
10572
+ */
10573
+ cacheDeceptionArmor?: boolean;
10574
+ /**
10575
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10576
+ */
10577
+ cacheReserveMinimumFileSize?: number;
9988
10578
  scrapeShield?: boolean;
9989
10579
  apps?: boolean;
9990
10580
  image?: RequestInitCfPropertiesImage;
@@ -11853,6 +12443,7 @@ export declare namespace CloudflareWorkersModule {
11853
12443
  constructor(ctx: ExecutionContext, env: Env);
11854
12444
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11855
12445
  fetch?(request: Request): Response | Promise<Response>;
12446
+ connect?(socket: Socket): void | Promise<void>;
11856
12447
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11857
12448
  scheduled?(controller: ScheduledController): void | Promise<void>;
11858
12449
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11873,6 +12464,7 @@ export declare namespace CloudflareWorkersModule {
11873
12464
  constructor(ctx: DurableObjectState, env: Env);
11874
12465
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11875
12466
  fetch?(request: Request): Response | Promise<Response>;
12467
+ connect?(socket: Socket): void | Promise<void>;
11876
12468
  webSocketMessage?(
11877
12469
  ws: WebSocket,
11878
12470
  message: string | ArrayBuffer,
@@ -12013,17 +12605,6 @@ export interface StreamBinding {
12013
12605
  * @returns A handle for per-video operations.
12014
12606
  */
12015
12607
  video(id: string): StreamVideoHandle;
12016
- /**
12017
- * Uploads a new video from a File.
12018
- * @param file The video file to upload.
12019
- * @returns The uploaded video details.
12020
- * @throws {BadRequestError} if the upload parameter is invalid
12021
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
12022
- * @throws {MaxFileSizeError} if the file size is too large
12023
- * @throws {RateLimitedError} if the server received too many requests
12024
- * @throws {InternalError} if an unexpected error occurs
12025
- */
12026
- upload(file: File): Promise<StreamVideo>;
12027
12608
  /**
12028
12609
  * Uploads a new video from a provided URL.
12029
12610
  * @param url The URL to upload from.
@@ -12873,6 +13454,9 @@ export declare namespace TailStream {
12873
13454
  readonly type: "fetch";
12874
13455
  readonly statusCode: number;
12875
13456
  }
13457
+ interface ConnectEventInfo {
13458
+ readonly type: "connect";
13459
+ }
12876
13460
  type EventOutcome =
12877
13461
  | "ok"
12878
13462
  | "canceled"
@@ -12903,6 +13487,7 @@ export declare namespace TailStream {
12903
13487
  readonly scriptVersion?: ScriptVersion;
12904
13488
  readonly info:
12905
13489
  | FetchEventInfo
13490
+ | ConnectEventInfo
12906
13491
  | JsRpcEventInfo
12907
13492
  | ScheduledEventInfo
12908
13493
  | AlarmEventInfo