Cloudflare Docs
Workers AI
Edit this page on GitHub
Set theme to dark (⇧+D)

dreamshaper-8-lcm

Beta

Model ID: @cf/lykon/dreamshaper-8-lcm

Stable Diffusion model that has been fine-tuned to be better at photorealism without sacrificing range.

More Information  

​​ Properties

Task Type: Text-to-Image

​​ Code Examples

Workers - TypeScript
import { Ai } from "@cloudflare/ai";
export interface Env {
AI: Ai;
}
export default {
async fetch(request: Request, env: Env) {
const ai = new Ai(env.AI);
const inputs = {
prompt: "cyberpunk cat",
};
const response = await ai.run(
"@cf/lykon/dreamshaper-8-lcm",
inputs
);
return new Response(response, {
headers: {
"content-type": "image/png",
},
});
},
};
curl
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/@cf/lykon/dreamshaper-8-lcm \
-X POST \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{ "prompt": "cyberpunk cat" }'

​​ Response

The response is a binary PNG file.

​​ API Schema

The following schema is based on JSON Schema

Input JSON Schema
{
"type": "object",
"properties": {
"prompt": {
"type": "string"
},
"image": {
"oneOf": [
{
"type": "string",
"format": "binary"
},
{
"type": "object",
"properties": {
"image": {
"type": "array",
"items": {
"type": "number"
}
}
}
}
]
},
"mask": {
"oneOf": [
{
"type": "string",
"format": "binary"
},
{
"type": "object",
"properties": {
"mask": {
"type": "array",
"items": {
"type": "number"
}
}
}
}
]
},
"num_steps": {
"type": "integer",
"default": 20,
"maximum": 20
},
"strength": {
"type": "number",
"default": 1
},
"guidance": {
"type": "number",
"default": 7.5
}
},
"required": [
"prompt"
]
}
Output JSON Schema
{
"type": "string",
"contentType": "image/png",
"format": "binary"
}