本人在用 Yuan API / Yuan Image 中转做 GPT / OpenAI 兼容调用,分享可复现步骤(非站方广告)。
文档:https://doc.apixhm.com 对话 Base:https://api.apixhm.com 生图 Base:https://image.apixhm.com
步骤: ① 文档站创建 API Key(勿把 Key 发到论坛) ② OpenAI 兼容客户端 Base URL 设为 https://api.apixhm.com/v1 ,填自己的 Key ③ GPT 系模型名按文档列表选,例如 gpt-4o-mini ④ 生图把 Base 换成 https://image.apixhm.com
示例: curl https://api.apixhm.com/v1/chat/completions \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"用三句话说明如何把 OpenAI 兼容客户端的 Base URL 改成中转地址"}]}'
生图示例: curl https://image.apixhm.com/v1/images/generations \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"dall-e-3","prompt":"a tidy desk with a laptop showing a chat window, soft daylight, documentary photo","size":"1024x1024"}'
欢迎补充踩坑。