Skip to content
Agent Memory
Skill

/image-generation

Generate images from text prompts (and optionally edit/remix input images). Use when the user asks to create, generate, draw, render, or edit an image, illustration, logo, icon, diagram, slide, photo, animated GIF, or SVG.

From plugin
letta-code
3.8k26 skills8 hooks

Claude Code

$ npx -y skills add letta-ai/letta-code --skill image-generation --agent claude-code

SKILL.md

image-generation.SKILL.md
name: image-generation
description: Generate images from text prompts (and optionally edit/remix input images). Use when the user asks to create, generate, draw, render, or edit an image, illustration, logo, icon, diagram, slide, photo, animated GIF, or SVG.

Image Generation

Generate images via Letta's hosted endpoint `POST /v1/images/generations`. The API usually returns base64 image bytes, but some providers return signed image URLs; save either form to a local image file before replying.

Example

Generate the image, save it locally, then show it inline:

base_url="${LETTA_BASE_URL%/}"

curl -sS -X POST "$base_url/v1/images/generations" \
  -H "Authorization: Bearer $LETTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider":"gemini","prompt":"a friendly robot mascot waving, flat vector logo, mint green background","n":1}' \
  > image-response.json

python3 - <<'PY'
import base64, json, urllib.request

with open("image-response.json") as f:
    response = json.load(f)

image = response["images"][0]
if image.get("b64_json"):
    data = base64.b64decode(image["b64_json"])
else:
    data = urllib.request.urlopen(image["url"]).read()

with open("robot-mascot.png", "wb") as f:
    f.write(data)

print("saved robot-mascot.png")
PY

In Bash tools launched by Letta Code, use the runtime-provided `LETTA_BASE_URL` and `LETTA_API_KEY` together for Letta API calls. Build URLs relative to `${LETTA_BASE_URL%/}` and send `Authorization: Bearer $LETTA_API_KEY`. Do not hardcode `https://api.letta.com`: Desktop and remote runtimes may provide a proxy base URL, and the credential may only be valid through that URL. If either variable is missing, the user needs to authenticate with Letta Cloud (or provide a Letta API key); do **not** ask for an OpenAI/Gemini provider key. This endpoint also does not use `/connect` BYOK providers — the only `provider` values supported here are `flux`, `gemini`, and `openai`.

Then **show the image to the user** by embedding the saved file in your reply:

Here's the mascot:

![a friendly robot mascot waving, flat vector logo](./robot-mascot.png)

The Letta Code UI renders local file paths in markdown image tags, so the image appears inline. **Always display generated images this way** — don't just report the path, and never paste the raw base64 / a `data:` URI. The markdown path must match where you saved the file. For `n > 1`, save each image to its own file and embed each on its own line. Keep credit amounts and billing metadata out of user-facing replies and captions unless the user asks about cost. When asked, read `billing.credits_charged` from the saved response.

Request body

| Field | Type | Notes | |-------|------|-------| | `provider` | `"flux"` \| `"gemini"` \| `"openai"` | Required. | | `prompt` | string | Required, 1–32000 chars. | | `model` | string | Optional; defaults per provider (below). | | `n` | int 1–4 | Optional, default 1. Request variations in one call. | | `size` | string | Optional, e.g. `"1024x1024"` (OpenAI). | | `quality` | `low`\|`medium`\|`high`\|`xhigh`\|`max`\|`auto` | Optional (OpenAI; higher = more credits; `xhigh`/`max` need GPT Image 2.6). | | `background` | `auto`\|`opaque`\|`transparent` | Optional (OpenAI). Transparent works with png, webp and svg. | | `complexity` | `low`\|`medium`\|`high` | Optional (OpenAI GPT Image 2.6). How much the model plans before rendering; defaults to `high`. | | `output_format` | `png`\|`jpeg`\|`webp`\|`gif`\|`svg` | Optional (OpenAI). `gif` and `svg` need GPT Image 2.6; see below. | | `frame_count` / `frame_duration_ms` | int 2–16 / int 20–2000 | Optional, `gif` only. Defaults 9 frames, 200 ms. | | `svg` | `{ "model"?, "reasoning"?: { "effort" } }` | Optional, `svg` only. Model that writes the SVG: `gpt-6.1-terra` (default), `gpt-6.1-sol`, `gpt-6-luna` or `gpt-6-astra`. | | `input_images` | string[] (max 14) | Optional. Base64 **data URLs** for edit/remix. | | `markup_image` | string | Optional (OpenAI edits). Base64 data URL of a transparent annotation layer marking where to change the first input image. | | `seed` | int | Optional. |

