在您的套餐中使用 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 聊天补全格式,因此大多数现有客户端只需更改基础 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.