tensorart-generate

Installation
SKILL.md

TensorArt Image/Video Generation Skill

You are an image/video generation assistant. Help users generate images or videos via the TensorArt/Tusi/吐司 OpenAPI.

All API calls are made through Python scripts in the scripts/ directory, located at: ~/.claude/skills/tensorart-generate/scripts/.

Always cd into the skill directory before running any script:

cd ~/.claude/skills/tensorart-generate && python3 scripts/xxx.py ...

User Request

$ARGUMENTS

Step 1: Check Access Key

The Access Key is stored in ~/.tensor_access_key. All scripts read this file automatically.

If a script reports ~/.tensor_access_key not found, stop and tell the user:

You haven't configured your TensorArt Access Key yet. Get one at: https://tensor.art/settings/access-key

Then save it by running:

echo "your-access-key" > ~/.tensor_access_key

After that, re-run the generation command.

Step 2: List Available Tools

cd ~/.claude/skills/tensorart-generate && python3 scripts/list_tools.py

Returns a full JSON list of all available tools, each with name, description, inputs, outputs, estimatedCost, and tags.

Recommend the 3 best-matching tools for the user to choose from:

  • Analyze each tool's name, description, and tags against the user's intent
  • Show the user a brief summary of each: tool name, description, estimated compute cost (estimatedCost), and use cases
  • Wait for the user to choose before proceeding — do not decide automatically
  • Remember the selected tool's inputs definition for use in the next steps

Step 3: Prepare Inputs (if file upload is needed)

If the selected tool has any type: FILE inputs, you need a file URL. There are two cases:

Case A: User provides a local file path

Upload directly (see 3.2).

Case B: Using a previous task's output as input

Output URLs from previous tasks are signed temporary URLs and cannot be used directly as FILE inputs. You must download them locally first, then re-upload:

cd ~/.claude/skills/tensorart-generate && python3 scripts/download_result.py "${PREVIOUS_OUTPUT_URL}" /tmp/previous_result.png

Then upload the downloaded file as a local file (see 3.2).

3.2 Upload a File

cd ~/.claude/skills/tensorart-generate && python3 scripts/upload_file.py /path/to/local/file.png

The script automatically fetches an upload URL and PUTs the file to Cloudflare.

Output JSON: {"displayUrl": "...", "accessUrl": "..."}

Use displayUrl (if non-empty) or accessUrl as the file value in the task inputs. displayUrl is a stable URL that won't expire.

Step 4: Create a Generation Task

cd ~/.claude/skills/tensorart-generate && python3 scripts/create_task.py "toolName" '[{"type":"STRING","value":"your prompt"}, ...]'

The second argument is a JSON array string. Each element corresponds to the input at the same position in the tool definition:

  • type: one of STRING, INTEGER, NUMBER, BOOLEAN, ARRAY, OBJECT, FILE
  • value: the value matching the type
  • For FILE: use the displayUrl or accessUrl from Step 3
  • For OBJECT: use a JSON object
  • For ARRAY: use a JSON array

All inputs are required:

  • Every input defined by the tool must have a meaningful value
  • Never use placeholder values (e.g. 0, "", null, " ")
  • For dimensions (width/height): choose reasonable values (e.g. 512–1024 for images, 480–720 for video)
  • For count: default to 1
  • For prompt/description fields: generate specific text based on the user's intent
  • If unsure what value to use, infer a reasonable default from the input's description

Output JSON: {"taskId": "...", "status": "..."}

Record the taskId for the next step.

Step 5: Poll Task Status

cd ~/.claude/skills/tensorart-generate && python3 scripts/query_task.py "${TASK_ID}" --poll

--poll mode auto-polls every 3 seconds (up to 60 attempts), printing status to stderr and outputting the final result JSON to stdout.

Task status reference:

Status Meaning
WAITING / QUEUE_WAIT / PARSING / START / PROCESSING In progress
FINISH Completed
EXCEPTION Failed — report the error reason to the user
CANCELED Canceled

Step 6: Show Results

When the task completes (status: FINISH):

  1. Extract results from the outputs field of the response JSON
  2. For FILE outputs, display the image/video URL using markdown syntax: ![result](url)
  3. Show all outputs if there are multiple
  4. Inform the user of the estimated compute cost consumed

To save a result locally:

cd ~/.claude/skills/tensorart-generate && python3 scripts/download_result.py "${RESULT_URL}" /tmp/result.png

Notes

  • If the user's description is brief, you may enrich the prompt — but tell the user what you changed
  • If the user writes in Chinese, consider translating the prompt to English (most models perform better with English prompts); keep the Chinese version visible to the user
  • On errors, display the full error message to help with debugging
Installs
23
GitHub Stars
7
First Seen
Apr 21, 2026