| Provider | Default model | Use for | |----------|---------------|---------| | `flux` | `flux-2-pro` | Default for normal text-to-image. High-quality general image generation; commonly returns signed URLs. | | `gemini` | `gemini-3-pro-image` | Strong prompt adherence, image editing/remix. | | `openai` | `gpt-image-2.6-flare` | Photoreal output, explicit `size`/`quality`, animated GIFs, SVG vectors, markup-guided edits. Use `gpt-image-2.6-sunburst` for detailed work and consistency across edits. |

Default to `flux` for normal text-to-image requests. Use `gemini` when the user provides input images or wants image editing/remix. Use `openai` when the user wants photoreal output, a specific size/quality, an animated GIF, an SVG, or an edit guided by a marked-up region.

Response

{
  "provider": "gemini",
  "model": "gemini-3-pro-image",
  "images": [{ "b64_json": "<base64>", "mime_type": "image/png" }],
  "billing": { "credits_charged": 12, "...": "..." }
}

Each `images[]` entry has either `b64_json` or `url`, plus `mime_type`. Gemini always returns `b64_json`. Flux commonly returns a signed `url`; download it to your local image file immediately because signed URLs expire. If OpenAI returns a `url`, download that URL instead of base64-decoding.

Editing / remixing images

Pass source images in `input_images` as base64 **data URLs** (`data:<mime>;base64,<data>`) and describe the edit in `prompt`. Gemini handles multi-image edits well. To build a data URL from a local file:

DATA_URL="data:image/png;base64,$(base64 < input.png | tr -d '\n')"

Prompting (applies to every provider)

Write the prompt like a brief for the image you need, then inspect the result and refine one thing at a time.

1. **Define the result.** Name the subject and the intended use (product photo, ad, dia

Read more
@letta-ai
Ships withletta-code

Letta Code is a stateful agent harness for creating agents that are more like people than tools. Letta Code agents have memory, identity, and a sense of experience over time.

Stars on GitHub

Momentum

stars in total
3.8k
Star history of letta-ai/letta-code on GitHub, a chart by star-history.com

Other skills on letta-code.

acquiring-skills

acquiring-skills

Discover and install skills from Hermes, ClawHub, GitHub, and other registries. Load this skill whenever a user asks for a…

@letta-ai@letta-aiInstall Skill
browser-use

browser-use

Control a real browser to navigate pages, click, type, fill forms, inspect rendered UI, take screenshots, or record video. Load…

@letta-ai@letta-aiInstall Skill
context-doctor

context-doctor

Investigate and repair an agent's context — memory, system prompt, and skills — using observed behavior as evidence. Use when the…

@letta-ai@letta-aiInstall Skill
creating-mods

creating-mods

Creates and edits trusted local Letta Code mods, including tools, slash commands, local-only model providers, lifecycle/turn…

@letta-ai@letta-aiInstall Skill
creating-skills

creating-skills

Guide for creating effective skills. Use when creating a new skill or updating an existing one that extends Letta Code's…

@letta-ai@letta-aiInstall Skill
customizing-commands

customizing-commands

Creates, edits, and enables Letta Code mod-provided slash commands. Use when the user asks to add a custom /command, slash…

@letta-ai@letta-aiInstall Skill

More skills from other plugins.

agent-cost-report

agent-cost-report

Believable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude…

@thedotmack@thedotmackInstall Skill
bot-handoff

bot-handoff

Keep a durable record of work passed between Bots in the shared Hindsight memory bank. Use when handing work to another Bot, when…

@vectorize-io@vectorize-ioInstall Skill
mempalace

mempalace

Install, configure, and operate MemPalace, including a private local palace, a shared-brain hub, or a client joining an existing…

mempalace13d60k
@mempalace@mempalaceInstall Skill
mempalace

mempalace

Install, configure, and operate MemPalace, including a private local palace, a shared-brain hub, or a client joining an existing…

mempalace13d60k
@milla-jovovich@milla-jovovichInstall Skill

Questions about image-generation.

Which coding agents can use image-generation?
image-generation installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.