@cloudflare/workers-types 4.20250913.0 → 4.20250918.0

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.
@@ -287,7 +287,6 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
287
287
  FixedLengthStream: typeof FixedLengthStream;
288
288
  IdentityTransformStream: typeof IdentityTransformStream;
289
289
  HTMLRewriter: typeof HTMLRewriter;
290
- Performance: typeof Performance;
291
290
  }
292
291
  declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
293
292
  type: Type,
@@ -444,6 +443,18 @@ declare abstract class PromiseRejectionEvent extends Event {
444
443
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
445
444
  readonly reason: any;
446
445
  }
446
+ /**
447
+ * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
448
+ * as well as timing of subrequests and other operations.
449
+ *
450
+ * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
451
+ */
452
+ interface Performance {
453
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
454
+ readonly timeOrigin: number;
455
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
456
+ now(): number;
457
+ }
447
458
  interface AlarmInvocationInfo {
448
459
  readonly isRetry: boolean;
449
460
  readonly retryCount: number;
@@ -3125,18 +3136,6 @@ interface WorkerLoaderWorkerCode {
3125
3136
  tails?: Fetcher[];
3126
3137
  streamingTails?: Fetcher[];
3127
3138
  }
3128
- /**
3129
- * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
3130
- * as well as timing of subrequests and other operations.
3131
- *
3132
- * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
3133
- */
3134
- declare abstract class Performance {
3135
- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
3136
- get timeOrigin(): number;
3137
- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3138
- now(): number;
3139
- }
3140
3139
  type AiImageClassificationInput = {
3141
3140
  image: number[];
3142
3141
  };
@@ -3191,6 +3190,18 @@ declare abstract class BaseAiImageTextToText {
3191
3190
  inputs: AiImageTextToTextInput;
3192
3191
  postProcessedOutputs: AiImageTextToTextOutput;
3193
3192
  }
3193
+ type AiMultimodalEmbeddingsInput = {
3194
+ image: string;
3195
+ text: string[];
3196
+ };
3197
+ type AiIMultimodalEmbeddingsOutput = {
3198
+ data: number[][];
3199
+ shape: number[];
3200
+ };
3201
+ declare abstract class BaseAiMultimodalEmbeddings {
3202
+ inputs: AiImageTextToTextInput;
3203
+ postProcessedOutputs: AiImageTextToTextOutput;
3204
+ }
3194
3205
  type AiObjectDetectionInput = {
3195
3206
  image: number[];
3196
3207
  };
@@ -3329,12 +3340,28 @@ type AiTextGenerationInput = {
3329
3340
  | (object & NonNullable<unknown>);
3330
3341
  functions?: AiTextGenerationFunctionsInput[];
3331
3342
  };
3343
+ type AiTextGenerationToolLegacyOutput = {
3344
+ name: string;
3345
+ arguments: unknown;
3346
+ };
3347
+ type AiTextGenerationToolOutput = {
3348
+ id: string;
3349
+ type: "function";
3350
+ function: {
3351
+ name: string;
3352
+ arguments: string;
3353
+ };
3354
+ };
3355
+ type UsageTags = {
3356
+ prompt_tokens: number;
3357
+ completion_tokens: number;
3358
+ total_tokens: number;
3359
+ };
3332
3360
  type AiTextGenerationOutput = {
3333
3361
  response?: string;
3334
- tool_calls?: {
3335
- name: string;
3336
- arguments: unknown;
3337
- }[];
3362
+ tool_calls?: AiTextGenerationToolLegacyOutput[] &
3363
+ AiTextGenerationToolOutput[];
3364
+ usage?: UsageTags;
3338
3365
  };
3339
3366
  declare abstract class BaseAiTextGeneration {
3340
3367
  inputs: AiTextGenerationInput;
@@ -4423,6 +4450,7 @@ type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output =
4423
4450
  name?: string;
4424
4451
  }[];
4425
4452
  }
4453
+ | string
4426
4454
  | AsyncResponse;
