Skip to content

🚀 5 分钟快速开始

面向新手:跟着以下步骤,从零开始完成注册、购买、兑换、创建密钥并发出第一次 API 请求。


第一步:注册账号

  1. 浏览器打开 https://fast.drivecode.top/register
  2. 输入邮箱地址密码
  3. 点击注册,登录后进入控制台

第二步:购买兑换码(如已有余额可跳过)

如果账户已有余额,请直接跳到第三步。

  1. 打开 https://shop.drivecode.top
  2. 选择合适面额的 "余额兑换码"
  3. 填写联系方式并完成付款
  4. 付款成功后等待 1~3 分钟,刷新订单页面即可看到兑换码

第三步:兑换余额

  1. 进入 https://fast.drivecode.top/redeem
  2. 完整复制兑换码(注意区分大小写)
  3. 粘贴到兑换框,点击确认
  4. 页面提示成功后,在控制台查看新余额

⚠️ 安全提醒

  • 兑换码区分大小写,复制时确认没有多余空格
  • 每个兑换码只能成功使用一次
  • 不要将兑换码截图发到任何群聊或社交平台

第四步:创建 API Key

  1. 进入 https://fast.drivecode.top/keys
  2. 点击 "创建新密钥"
  3. 输入密钥名称(例如 claude test
  4. 点击确认创建密钥
  5. 点击确认,立即复制并保存 API Key(页面关闭后不再显示)

第五步:发出第一次 API 请求

用以下命令测试你的 API Key 是否正常工作(替换 sk-xxxxxxxxxxxxxxxx 为真实的 Key):

powershell
$env:API_KEY = "sk-xxxxxxxxxxxxxxxx"

$body = @{
    model = "<MODEL_ID>"
    max_tokens = 1024
    messages = @(
        @{ role = "user"; content = "请用一句话介绍你自己" }
    )
} | ConvertTo-Json -Depth 10 -Compress

curl.exe https://fast.drivecode.top/v1/messages `
  -H "x-api-key: $env:API_KEY" `
  -H "anthropic-version: 2023-06-01" `
  -H "Content-Type: application/json" `
  -d $body
powershell
$env:API_KEY = "sk-xxxxxxxxxxxxxxxx"

$body = @{
    model = "<MODEL_ID>"
    messages = @(
        @{ role = "user"; content = "请用一句话介绍你自己" }
    )
} | ConvertTo-Json -Depth 10 -Compress

curl.exe https://fast.drivecode.top/v1/chat/completions `
  -H "Authorization: Bearer $env:API_KEY" `
  -H "Content-Type: application/json" `
  -d $body
powershell
$env:API_KEY = "sk-xxxxxxxxxxxxxxxx"

$body = @{
    model = "<MODEL_ID>"
    input = "请用一句话介绍你自己"
} | ConvertTo-Json -Depth 10 -Compress

curl.exe https://fast.drivecode.top/v1/responses `
  -H "Authorization: Bearer $env:API_KEY" `
  -H "Content-Type: application/json" `
  -d $body

模型名称从 /v1/models 接口获取后替换 <MODEL_ID>

Anthropic 示例中的 max_tokens 是必填的输出上限;anthropic-version: 2023-06-01 是当前稳定 API schema 版本,不应按当前年份改写。

💡 如何选择协议?

  • Claude Code / Anthropic SDK → 用 Claude 协议
  • Codex CLI → 必须使用 OpenAI Responses API
  • Cursor / 常规 OpenAI 兼容客户端 → 通常使用 Chat Completions
  • Python OpenAI SDK → 新项目优先使用 Responses,也可按模型兼容性使用 Chat Completions
  • 只是想快速测试 → 用免费模型,不消耗余额

第六步:查询可用模型

当前可用的模型列表可能随时更新,建议请求前先查询:

powershell
curl.exe https://fast.drivecode.top/v1/models `
  -H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx"

返回结果中 id 字段即为候选模型名称。复制后还要用你准备使用的接口发送一次请求,确认该模型支持 Responses、Chat Completions 或 Anthropic Messages。


第七步:查看使用记录

  1. 进入 https://fast.drivecode.top/usage
  2. 确认刚才的请求已记录在列表中
  3. 查看 Token 数量实际扣费(免费模型显示为 $0)

如果记录了刚才的请求 → 接入成功 ✅


✨ 下一步推荐

本文档仅供 Drivecode API 用户参考,不代表任何 AI 模型服务商官方立场。