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,並附上 model 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. 下載圖片

output 中的 URLs 是生成圖片或影片的直接連結。它們透過全球 CDN 提供,並會立即可用。

接下來呢

  • Core Concepts — 了解 run 生命週期、非同步模型與成本機制
  • Authentication — 為正式環境設定 IP 白名單與支出上限
  • Models — 探索所有可用模型並在 playground 中試用它們
  • Billing — 充值並管理你的餘額