4427
4455
  declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {
4428
4456
  inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;
@@ -4499,7 +4527,6 @@ interface Ai_Cf_Baai_Bge_Reranker_Base_Input {
4499
4527
  /**
4500
4528
  * A query you wish to perform against the provided contexts.
4501
4529
  */
4502
- query: string;
4503
4530
  /**
4504
4531
  * Number of returned results starting with the best score.
4505
4532
  */
@@ -5592,7 +5619,8 @@ declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {
5592
5619
  }
5593
5620
  type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input =
5594
5621
  | Ai_Cf_Meta_Llama_4_Prompt
5595
- | Ai_Cf_Meta_Llama_4_Messages;
5622
+ | Ai_Cf_Meta_Llama_4_Messages
5623
+ | Ai_Cf_Meta_Llama_4_Async_Batch;
5596
5624
  interface Ai_Cf_Meta_Llama_4_Prompt {
5597
5625
  /**
5598
5626
  * The input text prompt for the model to generate a response.
@@ -5826,6 +5854,245 @@ interface Ai_Cf_Meta_Llama_4_Messages {
5826
5854
  */
5827
5855
  presence_penalty?: number;
5828
5856
  }
5857
+ interface Ai_Cf_Meta_Llama_4_Async_Batch {
5858
+ requests: (
5859
+ | Ai_Cf_Meta_Llama_4_Prompt_Inner
5860
+ | Ai_Cf_Meta_Llama_4_Messages_Inner
5861
+ )[];
5862
+ }
5863
+ interface Ai_Cf_Meta_Llama_4_Prompt_Inner {
5864
+ /**
5865
+ * The input text prompt for the model to generate a response.
5866
+ */
5867
+ prompt: string;
5868
+ /**
5869
+ * JSON schema that should be fulfilled for the response.
5870
+ */
5871
+ guided_json?: object;
5872
+ response_format?: JSONMode;
5873
+ /**
5874
+ * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
5875
+ */
5876
+ raw?: boolean;
5877
+ /**
5878
+ * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
5879
+ */
5880
+ stream?: boolean;
5881
+ /**
5882
+ * The maximum number of tokens to generate in the response.
5883
+ */
5884
+ max_tokens?: number;
5885
+ /**
5886
+ * Controls the randomness of the output; higher values produce more random results.
5887
+ */
5888
+ temperature?: number;
5889
+ /**
5890
+ * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
5891
+ */
5892
+ top_p?: number;
5893
+ /**
5894
+ * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
5895
+ */
5896
+ top_k?: number;
5897
+ /**
5898
+ * Random seed for reproducibility of the generation.
5899
+ */
5900
+ seed?: number;
5901
+ /**
5902
+ * Penalty for repeated tokens; higher values discourage repetition.
5903
+ */
5904
+ repetition_penalty?: number;
5905
+ /**
5906
+ * Decreases the likelihood of the model repeating the same lines verbatim.
5907
+ */
5908
+ frequency_penalty?: number;
5909
+ /**
5910
+ * Increases the likelihood of the model introducing new topics.
5911
+ */
5912
+ presence_penalty?: number;
5913
+ }
5914
+ interface Ai_Cf_Meta_Llama_4_Messages_Inner {
5915
+ /**
5916
+ * An array of message objects representing the conversation history.
5917
+ */
5918
+ messages: {
5919
+ /**
5920
+ * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5921
+ */
5922
+ role?: string;
5923
+ /**
5924
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5925
+ */
5926
+ tool_call_id?: string;
5927
+ content?:
5928
+ | string
5929
+ | {
5930
+ /**
5931
+ * Type of the content provided
5932
+ */
5933
+ type?: string;
5934
+ text?: string;
5935
+ image_url?: {
5936
+ /**
5937
+ * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
5938
+ */
5939
+ url?: string;
5940
+ };
5941
+ }[]
5942
+ | {
5943
+ /**
5944
+ * Type of the content provided
5945
+ */
5946
+ type?: string;
5947
+ text?: string;
5948
+ image_url?: {
5949
+ /**
5950
+ * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
5951
+ */
5952
+ url?: string;
5953
+ };
5954
+ };
5955
+ }[];
5956
+ functions?: {
5957
+ name: string;
5958
+ code: string;
5959
+ }[];
5960
+ /**
5961
+ * A list of tools available for the assistant to use.
5962
+ */
5963
+ tools?: (
5964
+ | {
5965
+ /**
5966
+ * The name of the tool. More descriptive the better.
5967
+ */
5968
+ name: string;
5969
+ /**
5970
+ * A brief description of what the tool does.
5971
+ */
5972
+ description: string;
5973
+ /**
5974
+ * Schema defining the parameters accepted by the tool.
5975
+ */
5976
+ parameters: {
5977
+ /**
5978
+ * The type of the parameters object (usually 'object').
5979
+ */
5980
+ type: string;
5981
+ /**
5982
+ * List of required parameter names.
5983
+ */
5984
+ required?: string[];
5985
+ /**
5986
+ * Definitions of each parameter.
5987
+ */
5988
+ properties: {
5989
+ [k: string]: {
5990
+ /**
5991
+ * The data type of the parameter.
5992
+ */
5993
+ type: string;
5994
+ /**
5995
+ * A description of the expected parameter.
5996
+ */
5997
+ description: string;
5998
+ };
5999
+ };
6000
+ };
6001
+ }
6002
+ | {
6003
+ /**
6004
+ * Specifies the type of tool (e.g., 'function').
6005
+ */
6006
+ type: string;
6007
+ /**
6008
+ * Details of the function tool.
6009
+ */
6010
+ function: {
6011
+ /**
6012
+ * The name of the function.
6013
+ */
6014
+ name: string;
6015
+ /**
6016
+ * A brief description of what the function does.
6017
+ */
6018
+ description: string;
6019
+ /**
6020
+ * Schema defining the parameters accepted by the function.
6021
+ */
6022
+ parameters: {
6023
+ /**
6024
+ * The type of the parameters object (usually 'object').
6025
+ */
6026
+ type: string;
6027
+ /**
6028
+ * List of required parameter names.
6029
+ */
6030
+ required?: string[];
6031
+ /**
6032
+ * Definitions of each parameter.
6033
+ */
6034
+ properties: {
6035
+ [k: string]: {
6036
+ /**
6037
+ * The data type of the parameter.
6038
+ */
6039
+ type: string;
6040
+ /**
6041
+ * A description of the expected parameter.
6042
+ */
6043
+ description: string;
6044
+ };
6045
+ };
6046
+ };
6047
+ };
6048
+ }
6049
+ )[];
6050
+ response_format?: JSONMode;
6051
+ /**
6052
+ * JSON schema that should be fufilled for the response.
6053
+ */
6054
+ guided_json?: object;
6055
+ /**
6056
+ * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
6057
+ */
6058
+ raw?: boolean;
6059
+ /**
6060
+ * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
6061
+ */
6062
+ stream?: boolean;
6063
+ /**
6064
+ * The maximum number of tokens to generate in the response.
6065
+ */
6066
+ max_tokens?: number;
6067
+ /**
6068
+ * Controls the randomness of the output; higher values produce more random results.
6069
+ */
6070
+ temperature?: number;
6071
+ /**
6072
+ * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
6073
+ */
6074
+ top_p?: number;
6075
+ /**
6076
+ * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
6077
+ */
6078
+ top_k?: number;
6079
+ /**
6080
+ * Random seed for reproducibility of the generation.
6081
+ */
6082
+ seed?: number;
6083
+ /**
6084
+ * Penalty for repeated tokens; higher values discourage repetition.
6085
+ */
6086
+ repetition_penalty?: number;
6087
+ /**
6088
+ * Decreases the likelihood of the model repeating the same lines verbatim.
6089
+ */
6090
+ frequency_penalty?: number;
6091
+ /**
6092
+ * Increases the likelihood of the model introducing new topics.
6093
+ */
6094
+ presence_penalty?: number;
6095
+ }
5829
6096
  type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {
5830
6097
  /**
5831
6098
  * The generated text response from the model
@@ -5879,6 +6146,443 @@ declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {
5879
6146
  inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;
5880
6147
  postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;
5881
6148
  }
6149
+ interface Ai_Cf_Deepgram_Nova_3_Input {
6150
+ audio: {
6151
+ body: object;
6152
+ contentType: string;
6153
+ };
6154
+ /**
6155
+ * Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param.
6156
+ */
6157
+ custom_topic_mode?: "extended" | "strict";
6158
+ /**
6159
+ * Custom topics you want the model to detect within your input audio or text if present Submit up to 100
6160
+ */
6161
+ custom_topic?: string;
6162
+ /**
6163
+ * Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param
6164
+ */
6165
+ custom_intent_mode?: "extended" | "strict";
6166
+ /**
6167
+ * Custom intents you want the model to detect within your input audio if present
6168
+ */
6169
+ custom_intent?: string;
6170
+ /**
6171
+ * Identifies and extracts key entities from content in submitted audio
6172
+ */
6173
+ detect_entities?: boolean;
6174
+ /**
6175
+ * Identifies the dominant language spoken in submitted audio
6176
+ */
6177
+ detect_language?: boolean;
6178
+ /**
6179
+ * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0
6180
+ */
6181
+ diarize?: boolean;
6182
+ /**
6183
+ * Identify and extract key entities from content in submitted audio
6184
+ */
6185
+ dictation?: boolean;
6186
+ /**
6187
+ * Specify the expected encoding of your submitted audio
6188
+ */
6189
+ encoding?:
6190
+ | "linear16"
6191
+ | "flac"
6192
+ | "mulaw"
6193
+ | "amr-nb"
6194
+ | "amr-wb"
6195
+ | "opus"
6196
+ | "speex"
6197
+ | "g729";
6198
+ /**
6199
+ * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing
6200
+ */
6201
+ extra?: string;
6202
+ /**
6203
+ * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'
6204
+ */
6205
+ filler_words?: boolean;
6206
+ /**
6207
+ * Key term prompting can boost or suppress specialized terminology and brands.
6208
+ */
6209
+ keyterm?: string;
6210
+ /**
6211
+ * Keywords can boost or suppress specialized terminology and brands.
6212
+ */
6213
+ keywords?: string;
6214
+ /**
6215
+ * The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available.
6216
+ */
6217
+ language?: string;
6218
+ /**
6219
+ * Spoken measurements will be converted to their corresponding abbreviations.
6220
+ */
6221
+ measurements?: boolean;
6222
+ /**
6223
+ * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip.
6224
+ */
6225
+ mip_opt_out?: boolean;
6226
+ /**
6227
+ * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio
6228
+ */
6229
+ mode?: "general" | "medical" | "finance";
6230
+ /**
6231
+ * Transcribe each audio channel independently.
6232
+ */
6233
+ multichannel?: boolean;
6234
+ /**
6235
+ * Numerals converts numbers from written format to numerical format.
6236
+ */
6237
+ numerals?: boolean;
6238
+ /**
6239
+ * Splits audio into paragraphs to improve transcript readability.
6240
+ */
6241
+ paragraphs?: boolean;
6242
+ /**
6243
+ * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.
6244
+ */
6245
+ profanity_filter?: boolean;
6246
+ /**
6247
+ * Add punctuation and capitalization to the transcript.
6248
+ */
6249
+ punctuate?: boolean;
6250
+ /**
6251
+ * Redaction removes sensitive information from your transcripts.
6252
+ */
6253
+ redact?: string;
6254
+ /**
6255
+ * Search for terms or phrases in submitted audio and replaces them.
6256
+ */
6257
+ replace?: string;
6258
+ /**
6259
+ * Search for terms or phrases in submitted audio.
6260
+ */
6261
+ search?: string;
6262
+ /**
6263
+ * Recognizes the sentiment throughout a transcript or text.
6264
+ */
6265
+ sentiment?: boolean;
6266
+ /**
6267
+ * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.
6268
+ */
6269
+ smart_format?: boolean;
6270
+ /**
6271
+ * Detect topics throughout a transcript or text.
6272
+ */
6273
+ topics?: boolean;
6274
+ /**
6275
+ * Segments speech into meaningful semantic units.
6276
+ */
6277
+ utterances?: boolean;
6278
+ /**
6279
+ * Seconds to wait before detecting a pause between words in submitted audio.
6280
+ */
6281
+ utt_split?: number;
6282
+ /**
6283
+ * The number of channels in the submitted audio
6284
+ */
6285
+ channels?: number;
6286
+ /**
6287
+ * Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets.
6288
+ */
6289
+ interim_results?: boolean;
6290
+ /**
6291
+ * Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing
6292
+ */
6293
+ endpointing?: string;
6294
+ /**
6295
+ * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.
6296
+ */
6297
+ vad_events?: boolean;
6298
+ /**
6299
+ * Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets.
6300
+ */
6301
+ utterance_end_ms?: boolean;
6302
+ }
6303
+ interface Ai_Cf_Deepgram_Nova_3_Output {
6304
+ results?: {
6305
+ channels?: {
6306
+ alternatives?: {
6307
+ confidence?: number;
6308
+ transcript?: string;
6309
+ words?: {
6310
+ confidence?: number;
6311
+ end?: number;
6312
+ start?: number;
6313
+ word?: string;
6314
+ }[];
6315
+ }[];
6316
+ }[];
6317
+ summary?: {
6318
+ result?: string;
6319
+ short?: string;
6320
+ };
6321
+ sentiments?: {
6322
+ segments?: {
6323
+ text?: string;
6324
+ start_word?: number;
6325
+ end_word?: number;
6326
+ sentiment?: string;
6327
+ sentiment_score?: number;
6328
+ }[];
6329
+ average?: {
6330
+ sentiment?: string;
6331
+ sentiment_score?: number;
6332
+ };
6333
+ };
6334
+ };
6335
+ }
6336
+ declare abstract class Base_Ai_Cf_Deepgram_Nova_3 {
6337
+ inputs: Ai_Cf_Deepgram_Nova_3_Input;
6338
+ postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;
6339
+ }
6340
+ type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input =
6341
+ | {
6342
+ /**
6343
+ * readable stream with audio data and content-type specified for that data
6344
+ */
6345
+ audio: {
6346
+ body: object;
6347
+ contentType: string;
6348
+ };
6349
+ /**
6350
+ * type of data PCM data that's sent to the inference server as raw array
6351
+ */
6352
+ dtype?: "uint8" | "float32" | "float64";
6353
+ }
6354
+ | {
6355
+ /**
6356
+ * base64 encoded audio data
6357
+ */
6358
+ audio: string;
6359
+ /**
6360
+ * type of data PCM data that's sent to the inference server as raw array
6361
+ */
6362
+ dtype?: "uint8" | "float32" | "float64";
6363
+ };
6364
+ interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {
6365
+ /**
6366
+ * if true, end-of-turn was detected
6367
+ */
6368
+ is_complete?: boolean;
6369
+ /**
6370
+ * probability of the end-of-turn detection
6371
+ */
6372
+ probability?: number;
6373
+ }
6374
+ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
6375
+ inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;
6376
+ postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
6377
+ }
6378
+ type Ai_Cf_Openai_Gpt_Oss_120B_Input =
6379
+ | GPT_OSS_120B_Responses
6380
+ | GPT_OSS_120B_Responses_Async;
6381
+ interface GPT_OSS_120B_Responses {
6382
+ /**
6383
+ * Responses API Input messages. Refer to OpenAI Responses API docs to learn more about supported content types
6384
+ */
6385
+ input: string | unknown[];
6386
+ reasoning?: {
6387
+ /**
6388
+ * Constrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
6389
+ */
6390
+ effort?: "low" | "medium" | "high";
6391
+ /**
6392
+ * A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.
6393
+ */
6394
+ summary?: "auto" | "concise" | "detailed";
6395
+ };
6396
+ }
6397
+ interface GPT_OSS_120B_Responses_Async {
6398
+ requests: {
6399
+ /**
6400
+ * Responses API Input messages. Refer to OpenAI Responses API docs to learn more about supported content types
6401
+ */
6402
+ input: string | unknown[];
6403
+ reasoning?: {
6404
+ /**
6405
+ * Constrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
6406
+ */
6407
+ effort?: "low" | "medium" | "high";
6408
+ /**
6409
+ * A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.
6410
+ */
6411
+ summary?: "auto" | "concise" | "detailed";
6412
+ };
6413
+ }[];
6414
+ }
6415
+ type Ai_Cf_Openai_Gpt_Oss_120B_Output = {} | (string & NonNullable<unknown>);
6416
+ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
6417
+ inputs: Ai_Cf_Openai_Gpt_Oss_120B_Input;
6418
+ postProcessedOutputs: Ai_Cf_Openai_Gpt_Oss_120B_Output;
6419
+ }
6420
+ type Ai_Cf_Openai_Gpt_Oss_20B_Input =
6421
+ | GPT_OSS_20B_Responses
6422
+ | GPT_OSS_20B_Responses_Async;
6423
+ interface GPT_OSS_20B_Responses {
6424
+ /**
6425
+ * Responses API Input messages. Refer to OpenAI Responses API docs to learn more about supported content types
6426
+ */
6427
+ input: string | unknown[];
6428
+ reasoning?: {
6429
+ /**
6430
+ * Constrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
6431
+ */
6432
+ effort?: "low" | "medium" | "high";
6433
+ /**
6434
+ * A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.
6435
+ */
6436
+ summary?: "auto" | "concise" | "detailed";
6437
+ };
6438
+ }
6439
+ interface GPT_OSS_20B_Responses_Async {
6440
+ requests: {
6441
+ /**
6442
+ * Responses API Input messages. Refer to OpenAI Responses API docs to learn more about supported content types
6443
+ */
6444
+ input: string | unknown[];
6445
+ reasoning?: {
6446
+ /**
6447
+ * Constrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
6448
+ */
6449
+ effort?: "low" | "medium" | "high";
6450
+ /**
6451
+ * A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of auto, concise, or detailed.
6452
+ */
6453
+ summary?: "auto" | "concise" | "detailed";
6454
+ };
6455
+ }[];
6456
+ }
6457
+ type Ai_Cf_Openai_Gpt_Oss_20B_Output = {} | (string & NonNullable<unknown>);
6458
+ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
6459
+ inputs: Ai_Cf_Openai_Gpt_Oss_20B_Input;
6460
+ postProcessedOutputs: Ai_Cf_Openai_Gpt_Oss_20B_Output;
6461
+ }
6462
+ interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
6463
+ /**
6464
+ * A text description of the image you want to generate.
6465
+ */
6466
+ prompt: string;
6467
+ /**
6468
+ * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt
6469
+ */
6470
+ guidance?: number;
6471
+ /**
6472
+ * Random seed for reproducibility of the image generation
6473
+ */
6474
+ seed?: number;
6475
+ /**
6476
+ * The height of the generated image in pixels
6477
+ */
6478
+ height?: number;
6479
+ /**
6480
+ * The width of the generated image in pixels
6481
+ */
6482
+ width?: number;
6483
+ /**
6484
+ * The number of diffusion steps; higher values can improve quality but take longer
6485
+ */
6486
+ num_steps?: number;
6487
+ /**
6488
+ * Specify what to exclude from the generated images
6489
+ */
6490
+ negative_prompt?: string;
6491
+ }
6492
+ /**
6493
+ * The generated image in JPEG format
6494
+ */
6495
+ type Ai_Cf_Leonardo_Phoenix_1_0_Output = string;
6496
+ declare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {
6497
+ inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;
6498
+ postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;
6499
+ }
6500
+ interface Ai_Cf_Leonardo_Lucid_Origin_Input {
6501
+ /**
6502
+ * A text description of the image you want to generate.
6503
+ */
6504
+ prompt: string;
6505
+ /**
6506
+ * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt
6507
+ */
6508
+ guidance?: number;
6509
+ /**
6510
+ * Random seed for reproducibility of the image generation
6511
+ */
6512
+ seed?: number;
6513
+ /**
6514
+ * The height of the generated image in pixels
6515
+ */
6516
+ height?: number;
6517
+ /**
6518
+ * The width of the generated image in pixels
6519
+ */
6520
+ width?: number;
6521
+ /**
6522
+ * The number of diffusion steps; higher values can improve quality but take longer
6523
+ */
6524
+ num_steps?: number;
6525
+ /**
6526
+ * The number of diffusion steps; higher values can improve quality but take longer
6527
+ */
6528
+ steps?: number;
6529
+ }
6530
+ interface Ai_Cf_Leonardo_Lucid_Origin_Output {
6531
+ /**
6532
+ * The generated image in Base64 format.
6533
+ */
6534
+ image?: string;
6535
+ }
6536
+ declare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {
6537
+ inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;
6538
+ postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;
6539
+ }
6540
+ interface Ai_Cf_Deepgram_Aura_1_Input {
6541
+ /**
6542
+ * Speaker used to produce the audio.
6543
+ */
6544
+ speaker?:
6545
+ | "angus"
6546
+ | "asteria"
6547
+ | "arcas"
6548
+ | "orion"
6549
+ | "orpheus"
6550
+ | "athena"
6551
+ | "luna"
6552
+ | "zeus"
6553
+ | "perseus"
6554
+ | "helios"
6555
+ | "hera"
6556
+ | "stella";
6557
+ /**
6558
+ * Encoding of the output audio.
6559
+ */
6560
+ encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
6561
+ /**
6562
+ * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
6563
+ */
6564
+ container?: "none" | "wav" | "ogg";
6565
+ /**
6566
+ * The text content to be converted to speech
6567
+ */
6568
+ text: string;
6569
+ /**
6570
+ * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable
6571
+ */
6572
+ sample_rate?: number;
6573
+ /**
6574
+ * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
6575
+ */
6576
+ bit_rate?: number;
6577
+ }
6578
+ /**
6579
+ * The generated audio in MP3 format
6580
+ */
6581
+ type Ai_Cf_Deepgram_Aura_1_Output = string;
6582
+ declare abstract class Base_Ai_Cf_Deepgram_Aura_1 {
6583
+ inputs: Ai_Cf_Deepgram_Aura_1_Input;
6584
+ postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;
6585
+ }
5882
6586
  interface AiModels {
5883
6587
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
5884
6588
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -5887,8 +6591,8 @@ interface AiModels {
5887
6591
  "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
5888
6592
  "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
5889
6593
  "@cf/myshell-ai/melotts": BaseAiTextToSpeech;
6594
+ "@cf/google/embeddinggemma-300m": BaseAiTextEmbeddings;
5890
6595
  "@cf/microsoft/resnet-50": BaseAiImageClassification;
5891
- "@cf/facebook/detr-resnet-50": BaseAiObjectDetection;
5892
6596
  "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
5893
6597
  "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
5894
6598
  "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
@@ -5923,7 +6627,6 @@ interface AiModels {
5923
6627
  "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
5924
6628
  "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
5925
6629
  "@hf/meta-llama/meta-llama-3-8b-instruct": BaseAiTextGeneration;
5926
- "@cf/meta/llama-3.1-8b-instruct": BaseAiTextGeneration;
5927
6630
  "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
5928
6631
  "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
5929
6632
  "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
@@ -5950,6 +6653,13 @@ interface AiModels {
5950
6653
  "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;
5951
6654
  "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It;
5952
6655
  "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;
6656
+ "@cf/deepgram/nova-3": Base_Ai_Cf_Deepgram_Nova_3;
6657
+ "@cf/pipecat-ai/smart-turn-v2": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;
6658
+ "@cf/openai/gpt-oss-120b": Base_Ai_Cf_Openai_Gpt_Oss_120B;
6659
+ "@cf/openai/gpt-oss-20b": Base_Ai_Cf_Openai_Gpt_Oss_20B;
6660
+ "@cf/leonardo/phoenix-1.0": Base_Ai_Cf_Leonardo_Phoenix_1_0;
6661
+ "@cf/leonardo/lucid-origin": Base_Ai_Cf_Leonardo_Lucid_Origin;
6662
+ "@cf/deepgram/aura-1": Base_Ai_Cf_Deepgram_Aura_1;
5953
6663
  }
5954
6664
  type AiOptions = {
5955
6665
  /**
@@ -5957,6 +6667,10 @@ type AiOptions = {
5957
6667
  * https://developers.cloudflare.com/workers-ai/features/batch-api
5958
6668
  */
5959
6669
  queueRequest?: boolean;
6670
+ /**
6671
+ * Establish websocket connections, only works for supported models
6672
+ */
6673
+ websocket?: boolean;
5960
6674
  gateway?: GatewayOptions;
5961
6675
  returnRawResponse?: boolean;
5962
6676
  prefix?: string;
@@ -6000,7 +6714,7 @@ type AiModelListType = Record<string, any>;
6000
6714
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
6001
6715
  aiGatewayLogId: string | null;
6002
6716
  gateway(gatewayId: string): AiGateway;
6003
- autorag(autoragId?: string): AutoRAG;
6717
+ autorag(autoragId: string): AutoRAG;
6004
6718
  run<
6005
6719
  Name extends keyof AiModelList,
6006
6720
  Options extends AiOptions,
@@ -6010,9 +6724,13 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
6010
6724
  inputs: InputOptions,
6011
6725
  options?: Options,
6012
6726
  ): Promise<
6013
- Options extends {
6014
- returnRawResponse: true;
6015
- }
6727
+ Options extends
6728
+ | {
6729
+ returnRawResponse: true;
6730
+ }
6731
+ | {
6732
+ websocket: true;
6733
+ }
6016
6734
  ? Response
6017
6735
  : InputOptions extends {
6018
6736
  stream: true;