跳至主要內容

使用自己的 AI API 金鑰

你可以在 Heptabase 中使用自己的 OpenAI、Anthropic、Gemini 或 OpenRouter API 金鑰。你也可以連接 OpenAI-compatible provider 或 Google Vertex AI,並手動加入模型。

​

使用自己的 API 金鑰時,相關請求不會扣除 Heptabase AI credits。費用、可用模型、額度與 rate limits 由對應的 AI 服務管理。

​

請注意:

  • AI Tutor 與 Voice Note 一律使用 Heptabase 每月提供的 AI credits。

  • Audio/Video Transcription 只支援 OpenAI API 金鑰。

  • ChatGPT、Claude 或 Google AI 的一般訂閱,不代表對應的 API 帳戶已有可用額度。


OpenRouter

OpenRouter 讓你透過一組 OpenRouter API 金鑰,在 Heptabase 中使用多個 provider 提供的模型。

​

步驟 1:建立 OpenRouter API 金鑰

登入 OpenRouter API Keys,建立一組 API 金鑰。OpenRouter API 金鑰通常以 sk-or- 開頭。

​

步驟 2:必要時設定 provider integrations

如果你想讓 OpenRouter 使用其他 provider 的 API 金鑰,可以在 OpenRouter 中設定 provider integrations。無論是否設定 integrations,貼到 Heptabase 的都應該是 OpenRouter API 金鑰,而不是 DeepSeek、Kimi 或其他 provider 的原始金鑰。

​

步驟 3:將金鑰加入 Heptabase

在 Heptabase 前往 Settings → AI Features → API Keys,將設定切換為 Enabled。

​

點選 +,選擇 OpenRouter,然後貼上 OpenRouter API 金鑰。

​

OpenRouter 的 :free 模型目前不支援。


Google Gemini

步驟 1:建立 Gemini API 金鑰

登入 Google AI Studio,確認目前使用的是要建立 API 金鑰的 Google 帳戶。

​

點選 Create API key,選擇要使用的 Google Cloud project,然後依照頁面指示建立並保存 API 金鑰。

​

步驟 2:將金鑰加入 Heptabase

在 Heptabase 前往 Settings → AI Features → API Keys,將設定切換為 Enabled。

​

點選 +,選擇 Gemini,然後貼上 API 金鑰。

​

步驟 3:確認 Gemini API billing 與 limits

Gemini App 的訂閱使用額度與 Gemini API project 的限制分開。API 是否可用、費用與 rate limits,取決於這組金鑰所屬的 Google AI Studio project。

Google AI Pro 另有透過 Google Developer Program 提供的每月 US$10 Google Cloud credits 福利。請確認資格、連結 Google Developer profile,並將可用福利套用到該 project 使用的 Cloud Billing account;credits 的適用條件仍需確認。詳見 Google AI Pro 福利與 Developer Program 福利 FAQ。

如果 API billing account 採用 Prepay,必須先購買預付 credits 並維持有效的預付餘額,才能使用符合條件的優惠 Cloud credits。credits 與 API 付費使用都不會取消 rate limits;是否需要再付費,請先查看該 project 的 Billing Tier、Usage 與 Rate limits。

​

你可以在 Google AI Studio 查看該 project 的 billing、usage 與 rate limits。詳細資訊請參考 Gemini API billing 與 rate limits。


OpenAI

步驟 1:建立 OpenAI API 金鑰

登入 OpenAI Platform,然後前往 API Keys。

​

點選 Create new secret key,依照頁面指示建立並保存 API 金鑰。

​

步驟 2:將金鑰加入 Heptabase

在 Heptabase 前往 Settings → AI Features → API Keys,將設定切換為 Enabled。

​

點選 +,選擇 OpenAI,然後貼上 API 金鑰。

​

步驟 3:確認 API billing

ChatGPT 訂閱與 OpenAI API billing 是分開的。請前往 OpenAI Platform 的 Billing 頁面,確認 API 帳戶具有可用額度。

​

你也可以在 Limits 頁面查看目前的 usage limits。


Anthropic Claude

步驟 1:建立 Anthropic API 金鑰

登入 Anthropic Console,然後前往 API Keys。

​

點選 Create key,依照頁面指示建立並保存 API 金鑰。

​

步驟 2:將金鑰加入 Heptabase

在 Heptabase 前往 Settings → AI Features → API Keys,將設定切換為 Enabled。

​

點選 +,選擇 Anthropic,然後貼上 API 金鑰。

​

步驟 3:確認 API billing

Claude 訂閱不代表 Anthropic API 帳戶已有可用額度。請前往 Anthropic Console 的 Billing 頁面,確認帳戶具有可用的 usage credits。

​

你也可以在 Limits 頁面查看目前的 usage limits。


Custom Providers

如果你要使用 OpenAI-compatible provider 或 Google Vertex AI,可以在 Heptabase desktop 或 web app 前往 Settings → AI Features → Custom Providers。

​

OpenAI-compatible provider

建立 provider 時,請選擇它使用的 API type:

  • Chat Completions

  • Responses API

請填入 provider 提供的 public HTTPS Base URL。Base URL 應保留 provider 要求的 API version 或 base path,例如 /v1,但不要包含 /chat/completions 或 /responses。Heptabase 會根據選擇的 API type 自動加上對應路徑。

​

Authentication 可以使用 Bearer API key 或指定的 API-key header,也可以加入 provider 要求的 custom headers。

​

接著,請手動加入要使用的 model ID。Heptabase 不會自動從 endpoint 讀取可用模型。

​

Google Vertex AI

建立 provider 時選擇 Google Vertex AI。你可以使用 Vertex AI Express Mode API key,或提供具有 Vertex AI 權限的 Google Cloud service account、project ID 與 location。

​

Custom Provider 中加入的模型目前用於 AI Chat,不會套用到 AI Tutor、Voice Note 或 Audio/Video Transcription。

​

不同 provider 和模型的相容性可能不同。相關 endpoint 必須支援 AI Chat 所需的 streaming 與 tool use,Heptabase 無法保證所有 OpenAI-compatible endpoint 都能正常使用。


發生錯誤時

如果 API 金鑰已經加入 Heptabase,但請求仍然失敗,請參考〈排解使用自己的 AI API 金鑰時發生的錯誤〉。

是否回答了您的問題?