zeabur-ai-hub

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Zeabur AI Hub Management

Zeabur AI Hub 管理

Always use
npx zeabur@latest
to invoke Zeabur CLI.
Never use
zeabur
directly or any other installation method. If
npx
is not available, install Node.js first.
请始终使用
npx zeabur@latest
调用 Zeabur CLI。
请勿直接使用
zeabur
命令或其他任何安装方式。如果
npx
不可用,请先安装 Node.js。

API Endpoints

API 端点

AI Hub is OpenAI-compatible. Users can pick the region closest to them:
RegionEndpoint
Tokyo, Japan (HND1)
https://hnd1.aihub.zeabur.ai/
San Francisco, USA (SFO1)
https://sfo1.aihub.zeabur.ai/
AI Hub 兼容 OpenAI 协议,用户可以选择距离最近的区域:
区域端点
日本东京 (HND1)
https://hnd1.aihub.zeabur.ai/
美国旧金山 (SFO1)
https://sfo1.aihub.zeabur.ai/

Quick Start (OpenAI SDK)

快速入门(OpenAI SDK)

JavaScript / TypeScript:
javascript
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://hnd1.aihub.zeabur.ai/v1",  // or sfo1
    apiKey: "sk-xxxxxxxxxxxxxxxx",              // from AI Hub dashboard
});

const stream = await client.chat.completions.create({
    model: "claude-sonnet-4-5",  // any model available on AI Hub
    messages: [{ role: "user", content: "Hello!" }],
    stream: true,
});
Python:
python
from openai import OpenAI

client = OpenAI(
    base_url="https://hnd1.aihub.zeabur.ai/v1",  # or sfo1
    api_key="sk-xxxxxxxxxxxxxxxx",              # from AI Hub dashboard
)

stream = client.chat.completions.create(
    model="claude-sonnet-4-5",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)
curl:
bash
curl https://hnd1.aihub.zeabur.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-5","messages":[{"role":"user","content":"Hello!"}]}'
JavaScript / TypeScript:
javascript
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://hnd1.aihub.zeabur.ai/v1",  // 或者 sfo1
    apiKey: "sk-xxxxxxxxxxxxxxxx",              // 从 AI Hub 控制台获取
});

const stream = await client.chat.completions.create({
    model: "claude-sonnet-4-5",  // AI Hub 支持的任意模型
    messages: [{ role: "user", content: "Hello!" }],
    stream: true,
});
Python:
python
from openai import OpenAI

client = OpenAI(
    base_url="https://hnd1.aihub.zeabur.ai/v1",  # 或者 sfo1
    api_key="sk-xxxxxxxxxxxxxxxx",              // 从 AI Hub 控制台获取
)

stream = client.chat.completions.create(
    model="claude-sonnet-4-5",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)
curl:
bash
curl https://hnd1.aihub.zeabur.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-5","messages":[{"role":"user","content":"Hello!"}]}'

Other SDK Compatibility

其他 SDK 兼容性

  • Anthropic SDK: set
    baseURL
    /
    base_url
    to the endpoint above
  • Vercel AI SDK (
    @ai-sdk/openai
    )
    : set
    baseURL
    to the endpoint above
  • Anthropic SDK: 将
    baseURL
    /
    base_url
    设置为上述端点
  • Vercel AI SDK (
    @ai-sdk/openai
    )
    : 将
    baseURL
    设置为上述端点

Environment Variables

环境变量

When users deploy apps on Zeabur, suggest setting:
bash
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx
OPENAI_BASE_URL=https://hnd1.aihub.zeabur.ai/v1
Most OpenAI-compatible libraries will pick these up automatically.
当用户在 Zeabur 上部署应用时,建议设置:
bash
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx
OPENAI_BASE_URL=https://hnd1.aihub.zeabur.ai/v1
大多数兼容 OpenAI 的库会自动读取这些环境变量。

Check AI Hub Status

查看 AI Hub 状态

bash
npx zeabur@latest ai-hub status -i=false
npx zeabur@latest ai-hub status -i=false --json
Shows tenant balance, API keys, and auto-recharge settings.
bash
npx zeabur@latest ai-hub status -i=false
npx zeabur@latest ai-hub status -i=false --json
显示租户余额、API 密钥和自动充值设置。

API Key Management

API 密钥管理

bash
undefined
bash
undefined

List all keys

列出所有密钥

npx zeabur@latest ai-hub keys list -i=false npx zeabur@latest ai-hub keys ls -i=false --json
npx zeabur@latest ai-hub keys list -i=false npx zeabur@latest ai-hub keys ls -i=false --json

Create a new key (optional alias)

创建新密钥(可设置别名)

npx zeabur@latest ai-hub keys create --alias "my-app" -i=false
npx zeabur@latest ai-hub keys create --alias "my-app" -i=false

Delete a key

删除密钥

npx zeabur@latest ai-hub keys delete --key-id <key-id> -i=false

**The API key is only shown once at creation time.** Make sure the user saves it immediately.
npx zeabur@latest ai-hub keys delete --key-id <key-id> -i=false

**API 密钥仅在创建时显示一次,请确保用户立即保存。**

Add Balance

充值余额

bash
undefined
bash
undefined

Add $10 to AI Hub balance

为 AI Hub 余额充值 10 美元

npx zeabur@latest ai-hub add-balance --amount 10 -i=false

- Amount is in **whole dollars** (integer).
- Deducts from Zeabur account credits. If insufficient credits and no linked card, a checkout page opens in the browser automatically.
npx zeabur@latest ai-hub add-balance --amount 10 -i=false

- 金额单位为**美元整数**。
- 从 Zeabur 账户额度中扣除,如果额度不足且未绑定银行卡,会自动在浏览器中打开结账页面。

Check Usage

查询使用量

bash
undefined
bash
undefined

Current month usage

查询当月使用量

npx zeabur@latest ai-hub usage -i=false
npx zeabur@latest ai-hub usage -i=false

Specific month

查询指定月份的使用量

npx zeabur@latest ai-hub usage --month 2026-03 -i=false npx zeabur@latest ai-hub usage --month 2026-03 -i=false --json

Shows total spend and per-model cost breakdown. `--month` must be in `YYYY-MM` format.
npx zeabur@latest ai-hub usage --month 2026-03 -i=false npx zeabur@latest ai-hub usage --month 2026-03 -i=false --json

显示总支出和按模型划分的成本明细。`--month` 参数必须为 `YYYY-MM` 格式。

Auto-Recharge Settings

自动充值设置

bash
undefined
bash
undefined

Enable: recharge $20 when balance drops below $5

启用:当余额低于 5 美元时充值 20 美元

npx zeabur@latest ai-hub auto-recharge --threshold 5 --amount 20 -i=false
npx zeabur@latest ai-hub auto-recharge --threshold 5 --amount 20 -i=false

Disable auto-recharge

关闭自动充值

npx zeabur@latest ai-hub auto-recharge --threshold 0 --amount 0 -i=false

Both `--threshold` and `--amount` are in whole dollars.
npx zeabur@latest ai-hub auto-recharge --threshold 0 --amount 0 -i=false

`--threshold` 和 `--amount` 均以美元整数为单位。