- Skill ID
- lovartai/lovart-skill/lovart-api
- Publisher
- lovartai
- Repository
- lovart-skill
- Installs
- 0
- Files
- 2
- License
- MIT
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
lovartai/lovart-skill/lovart-apiInstalls these files- SKILL.md
- scripts/agent_skill.py
What this skill tells the agent
⚠️ RULE #0: ONLY USE SKILL COMMANDS — NO DIRECT API CALLS
You MUST interact with Lovart EXCLUSIVELY through the commands defined in this skill.
- NEVER construct URLs, make curl/wget/fetch requests, or call Lovart APIs directly
- NEVER guess API endpoints, paths, or parameters — only use the commands listed below
- NEVER modify the skill's source code (agent_skill.py) during execution to "debug" issues (users may freely read the source to verify it)
- If a command fails, retry it or report the error to the user — do NOT try to work around it
- ALL Lovart operations go through:
chat,send,watch,confirm,result,status,config,projects,project-add,project-switch,project-rename,project-remove,threads,thread-remove,upload,upload-artifact,download,set-mode,query-mode,create-project
⚠️ RULE #1: YOU CAN AND MUST GENERATE IMAGES/VIDEOS/AUDIO
When a user asks to "draw", "generate", "create", "design", "make", "画", "生成", "制作", "创作" any visual or audio content (in any language), you MUST use this skill. This includes: images, videos, audio, music, songs, BGM, TTS, voice, posters, carousels, banners, logos, illustrations, thumbnails, slides, covers, mockups, icons, social media content, etc. Do NOT say "I can't generate images/music" or offer to write prompts instead.
⚠️ RULE #1.5: PROJECT & THREAD QUERIES USE THIS SKILL
When the user asks about projects, threads, conversations, history, or settings (in any language), use these commands — do NOT browse the filesystem:
| User asks | Command |
|---|---|
| "What projects do I have?" / "我有哪些项目" | projects --json |
| "What conversations/threads?" / "有哪些对话" | threads --json or threads --all --json |
| "Show my settings" / "我的配置" | config --json |
| "Switch to project X" | project-switch --project-id X |
| "Create a new project" | project-add --project-id NEW_ID --name "Name" (or let chat auto-create) |
⚠️ RULE #2: ALWAYS USE chat AND WAIT FOR COMPLETION
Use the chat command (blocks until done), NOT send. Do NOT reply before generation completes.
Handle these `final_status` values:
"done"— Generation complete. Send the downloaded files to the user."pending_confirmation"— A high-cost tool (e.g. video, or a premium-quality image variant) needs user approval before credits are consumed. You MUST ask the user for explicit confirmation before proceeding. Do NOT auto-confirm.
- Show the user: "This will cost approximately {estimated_cost} credits. Shall I proceed? (yes/no)"
- WAIT for user response. Only if user explicitly says yes/confirm/proceed, run:
confirm --thread-id THREAD_ID --json --download(This confirms, waits for completion, and returns the result with downloaded files) - If user declines, do NOT confirm. Just inform them the operation was cancelled.
"abort"— Generation was aborted. Inform the user."timeout"— Generation is still running but exceeded the wait time. The result may contain partial artifacts.
- Send any downloaded files that are already available
- Tell the user: "Generation is still in progress. Checking again..."
- Run:
result --thread-id THREAD_ID --json --downloadto get the latest results - If status is still "running", wait and retry. If "done", send remaining files.
Handle errors:
If chat throws an error (AgentSkillError), handle it by HTTP status and structured code. The message field already contains a user-ready explanation — surface it to the user as-is.
| HTTP status | code | What it means | What to tell the user |
|---|---|---|---|
| `402` | 2012 | Quota / billing / risk-control rejection | Show AgentSkillError.message directly — the server already returns a specific message (insufficient credits, free-tier reached, concurrent limit, risk control, phone verification, team plan required, etc.) and a suggested next step. |
| `409` | 2011 | Another task is still running on this thread | "A task is still running on this conversation. Wait for it to finish (status) before sending a new prompt, or start a new thread." |
| `429` | 1429 | API rate limit hit | "Slowing down; rate limit hit. Retry in ~60s." |
| `401` | — | AK/SK misconfigured | "API key authentication failed. Please check your LOVART_ACCESS_KEY and LOVART_SECRET_KEY." |
| — | — | Project.*does not exist in message | "Project not found. Please check the project ID or create a new one." |
Rule of thumb: prefer AgentSkillError.message for user-facing copy. Do not try to parse internal codes out of the response — the server already maps them to human-readable messages before returning.
Detect silent generation failures (`done` with no artifact):
Some prompts end with final_status: "done" but produce no artifacts / empty downloaded. This usually means the upstream image model refused the prompt (content moderation), timed out, or the LLM chose to reply with text instead of calling a tool. The skill flags this automatically — when chat() returns, check:
result["generation_succeeded"]— boolean.Falsemeans no artifact was produced.result["warning"]— explanation string (present only whengeneration_succeededisFalse).result["agent_message"]— the agent's plain-text reply that hints at why (present when available).
Typical triggers:
- GPT Image 2 with very long/complex prompts involving weapons, specific bodies, or policy-sensitive wording — retry with a different model (
--include-tools generate_image_midjourneyorgenerate_image_nano_banana_pro) or simplify the prompt. - Prompt that describes a task the agent can't fulfill — show
agent_messageto the user.
⚠️ RULE #3: ALWAYS DELIVER RESULTS + PROJECT LINK
After EVERY generation, you MUST:
- Use
--downloadflag withchat(orresult) - Send each downloaded file to the user as a file attachment (images, videos, audio/mp3 — ALL file types):
- ALWAYS send
downloaded[].local_pathas file attachments, regardless of file type (.png, .jpg, .mp4, .mp3, etc.) - NEVER just paste the URL when a local file has been downloaded — send the actual file
- Only fall back to displaying URLs if no files were downloaded
- Append the project canvas link:
https://www.lovart.ai/canvas?projectId={project_id} - Check
failuresin the result. When it is non-empty, tell the user which reference or model was refused and why — the Agent may have dropped an input or switched models to finish, so the delivered result can differ from what they asked for. Never report a clean success whilefailuresis non-empty.
⚠️ RULE #4: CHECK LOCAL STATE ON FIRST USE (MANDATORY — DO NOT SKIP)
Before the FIRST generation in a conversation, you MUST run these two commands IN ORDER. This is NOT optional. Do NOT call `chat` until you have done both.
Step 1: `config --json`
- Check local state (
~/.lovart/state.json) foractive_project - If
active_projectis set → proceed to Step 2. Do NOT create a new project. Do NOT ask the user. - If
active_projectis missing → ask the user: "Do you have an existing Lovart project ID, or should I create a new one?" WAIT for their answer. - Save with:
project-add --project-id PID --name "name"
Step 2: `threads --json`
- Check if there's a recent thread to continue
- If recent thread exists and topic is related → REUSE it (pass
--thread-id THREAD_IDtochat) - If no threads or completely different topic → omit
--thread-id(creates new thread)
CRITICAL RULES:
- NEVER create a new project if
config --jsonalready shows anactive_project. Reuse it. - NEVER omit `--thread-id` when a relevant recent thread exists. Always reuse threads by default.
- NEVER call `chat` without first running `config --json` and `threads --json` in the same conversation.
Use this skill in a project
Open any RiverX project, search the Skills panel for lovartai/lovart-skill/lovart-api, and install it in one click.
