System Framework v4.7.0 // BRUCEAI API Gateway
+ 01
+ 02

BRUCEAI

OPENAI_COMPATIBLE

OpenAI-compatible 接入

任何支援 OpenAI-compatible API 的客戶端,都可以用下面的 Base URL 和 API Key 接入 BRUCEAI。

如果客戶端要求模型名稱,可先使用兼顧能力與成本的 gpt-5.6-terra;也可依需求選擇 Sol、Luna 或既有模型。後端會依實際模型與上下文級距計費。

支援模型 ID

可以把這些模型 ID 複製到 config.toml、API request body,或任何需要填模型名稱的 OpenAI-compatible 客戶端。

STEP 01 / API_KEY_REQUIRED

先準備 API 金鑰

1. 前往 API Key 頁面

登入後到 API Key 頁面建立或複製 API Key。金鑰格式像 sk-or-v1-xxxxxxxxxxxx,請把它當密碼保管。

建立 API Key
2. 確認 Base URL
https://api.bruceai.net/v1

OpenAI-compatible 客戶端通常需要填帶 /v1 的 Base URL。

不要把 API 金鑰發給別人,也不要提交到 GitHub、GitLab 或任何公開倉庫。

先選擇你的系統

下方所有指令會依照你選擇的系統切換。

STEP 02

健康檢查

macOS / Linux
bash
curl https://api.bruceai.net/health
STEP 03

Chat Completions Streaming 範例

macOS / Linux
bash
curl -N https://api.bruceai.net/v1/chat/completions \
  -H "Authorization: Bearer sk-or-v1-你的金鑰" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-terra","messages":[{"role":"user","content":"hi"}],"stream":true}'
STEP 04

常見問題

401 / invalid token:確認金鑰完整、沒有多餘空白,格式是 sk-or-v1-...

400 / conversation too large:對話太長,在 Claude Code 輸入 /compact,或開啟新對話。

Claude Code 仍走自己的帳號:輸入 /status 檢查,通常是專案 .env、~/.zshrc 或 ~/.bashrc 裡殘留 ANTHROPIC_API_KEY。

Codex 顯示 403 / requires openai:請聯絡管理員確認帳號權限。