model not allowed: bailian-coding/Qwen3.5-35B-A3B-free
错误信息
Failed to set model: GatewayRequestError: model not allowed: bailian-coding/Qwen3.5-35B-A3B-free
AI 解决方案
报错分析报告
1.错误翻译
原文:model not allowed: bailian-coding/Qwen3.5-35B-A3B-free
译文:模型不允许使用:bailian-coding/Qwen3.5-35B-A3B-free
2.原因分析
bailian-coding/Qwen3.5-35B-A3B-free未纳入DMXAPI平台的授权模型列表 GatewayRequestError表明请求被网关拦截)3. 解决方案
GET /v1/models接口或查文档) # 修复后:使用DMXAPI允许的模型(需替换为实际支持的模型名)
from openai import OpenAI
client = OpenAI(
api_key="your_dmxapi_key",
base_url="https://api.dmxapi.cn/v1" # DMXAPI端点
)
response = client.chat.completions.create(
model="qwen-turbo", # 示例:替换为平台允许的模型(如qwen-plus/gpt-3.5-turbo)
messages=[{"role": "user", "content": "测试"}]
)
print(response.choices[0].message.content)
4. 预防措施
/v1/models接口获取支持列表,避免硬编码无效模型 ALLOWED_MODELS = ["qwen-turbo", "gpt-3.5-turbo"]),设置模型时校验合法性 ---
注:模型名称需以DMXAPI平台实时返回的列表为准,避免使用已下架/未授权的模型。