---
title: AI
---

[Skip to content](#%5Ftop) 

[API Reference](https://developers.cloudflare.com/api/typescript)

Copy Markdown

Open in **Claude**

Open in **ChatGPT**

Open in **Cursor**

---

**Copy Markdown**

**View as Markdown**

# AI

##### [Execute AI model](https://developers.cloudflare.com/api/typescript/resources/ai/methods/run)

client.ai.run(stringmodelName, AIRunParamsparams, RequestOptionsoptions?): [AIRunResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai%20%3E%20%28model%29%20ai%5Frun%5Fresponse%20%3E%20%28schema%29)

POST/accounts/{account\_id}/ai/run/{model\_name}

##### ModelsExpand Collapse 

AIRunResponse \= Array<TextClassification\> | Uploadable | Audio { audio } | 12 more

An array of classification results for the input text

One of the following:

Array<TextClassification\>

label?: string

The classification label assigned to the text (e.g., ‘POSITIVE’ or ‘NEGATIVE’)

score?: number

Confidence score indicating the likelihood that the text belongs to the specified label

Uploadable

Audio { audio } 

audio?: string

The generated audio in MP3 format, base64-encoded

Uploadable

TextEmbeddings { data, shape } 

data?: Array<Array<number\>\>

Embeddings of the requested text values

shape?: Array<number\>

AutomaticSpeechRecognition { text, vtt, word\_count, words } 

text: string

The transcription

vtt?: string

word\_count?: number

words?: Array<Word\>

end?: number

The ending second when the word completes

start?: number

The second this word begins in the recording

word?: string

Array<ImageClassification\>

label?: string

The predicted category or class for the input image based on analysis

score?: number

A confidence value, between 0 and 1, indicating how certain the model is about the predicted label

Array<ObjectDetection\>

box?: Box { xmax, xmin, ymax, ymin } 

Coordinates defining the bounding box around the detected object

xmax?: number

The x-coordinate of the bottom-right corner of the bounding box

xmin?: number

The x-coordinate of the top-left corner of the bounding box

ymax?: number

The y-coordinate of the bottom-right corner of the bounding box

ymin?: number

The y-coordinate of the top-left corner of the bounding box

label?: string

The class label or name of the detected object

score?: number

Confidence score indicating the likelihood that the detection is correct

UnionMember8 { response, tool\_calls, usage } 

response: string

The generated text response from the model

tool\_calls?: Array<ToolCall\>

An array of tool calls requests made during the response generation

arguments?: unknown

The arguments passed to be passed to the tool call request

name?: string

The name of the tool to be called

usage?: Usage { completion\_tokens, prompt\_tokens, total\_tokens } 

Usage statistics for the inference request

completion\_tokens?: number

Total number of tokens in output

prompt\_tokens?: number

Total number of tokens in input

total\_tokens?: number

Total number of input and output tokens

Uploadable

Translation { translated\_text } 

translated\_text?: string

The translated text in the target language

Summarization { summary } 

summary?: string

The summarized version of the input text

ImageToText { description } 

description?: string

ImageTextToText { description } 

description?: string

MultimodalEmbeddings { data, shape } 

data?: Array<Array<number\>\>

shape?: Array<number\>

#### AIFinetunes

##### [List Finetunes](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/finetunes/methods/list)

client.ai.finetunes.list(FinetuneListParams { account\_id } params, RequestOptionsoptions?): [FinetuneListResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.finetunes%20%3E%20%28model%29%20finetune%5Flist%5Fresponse%20%3E%20%28schema%29) { id, created\_at, model, 3 more } 

GET/accounts/{account\_id}/ai/finetunes

##### [Create a new Finetune](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/finetunes/methods/create)

client.ai.finetunes.create(FinetuneCreateParams { account\_id, model, name, 2 more } params, RequestOptionsoptions?): [FinetuneCreateResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.finetunes%20%3E%20%28model%29%20finetune%5Fcreate%5Fresponse%20%3E%20%28schema%29) { id, created\_at, model, 4 more } 

POST/accounts/{account\_id}/ai/finetunes

##### ModelsExpand Collapse 

FinetuneListResponse { id, created\_at, model, 3 more } 

id: string

formatuuid

created\_at: string

formatdate-time

model: string

modified\_at: string

formatdate-time

name: string

description?: string

FinetuneCreateResponse { id, created\_at, model, 4 more } 

id: string

formatuuid

created\_at: string

formatdate-time

model: string

modified\_at: string

formatdate-time

name: string

public: boolean

description?: string

#### AIFinetunesAssets

##### [Upload a Finetune Asset](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/finetunes/subresources/assets/methods/create)

client.ai.finetunes.assets.create(stringfinetuneID, AssetCreateParams { account\_id, file, file\_name } params, RequestOptionsoptions?): [AssetCreateResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.finetunes.assets%20%3E%20%28model%29%20asset%5Fcreate%5Fresponse%20%3E%20%28schema%29) { success } 

POST/accounts/{account\_id}/ai/finetunes/{finetune\_id}/finetune-assets

##### ModelsExpand Collapse 

AssetCreateResponse { success } 

success: boolean

#### AIFinetunesPublic

##### [List Public Finetunes](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/finetunes/subresources/public/methods/list)

client.ai.finetunes.public.list(PublicListParams { account\_id, limit, offset, orderBy } params, RequestOptionsoptions?): SinglePage<[PublicListResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.finetunes.public%20%3E%20%28model%29%20public%5Flist%5Fresponse%20%3E%20%28schema%29) { id, created\_at, model, 4 more } \>

GET/accounts/{account\_id}/ai/finetunes/public

##### ModelsExpand Collapse 

PublicListResponse { id, created\_at, model, 4 more } 

id: string

formatuuid

created\_at: string

formatdate-time

model: string

modified\_at: string

formatdate-time

name: string

public: boolean

description?: string

#### AIAuthors

##### [Author Search](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/authors/methods/list)

client.ai.authors.list(AuthorListParams { account\_id } params, RequestOptionsoptions?): SinglePage<[AuthorListResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.authors%20%3E%20%28model%29%20author%5Flist%5Fresponse%20%3E%20%28schema%29)\>

GET/accounts/{account\_id}/ai/authors/search

##### ModelsExpand Collapse 

AuthorListResponse \= unknown

#### AITasks

##### [Task Search](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/tasks/methods/list)

client.ai.tasks.list(TaskListParams { account\_id } params, RequestOptionsoptions?): SinglePage<[TaskListResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.tasks%20%3E%20%28model%29%20task%5Flist%5Fresponse%20%3E%20%28schema%29)\>

GET/accounts/{account\_id}/ai/tasks/search

##### ModelsExpand Collapse 

TaskListResponse \= unknown

#### AIModels

##### [Model Search](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/models/methods/list)

client.ai.models.list(ModelListParams { account\_id, author, format, 7 more } params, RequestOptionsoptions?): V4PagePaginationArray<[ModelListResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.models%20%3E%20%28model%29%20model%5Flist%5Fresponse%20%3E%20%28schema%29)\>

GET/accounts/{account\_id}/ai/models/search

##### ModelsExpand Collapse 

ModelListResponse \= unknown

#### AIModelsSchema

##### [Get Model Schema](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/models/subresources/schema/methods/get)

client.ai.models.schema.get(SchemaGetParams { account\_id, model } params, RequestOptionsoptions?): [SchemaGetResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.models.schema%20%3E%20%28model%29%20schema%5Fget%5Fresponse%20%3E%20%28schema%29) { input, output } 

GET/accounts/{account\_id}/ai/models/schema

##### ModelsExpand Collapse 

SchemaGetResponse { input, output } 

input: Input { additionalProperties, description, type } 

additionalProperties: boolean

description: string

type: string

output: Output { additionalProperties, description, type } 

additionalProperties: boolean

description: string

type: string

#### AITo Markdown

##### [Convert Files into Markdown](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/to%5Fmarkdown/methods/transform)

client.ai.toMarkdown.transform(ToMarkdownTransformParams { account\_id, file } params, RequestOptionsoptions?): SinglePage<[ToMarkdownTransformResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.to%5Fmarkdown%20%3E%20%28model%29%20to%5Fmarkdown%5Ftransform%5Fresponse%20%3E%20%28schema%29) { data, format, mimeType, 2 more } \>

POST/accounts/{account\_id}/ai/tomarkdown

##### [Get all converted formats supported](https://developers.cloudflare.com/api/typescript/resources/ai/subresources/to%5Fmarkdown/methods/supported)

client.ai.toMarkdown.supported(ToMarkdownSupportedParams { account\_id } params, RequestOptionsoptions?): SinglePage<[ToMarkdownSupportedResponse](https://developers.cloudflare.com/api/typescript/resources/ai#%28resource%29%20ai.to%5Fmarkdown%20%3E%20%28model%29%20to%5Fmarkdown%5Fsupported%5Fresponse%20%3E%20%28schema%29) { extension, mimeType } \>

GET/accounts/{account\_id}/ai/tomarkdown/supported

##### ModelsExpand Collapse 

ToMarkdownTransformResponse { data, format, mimeType, 2 more } 

data: string

format: string

mimeType: string

name: string

tokens: string

ToMarkdownSupportedResponse { extension, mimeType } 

extension: string

mimeType: string