赞

回答

收藏

用 Codex / OpenAI 兼容接口接 Yuan API 对话 + Yuan Image 生图(站长向短教程)

站长杂谈 站长杂谈 28 人阅读 | 0 人回复 | 2026-11-02

站长向短教程:用 Codex / OpenAI 兼容客户端接中转,对话和生图共用 Key、换 Base URL。


一、准备
- 文档:https://doc.apixhm.com
- 对话:https://api.apixhm.com
- 生图:https://image.apixhm.com

二、Codex / 兼容对话
Base URL 填 https://api.apixhm.com/v1(若客户端已自动加 /v1 则勿重复),模型按文档选。

示例:
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":"用三句话说明兼容接口"}]}'

三、生图
curl https://image.apixhm.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"dall-e-3","prompt":"clean webmaster dashboard mockup","size":"1024x1024"}'

四、注意
密钥放本地;超时/429 降并发。细节见 https://doc.apixhm.com 。

欢迎回帖交流站长场景踩坑。
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则