Skip to main content

text_to_image

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

Overview

Nametext_to_image
TypeResource
Idcloudflare.ai.text_to_image

Supported models

Set model_name to one of the following models:

Text to Image (11 models)
@cf/black-forest-labs/flux-1-schnell
@cf/black-forest-labs/flux-2-dev
@cf/black-forest-labs/flux-2-klein-4b
@cf/black-forest-labs/flux-2-klein-9b
@cf/bytedance/stable-diffusion-xl-lightning
@cf/leonardo/lucid-origin
@cf/leonardo/phoenix-1.0
@cf/lykon/dreamshaper-8-lcm
@cf/runwayml/stable-diffusion-v1-5-img2img
@cf/runwayml/stable-diffusion-v1-5-inpainting
@cf/stabilityai/stable-diffusion-xl-base-1.0

Fields

The following fields are returned by SELECT queries:

Model response

NameDatatypeDescription
contentsstringRaw response payload (binary or non-object results), used by contents-mode families.
errorsarray
messagesarray
resultobject
successboolean

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
contents
FROM cloudflare.ai.text_to_image
WHERE account_id = '{{ account_id }}' -- required
AND model_name = '{{ model_name }}' -- required
AND prompt = '{{ prompt }}' -- model input
;