fotor-skills
Original:🇺🇸 English
Translated
4 scripts
Use when the user's intent is visual and the task can be solved with Fotor OpenAPI image or video generation, editing, transformation, enhancement, batch output, or account credit lookup, including product photos, marketing creatives, posters,banners, social covers, background changes, upscaling, restoration, and other image- or video-related asset workflows.
17installs
Sourcefotor-ai/fotor-skills
Added on
NPX Install
npx skill4agent add fotor-ai/fotor-skills fotor-skillsTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →fotor-skills
Async-first Python SDK for the Fotor OpenAPI. No MCP -- just an API key.
Use as the skill's bootstrap layer. Prefer a skill-local Python 3.12 environment and run bundled scripts from that local environment instead of the system Python.
uvSetup
Keep setup lightweight and local to the skill directory.
Install first if it is missing:
uvbash
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"Typical first-run setup:
bash
uv python install 3.12
uv venv --python 3.12 .venv
./.venv/bin/python scripts/ensure_sdk.pySetup rules:
- Prefer a local Python 3.12 environment in the skill directory.
- Use to prepare Python 3.12 and create
uvwhen the local environment is missing..venv - Run bundled scripts from the local skill environment, not the system Python.
- Ensure is set. If key setup is missing and the user is not technical, read
FOTOR_OPENAPI_KEYand prefer the localreferences/configure-fotor-openapi-key.mdhappy path..env
Current default interpreter paths:
- POSIX:
./.venv/bin/python - Windows:
.venv\\Scripts\\python.exe
Interaction Rules
- Speak in user-task language first. Do not lead with SDK, scripts, JSON, model IDs, or parameter tables unless they are needed to unblock the task or the user explicitly asks.
- Ask for only one missing blocker at a time.
- Once the minimum required information is present, execute immediately. Do not send vague transition messages like "I’m starting now" unless execution has actually started and a result or clear in-progress status will follow.
- If execution will take noticeable time, say that the task is running and give a short expectation such as "usually takes a few seconds to a few dozen seconds; I’ll send the result when it’s ready."
- If credentials are missing, resolve that blocker quickly and then return to the original task instead of turning the conversation into a long setup lesson.
- When the local skill environment is missing, prepare it with before installing dependencies or executing the task. Avoid installing into the system Python unless the user explicitly asks.
uv - Choose the model and default parameters internally unless the user explicitly requests a specific model or technical control.
- Return the result as soon as it is ready. Do not make the user ask follow-up questions like "where is the image?"
- If an update reminder is available, keep it to one short non-blocking sentence and continue the current task.
Scripts
scripts/ensure_sdk.py
scripts/ensure_sdk.pyCross-platform (Windows / macOS / Linux) script to install or upgrade to the latest PyPI release with . Run before every task.
fotor-sdkuv pip install --python <interpreter>- No args — install or upgrade to the latest PyPI release
- — same behavior, kept as an explicit alias
--upgrade
scripts/run_task.py
scripts/run_task.pyExecute one or more Fotor tasks from JSON. Handles client init, polling, and progress.
Single task:
bash
echo '{"task_type":"text2image","params":{"prompt":"A cat","model_id":"seedream-4-5-251128"}}' \
| ./.venv/bin/python scripts/run_task.pyBatch (array):
bash
echo '[
{"task_type":"text2image","params":{"prompt":"A cat","model_id":"seedream-4-5-251128"},"tag":"cat"},
{"task_type":"text2video","params":{"prompt":"Sunset","model_id":"kling-v3","duration":5},"tag":"sunset"}
]' | ./.venv/bin/python scripts/run_task.py --concurrency 5Options: , (default 5), (default 2.0), (default 1200).
--input FILE--concurrency N--poll-interval S--timeout SOutput: JSON with , , , , , , , .
task_idstatussuccessresult_urlerrorelapsed_secondscreditsIncrementtagAutomatic fallback:
- If a task fails on its primary model and the current matches a built-in fallback mapping,
task_type + model_idautomatically retries once with the fallback model.run_task.py - The output includes ,
fallback_used, andoriginal_model_id.fallback_model_id
scripts/upload_image.py
scripts/upload_image.pyUpload a local image file through Fotor's signed upload flow and return a reusable image URL.
bash
./.venv/bin/python scripts/upload_image.py ./input.jpg --task-type image2imageThe script:
- Calls with the mapped upload
/v1/upload/signandtypesuffix - Uploads the local file to the signed target
- Prints JSON containing and
file_urlupload_url
Use as the , , , or an item inside for image-based tasks.
file_urlimage_urlstart_image_urlend_image_urlimage_urlsSupported task-to-upload mapping:
- ->
image2imageimg2img - ->
image_upscaleimg_upscale - ->
background_removebg_remove - ->
single_image2videoimg2video - ->
start_end_frame2videoimg2video - ->
multiple_image2videoimg2video
scripts/check_skill_update.py
scripts/check_skill_update.pyCheck whether the installed skill has a newer version available for the current install source.
bash
./.venv/bin/python scripts/check_skill_update.py --mark-notified --check-interval-hours 24For development/testing when install-source metadata is unavailable:
bash
./.venv/bin/python scripts/check_skill_update.py --install-source skills-github --slug fotor-skills --current-version 1.0.0 --github-source fotor-ai/fotor-skills --mark-notified --check-interval-hours 24The script:
- Detects the install source first: or
clawhubskills-github - For , reads installed
clawhuband fetches the latest version via_meta.jsonclawhub inspect <slug> --json - For , reads local
skills-githubfrontmatterSKILL.md, finds the GitHub source, and fetches the remotemetadata.versionversion plusSKILL.mdhighlights when availableCHANGELOG.md - Prints JSON with ,
install_source,current_version,latest_version, andupdate_availableshould_notify - Stores the last-notified version in a local state file when is used
--mark-notified - Caches the last successful version check and supports a minimum recheck interval via (default 24)
--check-interval-hours - Includes so the reminder can mention the main highlights without dumping the full changelog
changelog_preview - Supports development/testing overrides such as ,
--install-source,--slug, and--current-version--github-source
Reference Files
Only read the reference files that match the current need. Do not load all of them by default.
Task Execution References
Read these when choosing a model, validating parameters, or mapping an ambiguous user request to a recommended workflow:
- -- image model IDs, T2I/I2I capabilities, per-model parameter constraints (resolution, ratios, input limits, max refs)
references/image_models.md - -- video model IDs, T2V/I2V/SE/MI capabilities, per-model parameter constraints (duration, resolution, ratios, input limits, audio)
references/video_models.md - -- full function signatures and parameter tables for all 8 task types
references/parameter_reference.md - -- scenario-to-model mapping for image generation (T2I, I2I, utilities); read when user intent is ambiguous
references/image_scenarios.md - -- scenario-to-model mapping for video generation (T2V, I2V, SE, MI); read when user intent is ambiguous
references/video_scenarios.md
Operational References
Read these only when the user asks about installation, upgrade, workspace layout, or credential setup. Do not read them for normal image/video task execution.
- -- how to install or upgrade
references/install-or-upgrade.mdfor both ClawHub andfotor-skills, and how to phrase a concise non-pushy upgrade remindernpx skills - -- how to set, persist, verify, and safely handle
references/configure-fotor-openapi-key.mdFOTOR_OPENAPI_KEY
Workflow
- If is missing, install it first using the platform-appropriate installer shown in Setup.
uv - If Python 3.12 is not already available to , run
uv.uv python install 3.12 - If is missing, create it with
.venv.uv venv --python 3.12 .venv - Run before every task to install or upgrade the latest
./.venv/bin/python scripts/ensure_sdk.pywithfotor-sdk.uv - After is ready and
.venvcompletes, silently runensure_sdk.py. Do not inspect the state file manually. Only if it reports./.venv/bin/python scripts/check_skill_update.py --mark-notified --check-interval-hours 24, readshould_notify: trueand send one short non-blocking update reminder. If the check fails or times out, ignore it and continue without mentioning the failure.references/install-or-upgrade.md - Verify is set.
FOTOR_OPENAPI_KEY - For image-based tasks that start from a local file, first run and keep the returned
./.venv/bin/python scripts/upload_image.py <local-file> --task-type <task-type>.file_url - Read the appropriate model reference to choose . Each model's per-model spec section lists supported resolutions, aspect ratios, duration, input constraints, and max reference images.
model_id - If user intent is ambiguous (no specific model requested), consult the scenario files (/
image_scenarios.md) for recommended model + params.video_scenarios.md - Validate parameters against the chosen model's spec before calling -- check resolution, aspect ratio, duration, and multi-image limits.
- Quick path -- pipe JSON into (works for both single and batch).
./.venv/bin/python scripts/run_task.py - Custom path -- write inline Python using the SDK directly (see examples below), still preferring the local interpreter.
.venv - Check in output. Chain
result_urlif higher resolution needed.image_upscale
If the user asks to check account credits or remaining credits, use the SDK client directly instead of .
run_task.pyBuilt-in automatic fallback mappings:
- :
text2image->gemini-3.1-flash-image-previewseedream-5-0-260128 - :
image2image->gemini-3.1-flash-image-previewseedream-5-0-260128 - :
text2video->doubao-seedance-1-5-prokling-v3 - :
single_image2video->doubao-seedance-1-5-prokling-v3 - :
start_end_frame2video->kling-video-o1viduq2-turbo - :
multiple_image2video->kling-v3-omnikling-video-o1
Available Task Types
| task_type | Function | Required Params |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
For full parameter details (defaults, , ), read .
on_poll**extrareferences/parameter_reference.mdCredit Lookup
For account credit checks such as total credits or remaining credits, use the SDK client directly instead of .
run_task.pypython
import os
from fotor_sdk import FotorClient
client = FotorClient(
api_key=os.environ["FOTOR_OPENAPI_KEY"],
endpoint=os.environ.get("FOTOR_OPENAPI_ENDPOINT", "https://api.fotor.com"),
)
credits = client.get_credits_sync()
print("credits:", credits)Returns a dict like:
python
{"businessId": "", "total": 2000, "remaining": 1973}Inline Python Examples
When is insufficient (custom logic, chaining, progress callbacks):
scripts/run_task.pyClient Init
python
import os
from fotor_sdk import FotorClient
client = FotorClient(api_key=os.environ["FOTOR_OPENAPI_KEY"])Single Task
python
from fotor_sdk import text2image
result = await text2image(client, prompt="A diamond kitten", model_id="seedream-4-5-251128")
print(result.result_url)Batch with TaskRunner
python
from fotor_sdk import TaskRunner, TaskSpec
runner = TaskRunner(client, max_concurrent=5)
specs = [
TaskSpec("text2image", {"prompt": "A cat", "model_id": "seedream-4-5-251128"}, tag="cat"),
TaskSpec("text2video", {"prompt": "Sunset", "model_id": "kling-v3", "duration": 5}, tag="sunset"),
]
results = await runner.run(specs)Video with Audio
python
from fotor_sdk import text2video
result = await text2video(client, prompt="Jazz band", model_id="kling-v3",
audio_enable=True, audio_prompt="Smooth jazz")TaskResult
python
result.success # bool: True when COMPLETED with result_url
result.result_url # str | None
result.status # TaskStatus: COMPLETED / FAILED / TIMEOUT / IN_PROGRESS / CANCELLED
result.error # str | None (e.g. "NSFW_CONTENT")
result.elapsed_seconds # float
result.creditsIncrement # int | float: credits consumed by this task
result.metadata # dict (includes "tag" from TaskRunner)Error Handling
- Single task: catch (has
FotorAPIErrorattribute)..code - Batch: check per item; runner never raises on individual failures.
result.success - NSFW: appears as in TaskResult.
error="NSFW_CONTENT"
For troubleshooting, enable SDK debug logging: .
logging.getLogger("fotor_sdk").setLevel(logging.DEBUG)