Runbase文档

Command Palette

Search for a command to run...

快速入门

在 5 分钟内完成你的第一次图像生成 API 调用。

还没准备好写代码?试试 Playground — 直接在浏览器中测试任何模型,无需 API key。


1. 创建账户

使用 Google 或邮箱在 runbase.net 注册。无需信用卡 — 新账户会获得免费余额用于开始使用。

2. 获取 API key

前往 Settings → API Keys 并创建一个新 key。把它复制到安全的地方 — 它以 sk- 开头,并且不会再次显示。

export RUNBASE_API_KEY="sk-your-key-here"

3. 创建一个 run

/api/v1/runs 发送一个 POST,带上模型 ID 和输入参数:

curl -s https://runbase.net/api/v1/runs \
  -H "Authorization: Bearer $RUNBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/nano-banana-2",
    "input": {
      "prompt": "A cozy bookshop interior with warm lighting, watercolor style",
      "aspect_ratio": "1:1"
    }
  }'

响应:

{
  "id": "run_2abc...",
  "model": "google/nano-banana-2",
  "status": "pending",
  "costUsd": 40000
}

costUsd 以 micro-USD 计价(1 USD = 1,000,000)。40,000 的费用表示 $0.04。

4. 轮询结果

使用 run ID 检查状态:

curl -s https://runbase.net/api/v1/runs/run_2abc... \
  -H "Authorization: Bearer $RUNBASE_API_KEY"

status"succeeded" 时,output 字段包含结果:

{
  "id": "run_2abc...",
  "status": "succeeded",
  "model": "google/nano-banana-2",
  "costUsd": 40000,
  "output": {
    "urls": [
      "https://runbase.net/files/generated/abc123.png"
    ]
  },
  "createdAt": "2026-06-01T12:00:00.000Z",
  "completedAt": "2026-06-01T12:00:04.200Z"
}

如果某个 run 失败,status 将为 "failed",费用会自动退回到你的余额中。

5. 下载图片

输出中的 URLs 是生成图片或视频的直接链接。它们通过全球 CDN 提供,并可立即访问。

接下来做什么

  • Core Concepts — 了解 run 生命周期、异步模型和成本机制
  • Authentication — 为生产环境设置 IP 白名单和支出限额
  • Models — 浏览所有可用模型并在 playground 中试用
  • Billing — 充值并管理你的余额