run
Creates, updates, deletes, gets or lists a run resource.
Overview
| Name | run |
| Type | Resource |
| Id | cloudflare.ai.run |
Fields
The following fields are returned by SELECT queries:
SELECT not supported for this resource, use SHOW METHODS to view available operations for the resource.
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
run | insert | account_id, 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. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
model_name | string |
INSERT examples
- run
- Manifest
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.
INSERT INTO cloudflare.ai.run (
text,
guidance,
height,
image,
image_b64,
mask,
negative_prompt,
num_steps,
prompt,
seed,
strength,
width,
lang,
audio,
source_lang,
target_lang,
frequency_penalty,
lora,
max_tokens,
presence_penalty,
raw,
repetition_penalty,
response_format,
stream,
temperature,
top_k,
top_p,
functions,
messages,
tools,
input_text,
max_length,
ignore_eos,
account_id,
model_name
)
SELECT
'{{ text }}',
{{ guidance }},
{{ height }},
'{{ image }}',
'{{ image_b64 }}',
'{{ mask }}',
'{{ negative_prompt }}',
{{ num_steps }},
'{{ prompt }}',
{{ seed }},
{{ strength }},
{{ width }},
'{{ lang }}',
'{{ audio }}',
'{{ source_lang }}',
'{{ target_lang }}',
{{ frequency_penalty }},
'{{ lora }}',
{{ max_tokens }},
{{ presence_penalty }},
{{ raw }},
{{ repetition_penalty }},
'{{ response_format }}',
{{ stream }},
{{ temperature }},
{{ top_k }},
{{ top_p }},
'{{ functions }}',
'{{ messages }}',
'{{ tools }}',
'{{ input_text }}',
{{ max_length }},
{{ ignore_eos }},
'{{ account_id }}',
'{{ model_name }}'
RETURNING
result
;
# Description fields are for documentation purposes
- name: run
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the run resource.
- name: model_name
value: "{{ model_name }}"
description: Required parameter for the run resource.
- name: text
value: "{{ text }}"
description: |
The text that you want to classify
- name: guidance
value: {{ guidance }}
description: |
Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt
default: 7.5
- name: height
value: {{ height }}
description: |
The height of the generated image in pixels
- name: image
value:
- {{ image }}
description: |
For use with img2img tasks. An array of integers that represent the image data constrained to 8-bit unsigned integer values
- name: image_b64
value: "{{ image_b64 }}"
description: |
For use with img2img tasks. A base64-encoded string of the input image
- name: mask
value:
- {{ mask }}
description: |
An array representing An array of integers that represent mask image data for inpainting constrained to 8-bit unsigned integer values
- name: negative_prompt
value: "{{ negative_prompt }}"
description: |
Text describing elements to avoid in the generated image
- name: num_steps
value: {{ num_steps }}
description: |
The number of diffusion steps; higher values can improve quality but take longer
default: 20
- name: prompt
value: "{{ prompt }}"
description: |
A text description of the image you want to generate
- name: seed
value: {{ seed }}
description: |
Random seed for reproducibility of the image generation
- name: strength
value: {{ strength }}
description: |
A value between 0 and 1 indicating how strongly to apply the transformation during img2img tasks; lower values make the output closer to the input image
default: 1
- name: width
value: {{ width }}
description: |
The width of the generated image in pixels
- name: lang
value: "{{ lang }}"
description: |
The speech language (e.g., 'en' for English, 'fr' for French). Defaults to 'en' if not specified
default: en
- name: audio
value:
- {{ audio }}
description: |
An array of integers that represent the audio data constrained to 8-bit unsigned integer values
- name: source_lang
value: "{{ source_lang }}"
description: |
The language of the recorded audio
- name: target_lang
value: "{{ target_lang }}"
description: |
The language to translate the transcription into. Currently only English is supported.
- name: frequency_penalty
value: {{ frequency_penalty }}
description: |
Decreases the likelihood of the model repeating the same lines verbatim.
- name: lora
value: "{{ lora }}"
description: |
Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
- name: max_tokens
value: {{ max_tokens }}
description: |
The maximum number of tokens to generate in the response.
default: 256
- name: presence_penalty
value: {{ presence_penalty }}
description: |
Increases the likelihood of the model introducing new topics.
- name: raw
value: {{ raw }}
description: |
If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
default: false
- name: repetition_penalty
value: {{ repetition_penalty }}
description: |
Penalty for repeated tokens; higher values discourage repetition.
- name: response_format
value:
json_schema: "{{ json_schema }}"
type: "{{ type }}"
- name: stream
value: {{ stream }}
description: |
If true, the response will be streamed back incrementally using SSE, Server Sent Events.
default: false
- name: temperature
value: {{ temperature }}
description: |
Controls the randomness of the output; higher values produce more random results.
default: 0.6
- name: top_k
value: {{ top_k }}
description: |
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.
- name: top_p
value: {{ top_p }}
description: |
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.
- name: functions
value:
- code: "{{ code }}"
name: "{{ name }}"
- name: messages
description: |
An array of message objects representing the conversation history.
value:
- content: "{{ content }}"
role: "{{ role }}"
- name: tools
description: |
A list of tools available for the assistant to use.
value:
- description: "{{ description }}"
name: "{{ name }}"
parameters:
properties: "{{ properties }}"
required:
- "{{ required }}"
type: "{{ type }}"
function:
description: "{{ description }}"
name: "{{ name }}"
parameters:
properties: "{{ properties }}"
required:
- "{{ required }}"
type: "{{ type }}"
type: "{{ type }}"
- name: input_text
value: "{{ input_text }}"
description: |
The text that you want the model to summarize
- name: max_length
value: {{ max_length }}
description: |
The maximum length of the generated summary in tokens
default: 1024
- name: ignore_eos
value: {{ ignore_eos }}
description: |
Whether to ignore the EOS token and continue generating tokens after the EOS token is generated.