# Tuzi Multimodel Image Generation

> Generate and save images through the Tuzi API with Seedream, GPT Image, Nano Banana/Gemini, or Flux Kontext. Use when an agent must perform text-to-image generation, choose among supported Tuzi image models, use Seedream or Flux reference images, control image size or aspect ratio, or return generated image files to the user.

- Skill: `jerry-george-liang/tuzi-multimodel-image-generation` (Agent Skill, multi-file: 8 files)
- Install (CLI): `npx skillmds@latest add jerry-george-liang/tuzi-multimodel-image-generation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jerry-george-liang/tuzi-multimodel-image-generation/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: Jerry-George-Liang (https://skillmd.com/u/jerry-george-liang)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/jerry-george-liang/tuzi-multimodel-image-generation

---


# Tuzi Multi-model Image Generation

Use the bundled Python script to call the synchronous Tuzi image endpoint and save the returned images locally.

## Security

- Prefer the standard `TUZI_API_KEY` environment variable.
- Allow a deployment to set `TUZI_API_KEY_ENV` to the name of its generated credential variable. If neither is set, allow exactly one injected `COZE_TUZI_API_*` variable.
- Allow `TUZI_API_KEY_FILE` only for a runtime-mounted secret file that is not bundled in the Skill.
- For a local Codex or desktop Agent, allow the user to run `scripts/configure_key.py` once. Store the Key in the current user's private configuration directory, never in the Skill directory.
- Never request that the user paste the key into chat, a prompt, or a command argument.
- Never print, log, or return the Key. Store it only in the current user's private credential location or the Agent platform's secret manager.
- If no credential is injected, stop and ask the user to configure it as a secret in the current Agent runtime. Never add a real key to a source file or ZIP.

## Workflow

1. Read [references/models.md](references/models.md) when selecting a model or using model-specific options. Read [references/runtime.md](references/runtime.md) when configuring credentials or diagnosing an Agent sandbox.
2. If a local desktop runtime reports that no Key exists, run the configuration script. Let the user type into the hidden GUI or terminal prompt; never ask them to send the Key in chat:

   ```bash
   python3 <skill-directory>/scripts/configure_key.py
   ```

   In a remote or deployed Agent, use the platform's secret credential UI instead.
3. Use the user's requested model when supported. Otherwise choose:
   - `seedream-5.0` for ordinary text-to-image generation.
   - `seedream-4.5` for multiple reference images.
   - `gpt-image-1` for quality, output format, or transparent-background controls.
   - `nano-banana-2` for Gemini/Nano Banana text-to-image generation.
   - `flux-kontext-pro` for one reference image, an explicit seed, or a native aspect ratio.
4. Run `scripts/generate_image.py`. Pass an absolute output directory when the runtime requires files in a specific workspace; otherwise let the script create a temporary directory.
5. Check the JSON result. Treat `code: 0` as success and use `saved_files` as the deliverables.
6. Return the saved images to the user. Do not claim success when no file was saved.

## Command

```bash
python3 <skill-directory>/scripts/generate_image.py \
  --prompt "一只蓝色兔子，白色背景，扁平插画" \
  --model seedream-5.0 \
  --size 2K
```

Common optional arguments:

```text
--aspect-ratio 16:9
--reference-image https://example.com/reference.png
--max-images 2
--watermark
--quality high
--output-format png
--background transparent
--seed 42
--output-dir /absolute/path/to/generated-images
```

Repeat `--reference-image` for multiple Seedream reference images. Do not pass both `--size` and `--aspect-ratio`.

## Failure handling

- Report the returned `msg` concisely when `code` is nonzero.
- Do not silently remove unsupported parameters; rerun only after selecting a compatible model or option.
- If outbound HTTPS or local script execution is unavailable, state that the runtime cannot execute this Skill and do not fabricate an image.
- A development sandbox may omit deployment credentials. Treat that as an unverified live path, not as an API failure; retry after deployment or with a locally configured secret.
- Do not substitute an arbitrary base URL or an unlisted model.

