":{"message":"Input data may contain inappropriate content. For details, see: ht...

2026年01月15日 17:06 状态: processing

🚨 错误信息

HTTP 400 for https://www.dmxapi.cn/v1/images/edits response headers: {'Server': 'nginx', 'Date': 'Thu, 15 Jan 2026 09:00:34 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '183', 'Connection': 'keep-alive', 'X-Rixapi-Request-Id': '20260115170028118051270rdJH2d2J'} response text: {"error":{"message":"Input data may contain inappropriate content. For details, see: https://***.com/***/***/***","type":"rix_api_error","param":"","code":"bad_response_status_code"}} ❌ requests 异常(attempt 1/3,完整堆栈): Traceback (most recent call last): File "/big-data/person/tangchujie/workspace/edit/local_models/regensafe.py", line 110, in request_image resp.raise_for_status() File "/ssd-data/anaconda3/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://www.dmxapi.cn/v1/images/edits response headers: {'Server': 'nginx', 'Date': 'Thu, 15 Jan 2026 09:00:34 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '183', 'Connection': 'keep-alive', 'X-Rixapi-Request-Id': '20260115170028118051270rdJH2d2J'} response text: {"error":{"message":"Input data may contain inappropriate content. For details, see: https://***.com/***/***/***","type":"rix_api_error","param":"","code":"bad_response_status_code"}}

🤖 AI解决方案

代码糕手 - 专业报错分析助理

---

错误翻译



原文:Input data may contain inappropriate content.
译文:输入数据可能包含不当内容。

原因分析


根本原因:请求中提交的输入数据(图像、文本或相关参数)被DMXAPI平台的内容安全策略识别为包含不适当或违规的内容,触发了服务器的内容过滤机制,导致请求被拒绝。

具体位置:发生在向 https://www.dmxapi.cn/v1/images/edits 发送POST请求(或类似修改操作)时。平台返回了明确的错误信息,指出输入数据不合规。

解决方案


  • 检查并清理输入数据

  • - 如果是文本提示(Prompt):请移除任何可能涉及暴力、色情、仇恨、敏感政治人物、侵犯隐私或其他违反平台使用政策的词语。
    - 如果是图像:请确保上传的图像本身不包含违规视觉内容(如裸露、暴力、侵权素材等)。
    - 如果是参数:检查API请求参数(如 nsizeresponse_format)是否符合API文档规定。

  • 修改请求代码(示例)

  • 假设您的请求代码如下所示,主要修改 promptimage 部分:
    python
    import requests

    # 原始可能有问题的 prompt
    # original_prompt = "a violent fight scene" # ❌ 可能违规的提示
    # 修改为合规的 prompt
    safe_prompt = "a peaceful landscape with mountains and a lake" # ✅ 安全的提示

    # 或确保图像文件是安全的
    # with open("safe_image.png", "rb") as image_file:
    # files = {"image": image_file}

    headers = {
    "Authorization": f"Bearer {your_api_key}",
    "Content-Type": "application/json"
    }

    payload = {
    "prompt": safe_prompt, # 使用清理后的prompt
    "n": 1,
    "size": "1024x1024"
    }

    response = requests.post(
    "https://www.dmxapi.cn/v1/images/edits",
    headers=headers,
    json=payload # 或使用 files 参数上传图像
    )

    # 检查响应
    if response.status_code == 200:
    print("请求成功!")
    else:
    print(f"请求失败: {response.json()}")

    ️ 预防措施


  • 内容预审:在将用户输入或自有数据提交给类似API之前,建议建立一个简单的关键词过滤列表或使用第三方内容审核服务,对文本和图像进行初步筛查,避免直接触发平台拦截。

  • 详细阅读平台策略:仔细阅读DMXAPI平台的内容政策和使用条款,了解其明确禁止的内容类型和具体规定。在开发时将这些规则纳入逻辑判断。