AI Agent क्विक स्टार्ट

Claude Code, OpenClaw और अन्य AI Agents के लिए mopng.cn API एक्सेस गाइड

1

API Key प्राप्त करें

API Key प्राप्त करने के लिए पहले लॉगिन करें

2

MoPNG API Skill इंस्टॉल करें

OpenClaw / Claude Code / Cursor नीचे दिए गए 3 चरणों का पालन कर सकते हैं; प्रत्येक चरण अलग से कॉपी किया जा सकता है।

1. इंस्टॉल करें

अपने क्लाइंट में चलाएं (प्रोडक्ट के अनुसार एंट्री पॉइंट भिन्न हो सकता है)।

/skill add https://gitee.com/jkin8010/mopng-api/raw/main/SKILL.md

आवश्यकताएं: uv, python3 (3.10+ अनुशंसित)। विवरण: SKILL.md(GitHub)Gitee

2. पर्यावरण चर कॉन्फ़िगर करें

API Key बनाने के बाद, आपकी कुंजी यहां दर्ज होगी और कॉपी के लिए उपलब्ध होगी।

Configure environment variables (read by the skill scripts, same value as API Key)

Tell your assistant to set it globally, for example:
> Set MOPNG_API_KEY='ak_xxxxxxxxxxxxxxxx' in the global environment

If your client supports JSON env config (e.g. OpenClaw), use:
{
  "env": {
    "MOPNG_API_KEY": "ak_xxxxxxxxxxxxxxxx"
  }
}

3. उपयोग उदाहरण

After installation, you can use CLI-style commands in chat (relative paths are supported):
- Background removal: remove-bg ./photo.jpg
  remove-bg ./photo.jpg --output ./result.png --async-mode
- HD upscale: upscale ./photo.jpg --scale 2
  upscale ./photo.jpg --scale 4 --tile-size 192 --tile-pad 24 --async-mode
- Outpainting: outpainting ./photo.jpg --direction all --expand-ratio 0.5
  outpainting ./photo.jpg --direction right --expand-ratio 0.3 --best-quality
- Image translation: translation ./photo.jpg --target-language en
  translation ./photo.jpg --target-language ja --source-language zh
- Text-to-image: text-to-image --prompt "A red-beaked blue magpie standing on a branch"
  text-to-image --prompt "A futuristic city in cyberpunk style" --output ./cyberpunk.png --model wanx-v2.5
- Image-to-image: image-to-image --input ./photo.jpg --prompt "Turn the sky into a golden sunset"
  image-to-image --input ./portrait.jpg --prompt "Convert to oil painting style" --strength 0.7 --output ./portrait_oil.png
- List models: list-models --type text_to_image
  list-models --type image_to_image

Tips: for long-running tasks (remove-bg/upscale), prefer --async-mode; for image-to-image, use --strength to control change level (about 0.3–0.5 light, 0.6–0.8 medium, 0.9–1.0 strong).
3

AI Agent को पूरे निर्देश कॉपी करें

नीचे केवल HTTP/OpenAPI पूर्वावलोकन है; "पूरे निर्देश कॉपी करें" में ऊपर के Skill 3 चरण + यह सेक्शन शामिल होगा।

Use mopng.cn OpenAPI (HTTP, Bearer auth)

API Key: ak_xxxxxxxxxxxxxxxx
Base URL: https://mo-api.mopng.cn

Image input: for local files, upload first via POST https://mo-api.mopng.cn/api/v1/images/upload, then use data.signedUrl or data.signed_url; remote URLs can be passed directly.

Async tasks: if POST returns data.status as pending/processing, poll until completed/failed (do not rely on async_mode alone):
- remove-bg / upscale: GET https://mo-api.mopng.cn/api/v1/open/image/tasks/{taskId or task_id}
- outpainting / translation / text-to-image / image-to-image: GET https://mo-api.mopng.cn/api/v1/open/ai/generations/{jobId, taskId, or task_id}

