":{"message":"Invalid URL (GET /v1)","type":"invalid_request_error","code":""}}

2026年04月26日 22:45 processing

错误信息

C:\Users\13010>curl https://www.dmxapi.cn/v1 -H "Authorization: Bearer sk-iwSnP9W,,,,8SgvcKC9K0Wj" {"error":{"message":"Invalid URL (GET /v1)","type":"invalid_request_error","code":""}}

AI 解决方案

报错分析报告

1.错误翻译


原文:Invalid URL (GET /v1)
译文:无效的URL(GET /v1)

2. 原因分析


  • 根本原因:请求的URL路径/v1不符合DMXAPI平台规范(平台不接受直接访问根路径/v1)。

  • 错误位置:curl命令中的URL参数https://www.dmxapi.cn/v1,缺少具体资源路径(如/chat/completions)。
  • 3. 解决方案


    使用带具体资源路径的正确URL(以聊天接口为例):
    curl https://www.dmxapi.cn/v1/chat/completions \
      -H "Authorization: Bearer sk-iwSnP9W,,,,8SgvcKC9K0Wj" \
      -H "Content-Type: application/json" \
      -d '{"model":"gpt-3.5-turbo","messages":[{"role":"user","content":"Hello"}]}'
    

    注:需将/chat/completions替换为DMXAPI文档中实际支持的端点(如/models//embeddings等)。

    4.️ 预防措施


  • ✅ 调用API前必查官方文档,确认端点的完整路径(如/v1/xxx而非/v1);

  • ✅ 用Postman/Swagger等工具预验证端点,避免硬编码错误路径。
  • ---
    请补充具体业务场景的端点需求,或提供更详细的报错上下文。