RendShot

AI Render — Generate Images from a Prompt

Turn a natural-language prompt into a rendered image. No template required — or use a template as a visual style reference while AI handles the layout.

AI Render lets you skip the template-creation step entirely. Send a prompt, get an image back, and — if you want — save the AI-generated template for reuse.

Two Modes

1. Prompt only (zero-template)

Describe what you want. AI generates the HTML, RendShot renders it to an image.

terminal
rendshot generate --prompt "Xiaohongshu cover: coffee new release, warm tones, bold headline" \
  --platform xiaohongshu --save cover.png

Best for one-off images, AI agents that just need "a nice picture", and prototyping template ideas.

2. Prompt + template_id (style reference)

Pass both a prompt and an existing template_id. AI reads the template's HTML as a visual style reference and generates a new layout matching that style, filled with content from the prompt.

terminal
rendshot generate \
  --prompt "Product card: Ethiopian single-origin, ¥68" \
  --template tpl_abc123 \
  --save product.png

Best for keeping a brand style consistent across images whose content varies widely.

prompt + html is not allowed. Use one source of layout (template or AI), plus an optional prompt.

The Full Loop: Generate → Save → Reuse

The real power of AI Render is that the result round-trips back into a reusable template:

1. generate image from prompt  →  2. like it? save as template  →  3. reuse the template (fast, deterministic)

Every ai-render response includes the AI-generated html and variables alongside the image. You can hand them straight to POST /v1/templates (or rendshot template create) to persist the design, then call the standard POST /v1/image with that template_id for cheap, repeatable renders.

terminal
# One step: render AND save the template for later
rendshot generate \
  --prompt "Minimal weekly digest cover, dark green, serif headline" \
  --platform xiaohongshu \
  --save-as-template "Weekly Digest" \
  --save cover.png
# → ✓ Saved template: tpl_xyz789 ("Weekly Digest")
terminal
# Next week: reuse the saved template — no AI call, no AI cost
rendshot generate --template tpl_xyz789 \
  --var title="Week 14 Digest" \
  --save week14.png

Request Surface

JavaScript SDK

ai-render.ts
const result = await client.aiRender({
  prompt: 'Social card announcing a product launch, minimal layout',
  platform: 'twitter_card',       // optional preset for dimensions + style
  templateId: 'tpl_abc123',       // optional: use as style reference
  width: 1200,
  height: 630,
  format: 'png',
  locale: 'en',                    // 'zh' | 'en' — language of AI output
})

console.log(result.url)            // rendered image URL
console.log(result.html)           // AI-generated template HTML ({{var}} placeholders)
console.log(result.variables)      // AI-generated variable definitions

// Save it as a template
const tpl = await client.createTemplate({
  name: 'Launch Card',
  html: result.html,
  variables: result.variables,
  platform: 'twitter_card',
  width: result.width,
  height: result.height,
})

Python SDK

ai_render.py
result = client.ai_render(
    prompt="Xiaohongshu cover for a new coffee product",
    platform="xiaohongshu",
    locale="zh",
)

print(result.url)
print(result.html)
print(result.variables)

# Save as template
tpl = client.create_template(
    name="Coffee Cover",
    html=result.html,
    variables=result.variables,
    platform="xiaohongshu",
)

MCP (AI assistants)

Tell your AI assistant (Claude, Cursor, etc.) directly:

"Generate a Xiaohongshu cover image with the prompt: minimal latte art illustration, title '周三咖啡日记'. Save it as a template called 'Coffee Diary'."

Under the hood, the assistant calls generate_image with prompt + platform, followed by create_template with the returned HTML and variables.

Raw HTTP

terminal
curl -X POST https://api.rendshot.ai/v1/ai-render \
  -H "Authorization: Bearer rs_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Minimal product card for a premium coffee, warm cream background",
    "platform": "xiaohongshu",
    "locale": "en"
  }'

Response:

response.json
{
  "imageId": "img_abc123",
  "url": "https://assets.rendshot.ai/images/img_abc123.png",
  "width": 1080,
  "height": 1440,
  "format": "png",
  "size": 248193,
  "createdAt": "2026-04-10T12:00:00Z",
  "html": "<div class=\"cover\"><h1>{{title}}</h1>...</div>",
  "variables": [
    { "key": "title", "type": "text", "label": "Title", "default": "Premium Coffee" }
  ]
}

Parameters

NameTypeRequiredDescription
promptstringYesNatural language description, 1--2000 chars
platformstringNoPreset that sets default dimensions and influences AI layout style (e.g. xiaohongshu, instagram_post, twitter_card, og_image)
template_idstringNoExisting template ID (tpl_...) to use as a visual style reference
widthnumberNoOverride preset width, 1--4096
heightnumberNoOverride preset height, 1--4096
format'png' | 'jpg'NoOutput format
qualitynumberNoJPEG quality, 1--100
deviceScale1 | 2 | 3NoDevice pixel ratio
fontsstring[]NoGoogle Fonts to load
locale'zh' | 'en'NoLanguage of AI-generated text content
timeoutnumberNoAI + render timeout, 1000--55000 ms

Pricing & Quota

Each AI Render call counts as one request against your monthly quota — the same as a regular POST /v1/image call. There is no separate AI surcharge and no extra rate limit.

Tip: Once you're happy with an AI-generated design, save it as a template. Subsequent renders of that template go through the fast, deterministic path and do not invoke the AI — cheaper, faster, and identical output every time.

Supported Platform Presets

xiaohongshu (1080×1440), xiaohongshu_wide, instagram_post, instagram_story, twitter_card, twitter_post, wechat_cover, wechat_thumb, linkedin_post, youtube_thumb, og_image, custom.

Unknown platform names fall back to custom (1080×1080).

Errors

AI Render can return these additional error codes on top of the standard render errors:

CodeStatusMeaning
AI_TIMEOUT502AI generation did not finish within timeout
AI_NO_TOOL_CALL502AI responded but did not produce a template via tool call — retry usually succeeds
AI_INVALID_OUTPUT502AI produced malformed HTML or variables
AI_GATEWAY_ERROR500 / 502AI Gateway unavailable or not configured

All other error codes (VALIDATION_ERROR, QUOTA_EXCEEDED, RATE_LIMIT_EXCEEDED, SSRF_BLOCKED, etc.) behave exactly as documented on the API Reference.

Next Steps

On this page