搭配你的方案使用 API
透過 API 金鑰以 HTTP 呼叫 Dropstone。端點相容於 OpenAI,按用量從你的餘額扣款,並可從任何語言使用。涵蓋金鑰、錯誤、速率限制,以及 API 不提供的功能。
Dropstone API 是一個相容於 OpenAI 的端點,適用於不應依賴已登入介面的程式碼:CI 工作、無伺服器函式、其他語言的服務。建立金鑰、將用戶端指向 Dropstone,你就能呼叫與 Chat 和 CLI 相同的三個模型。
端點參考文件位於 docs.dropstone.io/cli/api。本頁涵蓋金鑰、計費方式,以及使用時應有的預期。
建立 API 金鑰
- 在儀表板中開啟設定。
- 在API 金鑰下方,選擇建立金鑰並為其命名。
- 複製金鑰。它看起來像
dsk_live_...,且只會顯示一次。
請將金鑰視為密碼:絕不要提交到版本控制,也絕不要放在瀏覽器套件中。任何持有金鑰的人都能花費其背後的餘額。你可以在同一頁面上查看每個金鑰的上次使用時間,並撤銷任何金鑰。
計費:按用量付費
API 金鑰請求按用量從你的信用餘額扣款。方案配額不適用於這些請求。每週配額屬於已登入的介面:Chat、CLI 和本機 SDK 工作階段。API 是獨立計量的,因此管線的流量永遠不會消耗你工作時使用的配額,而 Chat 中忙碌的一週也永遠不會讓管線停擺。請從儀表板的計費頁面加值。
餘額為空的金鑰會被拒絕,並顯示說明餘額不足的錯誤及加值連結,而不是先提供服務再事後扣款。API 沒有免費方案。
相容於 OpenAI
端點遵循 OpenAI 的聊天完成格式,因此大多數現有用戶端只需變更 base URL 和金鑰即可使用:
import OpenAI from "openai"
const openai = new OpenAI({
baseURL: "https://api.dropstone.io/api/v1",
apiKey: process.env.DROPSTONE_API_KEY,
})
模型為 dropstone-fast、dropstone-pro 和 dropstone-heavy;請參閱選擇模型。任何能發出 HTTP 呼叫的語言都能傳送請求。
API 不提供的功能
端點是無狀態的,而且刻意如此:
- 沒有記憶。 它不會讀取你的帳戶記憶,也不會將任何回答記錄在記憶中。無論你上週教了 Dropstone 什麼,相同的輸入都會得到相同的回答。
- 沒有工具,也沒有代理迴圈。 它只回答聊天完成。讀取程式碼庫、編輯檔案和執行命令屬於 SDK 本機用戶端和 CLI 的範疇。
如果你想讓程式碼使用代理及其記憶,請使用 SDK 的本機用戶端。請參閱每個介面共享同一份記憶。
速率限制
請求會依 IP 進行速率限制,限制遠高於一般使用量,以保護服務。觸發限制的突發流量會被拒絕,因此請退避並重試,而不是縮短重試間隔。
請求的處理位置
API 請求在美國處理,與所有其他介面相同。請參閱你的請求在哪裡執行。
組織
組織成員在自己的帳戶下建立金鑰,金鑰背後的餘額屬於金鑰擁有者。組織管理員可以在組織儀表板上查看成員的 API 使用量,而當金鑰背後的帳戶被停用時(例如成員透過 SCIM 被移除時),金鑰就會停止運作。
Related articles
- Dropstone SDKA typed TypeScript and JavaScript client for the Dropstone agent, with two entry points: one for headless API calls from CI or a serverless function, one that runs the agent locally with the same account memory as the CLI and Chat.
- Install and run your first sessionInstall the Dropstone SDK, make a headless API call with an API key, and run a local agent session that carries your account memory. Includes streaming, structured output, and using the OpenAI SDK against Dropstone.
- One memory across every surfaceThe account memory that follows you across Dropstone Chat, the CLI, and the SDK, what shares it and what does not, and how to keep an integration's learning out of your own memory.
- Choose a modelDropstone offers three models, Fast, Pro, and Heavy, tuned for different kinds of work. Fast and Pro are available on every plan. Heavy is included with paid plans. Here is how to pick.
- Where your requests runDropstone's servers and the inference providers that run its models are hosted in the United States. Requests are never routed through providers outside the US. What that means for your data.