Result image: prefer first url in data.results[]; keep compatibility with result.imageUrl / image_url. Error rule: treat as failure only when code is a number and non-zero.

HTTP endpoints:
- remove-bg: POST /api/v1/open/image/remove-bg
- upscale: POST /api/v1/open/image/upscale
- outpainting: POST /api/v1/open/image/outpainting
- translation: POST /api/v1/open/image/translation
- text-to-image: POST /api/v1/open/ai/generations (type=text_to_image)
- image-to-image: POST /api/v1/open/ai/generations (type=image_to_image)

API documentation (for agents): https://mopng.cn/agent/docs

Natural language examples (works for HTTP or installed skill):
"Please remove the background of ./photo.jpg and save as ./result.png"
"Please upscale ./image.jpg by 2x"
"Please translate Chinese text in ./poster.jpg to English"
"Please outpaint ./photo.jpg by 50% on all sides"

समर्थित AI टूल्स

बैकग्राउंड हटाएं
1点/张
HD अपस्केल
1点/张
आउटपेंटिंग
2点/张
छवि अनुवाद
2点/张
टेक्स्ट से छवि
3点/张
छवि से छवि
3点/张
वर्तमान चयन: बैकग्राउंड हटाएं
Base Path: /api/v1/open Auth: Authorization: Bearer <API_KEY> **POST** /image/remove-bg Image: upload local files first via POST /api/v1/images/upload; for remote images, pass image_url directly. If data.status is pending/processing, poll GET /image/tasks/{taskId|task_id}; camelCase fields are also supported (taskId, results[].url).

कोड उदाहरण

import requests
import sys

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://mo-api.mopng.cn"

# For local images, upload first. Skip for remote URLs.
base = BASE_URL.rstrip("/").replace("/api/v1/open", "") or BASE_URL
with open("image.jpg", "rb") as f:
    up = requests.post(
        f"{base}/api/v1/images/upload",
        headers={"Authorization": f"Bearer {API_KEY}"},
        files={"file": f}
    )
    ud = up.json().get("data") or {}
    image_url = ud.get("signedUrl") or ud.get("signed_url")

# Call API
resp = requests.post(
  f"{BASE_URL}/api/v1/open/image/remove-bg",
  headers={"Authorization": f"Bearer {API_KEY}"},
  json={
  "image_url": image_url,
  "output_format": "png",
  "return_mask": false,
  "only_mask": false,
  "async_mode": false
}
)
j = resp.json()
code = j.get("code")
if code is not None and code != 0:
    print("API error:", j, file=sys.stderr)
    sys.exit(1)
data = j.get("data") or {}
tid = data.get("jobId") or data.get("job_id") or data.get("taskId") or data.get("task_id")
status = data.get("status")
if status in ("pending", "processing") and tid:
    import time
    while status in ("pending", "processing"):
        time.sleep(3)
        r = requests.get(
            f"{BASE_URL}/api/v1/open/image/tasks/{tid}",
            headers={"Authorization": f"Bearer {API_KEY}"},
        )
        j2 = r.json()
        c2 = j2.get("code")
        if c2 is not None and c2 != 0:
            print("poll error:", j2, file=sys.stderr)
            sys.exit(1)
        data = (j2.get("data") or {})
        status = data.get("status")
        if status in ("completed", "failed"):
            break
    results = data.get("results") or []
    first = results[0] if results else {}
    url = first.get("url") or first.get("imageUrl") or first.get("image_url")
    if not url:
        r0 = data.get("result") or {}
        url = r0.get("imageUrl") or r0.get("image_url")
    print({"status": status, "image_url": url, "data": data})
else:
    print(j)

API दस्तावेज़ (Agent के लिए)

प्रत्येक टूल के endpoint, request body और response structure को Markdown में व्यवस्थित करके AI Agent में सीधे उपयोग के लिए।

कॉपीराइट © 2026 Hangzhou Qise Technology Co., Ltd.