Skip to main content

text_generation

Creates, updates, deletes, gets or lists a text_generation resource.

Overview

Nametext_generation
TypeResource
Idcloudflare.ai.text_generation

Supported models

Set model_name to one of the following models:

Text Generation (55 models)
@cf/aisingapore/gemma-sea-lion-v4-27b-it
@cf/deepseek-ai/deepseek-math-7b-instruct
@cf/deepseek-ai/deepseek-r1-distill-qwen-32b
@cf/defog/sqlcoder-7b-2
@cf/fblgit/una-cybertron-7b-v2-bf16
@cf/google/gemma-2b-it-lora
@cf/google/gemma-3-12b-it
@cf/google/gemma-7b-it-lora
@cf/ibm-granite/granite-4.0-h-micro
@cf/meta-llama/llama-2-7b-chat-hf-lora
@cf/meta/llama-2-7b-chat-fp16
@cf/meta/llama-2-7b-chat-int8
@cf/meta/llama-3-8b-instruct
@cf/meta/llama-3-8b-instruct-awq
@cf/meta/llama-3.1-70b-instruct-fp8-fast
@cf/meta/llama-3.1-8b-instruct-awq
@cf/meta/llama-3.1-8b-instruct-fp8
@cf/meta/llama-3.1-8b-instruct-fp8-fast
@cf/meta/llama-3.2-11b-vision-instruct
@cf/meta/llama-3.2-1b-instruct
@cf/meta/llama-3.2-3b-instruct
@cf/meta/llama-3.3-70b-instruct-fp8-fast
@cf/meta/llama-4-scout-17b-16e-instruct
@cf/meta/llama-guard-3-8b
@cf/microsoft/phi-2
@cf/mistral/mistral-7b-instruct-v0.1
@cf/mistral/mistral-7b-instruct-v0.2-lora
@cf/mistralai/mistral-small-3.1-24b-instruct
@cf/moonshotai/kimi-k2.5
@cf/nvidia/nemotron-3-120b-a12b
@cf/openai/gpt-oss-120b
@cf/openai/gpt-oss-20b
@cf/openchat/openchat-3.5-0106
@cf/qwen/qwen1.5-0.5b-chat
@cf/qwen/qwen1.5-1.8b-chat
@cf/qwen/qwen1.5-14b-chat-awq
@cf/qwen/qwen1.5-7b-chat-awq
@cf/qwen/qwen2.5-coder-32b-instruct
@cf/qwen/qwen3-30b-a3b-fp8
@cf/qwen/qwq-32b
@cf/thebloke/discolm-german-7b-v1-awq
@cf/tiiuae/falcon-7b-instruct
@cf/tinyllama/tinyllama-1.1b-chat-v1.0
@cf/zai-org/glm-4.7-flash
@hf/google/gemma-7b-it
@hf/mistral/mistral-7b-instruct-v0.2
@hf/nexusflow/starling-lm-7b-beta
@hf/nousresearch/hermes-2-pro-mistral-7b
@hf/thebloke/deepseek-coder-6.7b-base-awq
@hf/thebloke/deepseek-coder-6.7b-instruct-awq
@hf/thebloke/llama-2-13b-chat-awq
@hf/thebloke/mistral-7b-instruct-v0.1-awq
@hf/thebloke/neural-chat-7b-v3-1-awq
@hf/thebloke/openhermes-2.5-mistral-7b-awq
@hf/thebloke/zephyr-7b-beta-awq

Fields

The following fields are returned by SELECT queries:

Model response

NameDatatypeDescription
dataarrayEmbedding vectors, one per input text.
modelstringEcho of the model name, where reported.
poolingstringPooling method used (cls or mean), where applicable.
responsestringThe generated text response from the model.
shapearrayDimensions of the returned embedding matrix.
summarystringThe summarized text.
textstringThe transcribed text.
tool_callsarrayTool call requests emitted by the model, if tools were provided.
transcription_infoobjectModel/language detail, where reported.
translated_textstringThe translated text.
usageobjectToken usage counts (prompt_tokens, completion_tokens, total_tokens).
vttstringWebVTT formatted transcription, where reported.
word_countnumberNumber of words in the transcription, where reported.
wordsarrayPer-word timing detail, where reported.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
runselectaccount_id, model_nameThis 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.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
model_namestring

SELECT examples

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.

SELECT
response,
usage,
tool_calls
FROM cloudflare.ai.text_generation
WHERE account_id = '{{ account_id }}' -- required
AND model_name = '{{ model_name }}' -- required
AND prompt = '{{ prompt }}' -- model input
;