## Execute AI model `ai.run(strmodel_name, AIRunParams**kwargs) -> AIRunResponse` **post** `/accounts/{account_id}/ai/run/{model_name}` This endpoint provides users with the capability to run specific AI models on-demand. By submitting the required input data, users can receive real-time predictions or results generated by the chosen AI model. The endpoint supports various AI model types, ensuring flexibility and adaptability for diverse use cases. Model specific inputs available in [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). ### Parameters - `account_id: str` - `model_name: str` - `text: str` The text that you want to classify ### Returns - `AIRunResponse` An array of classification results for the input text - `List[TextClassification]` An array of classification results for the input text - `label: Optional[str]` The classification label assigned to the text (e.g., 'POSITIVE' or 'NEGATIVE') - `score: Optional[float]` Confidence score indicating the likelihood that the text belongs to the specified label - `object` The generated image in PNG format - `class Audio: …` - `audio: Optional[str]` The generated audio in MP3 format, base64-encoded - `object` The generated audio in MP3 format - `class TextEmbeddings: …` - `data: Optional[List[List[float]]]` Embeddings of the requested text values - `shape: Optional[List[float]]` - `class AutomaticSpeechRecognition: …` - `text: str` The transcription - `vtt: Optional[str]` - `word_count: Optional[float]` - `words: Optional[List[AutomaticSpeechRecognitionWord]]` - `end: Optional[float]` The ending second when the word completes - `start: Optional[float]` The second this word begins in the recording - `word: Optional[str]` - `List[ImageClassification]` - `label: Optional[str]` The predicted category or class for the input image based on analysis - `score: Optional[float]` A confidence value, between 0 and 1, indicating how certain the model is about the predicted label - `List[ObjectDetection]` An array of detected objects within the input image - `box: Optional[ObjectDetectionBox]` Coordinates defining the bounding box around the detected object - `xmax: Optional[float]` The x-coordinate of the bottom-right corner of the bounding box - `xmin: Optional[float]` The x-coordinate of the top-left corner of the bounding box - `ymax: Optional[float]` The y-coordinate of the bottom-right corner of the bounding box - `ymin: Optional[float]` The y-coordinate of the top-left corner of the bounding box - `label: Optional[str]` The class label or name of the detected object - `score: Optional[float]` Confidence score indicating the likelihood that the detection is correct - `class UnionMember8: …` - `response: str` The generated text response from the model - `tool_calls: Optional[List[UnionMember8ToolCall]]` An array of tool calls requests made during the response generation - `arguments: Optional[object]` The arguments passed to be passed to the tool call request - `name: Optional[str]` The name of the tool to be called - `usage: Optional[UnionMember8Usage]` Usage statistics for the inference request - `completion_tokens: Optional[float]` Total number of tokens in output - `prompt_tokens: Optional[float]` Total number of tokens in input - `total_tokens: Optional[float]` Total number of input and output tokens - `object` - `class Translation: …` - `translated_text: Optional[str]` The translated text in the target language - `class Summarization: …` - `summary: Optional[str]` The summarized version of the input text - `class ImageToText: …` - `description: Optional[str]` - `class ImageTextToText: …` - `description: Optional[str]` - `class MultimodalEmbeddings: …` - `data: Optional[List[List[float]]]` - `shape: Optional[List[float]]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.ai.run( model_name="model_name", account_id="023e105f4ecef8ad9ca31a8372d0c353", text="x", ) print(response) ``` #### Response ```json { "result": [ { "label": "label", "score": 0 } ] } ```