快速开始

OpenAI 兼容接口,只需替换 Base URL 与 API Key,现有 SDK 和 Cursor 均可直接使用。

  1. 1. 注册并创建 API Key

    新用户注册赠送 ¥1 体验金。登录后进入 令牌管理 创建密钥,完整 yh_... 内容仅显示一次,请立即复制保存。

  2. 2. 在 Playground 验证

    打开 API 调试,粘贴密钥并发送测试请求,确认返回正常且余额扣费成功。

  3. 3. 接入你的项目

    平台 Base URL(OpenAI 兼容):

    https://yuhaoapi.com/v1

    主要端点:POST /v1/chat/completions(对话)、POST /v1/generations(图像/视频)。请求头携带 Authorization: Bearer 你的Key

    代码示例(将 Key 替换为你的密钥)

    Base URL: https://yuhaoapi.com/v1

    curl https://yuhaoapi.com/v1/chat/completions \
      -H "Authorization: Bearer 你的_API_Key" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "gpt-4o-mini",
      "messages": [
        {
          "role": "user",
          "content": "你好"
        }
      ]
    }'

Cursor 配置要点

  • Settings → Models → OpenAI:填入 API Key,并开启 Override OpenAI Base URL
  • Base URL 填 https://yuhaoapi.com/v1
  • Agent / 工具调用建议使用 GPT 或 DeepSeek 分组模型
注册并开始