跳到正文

文档

一条提示词即可开始。

ScaledThought 以智能体为先:你的智能体负责注册和具体工作,需要时你可以使用一个控制台来管理账单、密钥和团队成员。这里的所有内容都同时写给你和智能体。API 是 OpenAI-compatible 的:大多数 OpenAI SDK 代码只需更改 base URL 和密钥即可使用。

快速入门

1

最简单:让你的智能体来做

把这段内容粘贴到 Claude Code、Codex、Cursor 或任何能运行命令的智能体中。它会读取 /llms.txt 并执行配置步骤。

在以下应用中打开此提示词Claude CodeClaude DesktopCodex

这些是指向你已安装应用的深层链接。Claude 和 Claude Code 是 Anthropic 的商标;Codex 是 OpenAI 的商标。ScaledThought 与二者均无关联,也未获得二者认可。

与 Anthropic、OpenAI、Cursor 或任何模型发布方均无关联,也未获得其认可。Claude、Claude Code、Codex、Cursor、OpenAI 及各模型名称均为其所有者的商标。

2

或者运行一条命令

在美国区域创建账户,把 ST_API_KEY 和 ST_BASE_URL 写入 .env,并列出该区域已上线的模型。可以放心重复运行:如果已有密钥,它只会报告账户信息。加拿大区域即将推出;在开放之前,它的 API 不会响应,--region ca 会以 network_error 失败。 用 --email 指定应拥有该账户的邮箱:我们会向它发送一封确认链接,点击后即可用该邮箱登录控制台。我们会向它发送账户相关邮件,以及可随时退订的产品邮件。

shell
npx -y scaledthought@0.6 init --region us --email you@example.com
3

购买额度

每次调用都从预付额度中支付,每次充值 $10 至 $2,000,每 24 小时最多 $2,000,同时最多 2 个未完成的审批链接。智能体申请充值,并把返回的 approval_url 发给人类用户,由对方用银行卡付款。额度到账之前,调用会返回 402 insufficient_credits。详见额度与审批。

shell
npx -y scaledthought@0.6 billing topup --amount-usd 20
4

发起第一次调用

curl "$ST_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $ST_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "deepseek-v4-1-flash",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

认证

把密钥作为 bearer token 发送。密钥限定于一个区域,并且可以有自己的预算。base URL 是你所在区域的主机,以 ST_BASE_URL 保存在 .env 中:https://api.us.scaledthought.com/v1(加拿大的 https://api.ca.scaledthought.com/v1 即将推出)。

headers
Authorization: Bearer $ST_API_KEY
Content-Type: application/json

对话补全

POST /v1/chat/completions 接受 OpenAI 的请求格式。请使用来自 npx -y scaledthought@0.6 models --live 或 /pricing 的模型 id。

curl "$ST_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $ST_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "deepseek-v4-1-flash",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

流式输出

设置 stream: true,即可以 OpenAI delta 格式接收服务器发送事件(server-sent events)。

stream = client.chat.completions.create(
    model="deepseek-v4-1-flash",
    messages=[{"role": "user", "content": "Write a haiku about open weights"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

工具调用

以 OpenAI 格式传入 tools。支持工具调用的模型会返回标准的 tool_calls。支持程度和质量因模型而异,依赖它之前请先查看该模型的说明卡片。

Python
resp = client.chat.completions.create(
    model="deepseek-v4-1-flash",
    messages=[{"role": "user", "content": "Weather in Toronto?"}],
    tools=[{
        "type": "function",
        "function": {
            "name": "get_weather",
            "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
        },
    }],
)
print(resp.choices[0].message.tool_calls)

结构化输出

使用带 JSON schema 的 response_format。在支持该功能的模型上,输出会在解码时被约束为符合该 schema。依赖结果之前请先进行验证。

Python
resp = client.chat.completions.create(
    model="deepseek-v4-1-flash",
    messages=[{"role": "user", "content": invoice_text}],
    response_format={
        "type": "json_schema",
        "json_schema": {"name": "invoice", "schema": {
            "type": "object",
            "properties": {"vendor": {"type": "string"}, "total": {"type": "number"}},
            "required": ["vendor", "total"],
        }},
    },
)

Responses API 与 Codex

POST $ST_BASE_URL/responses 支持 OpenAI Responses API,因此只使用该协议的客户端(例如 Codex)可以把 ScaledThought 作为模型提供方。它接受 input(字符串,或消息、function_call 和 function_call_output 条目)、instructions、函数工具和自定义(自由格式)工具、tool_choice、max_output_tokens、用于 JSON 输出的 text.format,以及 stream: true(Responses 事件,以带 usage 的 response.completed 或 response.incomplete 结束,或以带 error 的 response.failed 结束)。

它是无状态的。我们不存储任何响应,所以每一轮都要在 input 中发送完整对话(Codex 就是这样做的),并且不要传 previous_response_id,否则会返回 400 invalid_request;store 始终为 false。文件搜索等托管工具会返回 400;网页搜索工具会被忽略。没有 max_output_tokens 的请求,上限为模型上下文在你的提示词之后剩余的长度,最多 32,768 个 token。

计费方式与对话补全相同:按 token 计费,依据模型服务器报告的用量,从你的额度中支付。

# ~/.codex/config.toml
model = "deepseek-v4-1-flash"  # or a model id from `npx -y scaledthought@0.6 models --live`
model_provider = "scaledthought"

[model_providers.scaledthought]
name = "ScaledThought"
base_url = "https://api.us.scaledthought.com/v1"  # your ST_BASE_URL
env_key = "ST_API_KEY"
wire_api = "responses"
model_catalog_url = "https://api.us.scaledthought.com/v1/codex/models"  # same host (and region) as base_url

Codex 从环境变量中读取 ST_API_KEY,所以请先把 ./.env 加载到 shell 中。wire_api = "responses" 是必需的:ScaledThought 通过 Responses API 为 Codex 提供服务。

model_catalog_url 告诉 Codex 你所在区域已上线模型的上下文窗口,使它能及时压缩长会话,并为它提供 apply_patch 编辑工具。它在每次请求时根据已上线的模型生成;Codex 会随请求发送你的密钥,所以请让它与 base_url 使用同一个主机(你所在区域的主机)。

Anthropic Messages API 与 Claude Code

POST /v1/messages accepts Anthropic Messages API requests, so Claude Code and the Anthropic SDKs can send them to ScaledThought's open-weight models. The models are ours, not Claude. It takes system, messages with text, image, tool_use and tool_result blocks, tools with input_schema, tool_choice, max_tokens, stop_sequences, temperature, top_p, thinking and stream: true (Anthropic's events, from message_start to message_stop). Authenticate with x-api-key or Authorization: Bearer, using your st_ key.

A request that names a Claude model (claude-…, which Claude Code sends for small background tasks) is answered by a ScaledThought model, and the response names that model. Server tools such as web search are ignored; PDFs and Anthropic-defined tools such as bash_20250124 return 400. max_tokens is lowered to what the model's context leaves after your prompt. POST /v1/messages/count_tokens returns an estimate (estimated: true).

Errors use Anthropic's error format with our code inside. Billing is the same as chat completions: per token, from the usage the model server reports, paid from your credits.

set -a; . ./.env; set +a  # puts ST_API_KEY in the environment
export ANTHROPIC_BASE_URL=https://api.us.scaledthought.com  # your region's host, without /v1
export ANTHROPIC_AUTH_TOKEN="$ST_API_KEY"
export ANTHROPIC_MODEL=deepseek-v4-1-flash  # or a model id from `npx -y scaledthought@0.6 models --live`
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-1-flash  # Claude Code's small background tasks
claude

Claude Code reads these variables from the environment, so load ./.env into the shell first. ANTHROPIC_API_KEY works instead of ANTHROPIC_AUTH_TOKEN (it is sent as x-api-key). Leave /v1 off the base URL: Claude Code adds /v1/messages.

Requests Claude Code sends under a Claude model name are answered by a ScaledThought model; set ANTHROPIC_DEFAULT_SONNET_MODEL and ANTHROPIC_DEFAULT_OPUS_MODEL too if you pick models by alias. Anthropic's server tools, such as web search, run on Anthropic's side; ScaledThought ignores them, so they are not available here.

模型与基准测试

GET /v1/models 以 OpenAI 的格式列出你所在区域已上线的模型 id。这个列表就是你能调用哪些模型的准确依据。GET /v1/models/{id} 返回单个模型的价格、上下文长度、发布日期、基准测试分数和上线状态,让智能体无需有人去阅读网页就能做出选择。如需搜索和筛选,请使用 npx -y scaledthought@0.6 models --live 或 MCP 工具 models_search。面向人的 /pricing 页面列出美国所有已上线的模型及其价格,数据来自同一个 API。

curl "$ST_BASE_URL/models"
curl "$ST_BASE_URL/models/deepseek-v4-1-flash"

区域与数据保留

每个密钥都固定在其区域。美国区域现已开放;加拿大(ca)即将推出,在开放之前它的 API 不会响应。请求只在该国家内处理并记录日志,账户和用量记录也只存储在该国家。所有区域的银行卡付款都由 Stripe 在美国处理。提示词和补全在响应返回后不会被存储,也绝不会用于训练。文件(/v1/files)在 30 天后删除,也可以用 DELETE /v1/files/{id} 提前删除。每个响应都带有 x-st-region 和 x-st-data-retention: none。参见安全(或 /security.json)以及隐私政策 (英文)。

密钥与预算

智能体可以创建限定范围的密钥,并设置严格的每日支出上限。达到预算后,调用会返回 402,而不会继续花费。被吊销的密钥会在大约 30 秒内失效。

npx -y scaledthought@0.6 keys create --name support-bot --budget-usd 40

权限范围为 inference, read, keys, billing。一个密钥只能给新密钥授予它自己拥有的权限范围(否则返回 403 scope_not_allowed)。有效期:发送 expires_in(例如 "30d")或 expires_at,最长 365 天;到期后该密钥会收到 401 key_expired。密钥的有效期永远不会超过创建它的密钥。

子智能体密钥:设置 child: true 后,新密钥会把调用它的密钥记录为父密钥。它的每日预算不超过父密钥当天剩余的预算,速率限制和有效期不高于父密钥,并且只能管理自己的子密钥。吊销一个密钥会同时吊销它下面的所有密钥。

轮换:POST /v1/keys/{id}/rotate 会生成一个名称、权限范围、预算和限制都相同的替换密钥,只返回一次。旧密钥在 grace 期间继续有效(默认 24h,可设为 "0" 到 "7d")。自我吊销:DELETE /v1/keys/self 会吊销调用它的密钥及其子智能体密钥,无需任何权限范围,因此怀疑密钥泄露的智能体可以立即采取行动。

npx -y scaledthought@0.6 keys create --name sub-agent --child --scopes inference --budget-usd 2 --expires-in 12h
npx -y scaledthought@0.6 keys rotate key_… --grace 24h
npx -y scaledthought@0.6 keys revoke-self

关于密钥和数据如何受到保护,详见安全。

额度与审批

用量从预付额度中支付,每次充值 $10 至 $2,000,每 24 小时最多 $2,000,同时最多 2 个未完成的审批链接。智能体申请充值(默认 $20),并获得一个 approval_url:这是一个充值页面,人类用户可以在上面确认或修改金额、开启自动充值,并用银行卡付款。确认付款后额度到账,我们会通过邮件发送收据。未经这一批准,绝不会产生任何扣款。额度不会过期。额度用完时,请求会返回 402 insufficient_credits,附带余额和所需金额。

npx -y scaledthought@0.6 billing topup --amount-usd 10

自动充值是可选的,也是推荐的:当余额低于某个阈值(默认 $5)时,已保存的银行卡会充入一笔设定的金额(默认 $20),这样智能体就不会停下来。人类用户可以在任意一次充值的充值页面上开启它,也可以不购买任何东西,通过自动充值设置链接(billing auto-reload setup)保存银行卡来开启。充值上限为每 24 小时 $2,000。开启它或提高任何限额都需要新的批准;关闭它或调低限额则不需要。如果某次自动充值被拒,自动充值会自行关闭,下一次 402 会告诉智能体去获取新的链接。billing status 显示余额和所有待处理的充值;billing transactions 列出每一笔购买、自动充值和扣款。

npx -y scaledthought@0.6 billing topup --amount-usd 10 --auto-reload-below 5 --auto-reload-amount 20
npx -y scaledthought@0.6 billing auto-reload setup --below 5 --amount 20   # no purchase: they save a card
npx -y scaledthought@0.6 billing auto-reload off

通知与 Webhook

响应可能带有 x-st-notice,内容是以逗号分隔的代码:low_balance(账户余额低于 $5)。看到它的智能体应当告诉人类用户需要批准什么。GET /v1/account、MCP account_status、status 和 doctor 会显示相同的代码,以及应转告的说明文字,但余额完全用尽时不含 low_balance(此时 GET /v1/account 和 account_status 在 topup 中给出充值步骤)。

Webhook 会主动推送相同的信号:balance.low、key.expiring 和 budget.exhausted。端点必须是 443 端口上的公开 https URL。每个 POST 都带有 x-st-signature: t=…,v1=…,这是用该端点的签名密钥对 <t>.<raw body> 计算的 HMAC-SHA256,签名密钥只在你添加端点时显示一次。无论你的 URL 托管在哪里,即使在账户所在区域之外,投递都会发送到该 URL,并且只携带 id、type、created_at、region、account_id 和 data:id、以整数微美元表示的金额、天数和时间戳,绝不包含提示词、姓名或邮箱。每个事件的 data:balance.low {balance_micros, threshold_micros},key.expiring {key_id, expires_at},budget.exhausted {scope, key_id, budget_micros, spent_today_micros, resets_at}。投递失败会以退避方式重试约两天。

npx -y scaledthought@0.6 webhooks add https://hooks.example.com/st --events balance.low,budget.exhausted

可选的请求头:x-st-app 在用量记录中标注你的应用名称(不会公开),x-st-session 让同一段对话保持在同一个副本上,以便复用其缓存前缀(只在内存中,从不存储)。在加拿大,请求绝不会溢出到其他国家:当某个模型的所有副本都繁忙时,请求会短暂等待,然后收到带 Retry-After 的 429 capacity_exhausted。

批量推理

上传一个包含请求的 JSONL 文件,获得结果,按模型的正常每 token 价格计费。批处理在 24 小时的完成窗口内运行,通常会在窗口内完成,但不保证按时完成。Files 和 Batches 端点与 OpenAI 的一致,所以 client.batches.create 可以直接使用。每一行都会预先验证,因此有问题的文件会在几秒内失败。

batch_file = client.files.create(file=open("requests.jsonl", "rb"), purpose="batch")
batch = client.batches.create(
    input_file_id=batch_file.id,
    endpoint="/v1/chat/completions",
    completion_window="24h",
)
# later
batch = client.batches.retrieve(batch.id)
results = client.files.content(batch.output_file_id).text

MCP 服务器

远程 MCP 位于你所在区域的 API 主机上:https://api.us.scaledthought.com/mcp(加拿大的 https://api.ca.scaledthought.com/mcp 即将推出;Streamable HTTP,2026-07-28 规范)。用你的 API 密钥作为 bearer token 进行认证。MCP 不能创建账户:请先用 npx -y scaledthought@0.6 init 或 POST /v1/accounts 注册,然后 npx -y scaledthought@0.6 mcp 会打印适用于你所在区域的确切命令和配置。智能体会获得以下工具:

npx -y scaledthought@0.6 mcp
account_status
Region, spend, credit balance, auto-reload, key count and notices (tell your human about each). Call it first.
account_settings
Read or change account settings. name renames the account (keys or billing scope; blank = the default). ad_measurement: false opts the account out of ad measurement; any key can do it.
keys_manage
List, create, rotate or revoke keys (action: list | create | rotate | revoke | revoke_self). create and rotate return the full key once; create takes scopes, expires_in, child (a sub-agent key) and lives_in (where it will be stored); rotate takes grace. revoke_self revokes the key in use.
budget_manage
Set or clear a key's hard daily budget (USD) and rate limits.
webhooks
Signed HTTPS callbacks for balance.low, key.expiring and budget.exhausted (action: add | list | remove). add returns signing_secret once.
models_search
Models with prices, context, benchmarks and live status in your region (live_only, category, search).
benchmarks_get
Our own per-task scores and speed for one model.
usage_query
Requests, tokens and cost over the last N days, by model, day or key.
billing_topup
With amount_usd (and optional auto_reload): an approval_url for your human to buy credits. action: status | transactions | auto_reload_off.
docs_search
Where the docs, llms.txt and your base URL are.

CLI

以 npx -y scaledthought@0.6 <command> 的形式运行。只要 stdout 不是终端(或使用 --json),输出就是 JSON;错误是 stderr 上的一行 JSON,包含 code、message 和 hint。不会出现任何交互式提示。密钥来自 ST_API_KEY 或 ./.env,从不来自命令行参数。

init --region us --email you@example.com
Account and key in the US. Writes ST_API_KEY and ST_BASE_URL to .env. Safe to re-run. Canada (ca) is coming soon. --email (ask your human first) gets one confirmation link; once clicked, that address owns the account and signs in to the dashboard. Account email, and product emails they can unsubscribe from.
init --account Acme
In a new folder on a machine with saved accounts: use that account with a new project key (init asks which when there are several). --new-account makes a separate account; --no-save keeps the key out of this machine's credential store.
login --region us
Connect to an existing account: prints a code your human types on the dashboard's connect page (opened in their browser). Then run login --wait.
login --wait
Waits about 90 s for your human to approve the code, then writes a new key to .env (never printed). Re-run on authorization_pending.
login --code -
Use a connect line made on the dashboard: paste its stl_ code when asked (input hidden, out of shell history), or pipe it in on stdin. Already approved, works once for 15 minutes.
use "Side project"
Point this folder at another account saved on this machine: a new project key in .env; the folder's old project key is revoked.
auth status
Who this folder is signed in as: the account, region, and the key's prefix and where it comes from (never the key). auth list shows the accounts saved on this machine; auth forget <name> drops one (nothing is revoked).
logout
Sign this folder out: its key leaves .env. --revoke also revokes it (not a key saved for the account on this machine, which other folders use).
init --region us --source a-rd
The same, recording the campaign code of the scaledthought.com/go/<code> link that brought you (optional). An invalid code is dropped with a warning.
models --live
Models serving in your region now, newest first, with prices. Filter with --category or --search. The US list is also on /pricing.
models <id>
Pricing, context, benchmarks and live status for one model.
chat -m <id> "prompt"
Send one message to a model id from models --live.
account
Region, spend, credit balance and owner_email_status (confirmed, pending or not_set).
account email set you@example.com
Name your human as the account's owner (ask them first): we email them one confirmation link and they own the account once they click it. Before anyone has signed in or paid.
account rename "Acme research"
Rename the account, as shown on the dashboard and in its emails (keys or billing scope). "" goes back to the default.
account ad-measurement off
Opt out of ad measurement: nothing about the account is ever sent to an ad platform. on turns it back on.
keys create --name <name> --budget-usd 5
New key with a hard daily budget in USD. The key is printed once.
keys create --name <name> --expires-in 30d --scopes inference,read
A key that expires (at most 365d) with a subset of your key's scopes.
keys create --name <name> --child --budget-usd 2
A sub-agent key: scopes, budget, rate limits and expiry within your key's; revoked when your key is.
keys list
Your keys (prefixes only).
keys rotate <id> --grace 24h
Replace a key: the new key is printed once; the old one keeps working for the grace period (0 to 7d).
keys revoke <id> --confirm <id>
Revoke a key and its sub-agent keys (the id again confirms it). They stop working within about 30 seconds.
keys revoke-self
Revoke the key you are using now (and its sub-agent keys), e.g. if it may have leaked. Irreversible.
keys put github --repo <owner/repo> --budget-usd 2
Put a new sub-agent key straight into a platform's secret store as ST_API_KEY, through its own CLI with the key on stdin (never printed). Destinations: github, vercel, fly, cloudflare, gcp, aws, k8s, doppler. The key is named after the place and records where it lives (lives_in). If storing fails, the new key is revoked.
keys rotate --all --push --grace 1h
Rotate every key that keys put stored somewhere and put each replacement in the same place; the old keys stop after the grace period. Prints no keys. One key: keys rotate <id> --push.
connect opencode
Point an OpenAI-compatible tool at ScaledThought: opencode and aider get the base URL and their own sub-agent key in their config (files 0600, key never printed); cursor and continue get steps for your human.
usage --days 7 --by model
Requests, tokens and cost by model, day or key.
billing status
Credit balance, auto-reload, pending top-ups.
billing topup --amount-usd 20
Buy prepaid credits ($10 to $2,000 per top-up, at most $2,000 per 24 hours and 2 open approval links at a time; default 20): opens the funding page in your human's browser, where they confirm the amount, can turn on auto-reload and pay.
billing wait
Returns as soon as your human pays the open top-up, with the new balance. Polls about 90 seconds a run; run it again on topup_pending.
billing topup --amount-usd 20 --auto-reload-below 5 --auto-reload-amount 20
Top up with auto-reload pre-selected on the funding page (your human can untick it).
billing auto-reload setup --below 5 --amount 20
Turn auto-reload on without buying anything: opens a page where your human saves a card. Then billing wait.
billing auto-reload off
Turn auto-reload off. No approval needed.
billing transactions
The credit ledger: purchases, auto-reloads, usage, batches, refunds.
batches create requests.jsonl
Upload a JSONL file and start a batch, billed at the normal price. Needs prepaid credits.
webhooks add https://hooks.example.com/st --events balance.low,budget.exhausted
Get a signed POST when the balance is low, a key is about to expire or a budget is spent (default: every event). Prints signing_secret once.
webhooks list
Your webhook endpoints.
webhooks delete <id> --confirm <id>
Delete a webhook endpoint.
doctor
Checks the key in .env, its region, the account and its credit, and lists notices to tell your human.
mcp
Prints the `claude mcp add` command and JSON config for your region.
dashboard --page billing
Opens your human's dashboard (overview, billing, keys, members, connect) in their browser. If they aren't signed in, one click emails them a link (once they've confirmed their email).
members list
Who can sign in to the account's dashboard: email, role (owner or member), status.
status
Per-model health in your region over the last hour, plus your account's notices when a key is set.

API 参考

POST /v1/accounts
Create an account in this host's region. Returns api_key (once) and base_url. No auth. Optional source: the campaign code from a /go/<code> link.
POST /v1/chat/completions
Chat, tools, JSON output, streaming. OpenAI-compatible.
POST /v1/responses
The OpenAI Responses API (Codex): function and custom tools, streaming. Stateless: send the whole conversation each turn; previous_response_id isn't supported.
POST /v1/messages
Anthropic Messages API requests (Claude Code, the Anthropic SDKs), answered by our models: tools, images, streaming. x-api-key or Bearer. Claude model names are answered by a ScaledThought model.
POST /v1/messages/count_tokens
An estimate of a Messages request's input tokens (estimated: true). No charge.
POST /v1/completions
Raw text completion.
GET /v1/models
Model ids live in this region (OpenAI list format). No auth.
GET /v1/models/{id}
One model: pricing, context, benchmarks and live_in_region. No auth.
GET /v1/models/{id}/benchmarks
Our own per-task scores and speed.
GET /v1/account
Plan, region, balance, spend, key count and notices (low_balance) with notice_text to relay to your human.
PATCH /v1/account
Account settings: {"name": "…"} renames the account (keys or billing scope; blank or null = the default). {"ad_measurement": false} opts out of ad measurement (any key); true needs the keys or billing scope.
GET /v1/keys
List keys.
POST /v1/keys
Create a key: scopes (a subset of yours), daily_budget_usd, rate limits, expires_in or expires_at (max 365d), child: true for a sub-agent key, lives_in (where it will be stored, display only).
POST /v1/keys/{id}/rotate
Replace a key. The new key is returned once; the old one works for grace (default 24h, 0 to 7d).
PATCH /v1/keys/{id}
Change a key's name, daily budget, rate limits or lives_in (null clears it).
DELETE /v1/keys/{id}
Revoke a key and its sub-agent keys.
DELETE /v1/keys/self
The calling key revokes itself and its sub-agent keys. No scope needed.
GET /v1/usage
Requests, tokens and cost (days, group_by).
GET /v1/billing
Credit balance, auto-reload, pending top-ups and recent transactions.
POST /v1/billing/topup
Buy credits: {amount_usd, auto_reload?} returns an approval_url for your human.
GET /v1/billing/topups/{id}
One top-up's status (open, paid, expired, failed).
PATCH /v1/billing/auto-reload
Disable or lower auto-reload. Raising it needs a new top-up approval.
GET /v1/billing/transactions
The credit ledger, newest first (cursor).
POST /v1/webhooks
Add a webhook: {url (public https, port 443), events}. Returns signing_secret once. Billing scope; at most 5.
GET /v1/webhooks
Your webhook endpoints (status, last success and failure).
DELETE /v1/webhooks/{id}
Delete a webhook endpoint.
POST /v1/files
Upload JSONL (purpose=batch for a batch).
POST /v1/batches
Start a batch. GET /v1/batches/{id} to poll, POST /v1/batches/{id}/cancel to stop.
GET /v1/status
Per-model health in this region, last hour.
POST /v1/dashboard/link
A URL for your human's dashboard (optional page), the owners, and a message to relay. billing or keys scope.
POST /v1/device/codes
Ask to connect to an existing account. No key. Returns device_code (secret), user_code for your human to type at verification_url, expires_in, interval.
POST /v1/device/token
Collect the key once approved: {device_code}, or {connect_code} (stl_…) for a dashboard connect line. 428 authorization_pending until then; one key per code, with the approver's scopes.
GET /v1/members
Who can sign in to the dashboard (email, role, status). read scope.

速率限制

限制按密钥计算。超过限制时,调用会返回 429 rate_limit_exceeded,并带有以秒为单位的 Retry-After 头。在账户首次购买额度之前,密钥只能调低限制,不能调高。

新账户
请求 / 分钟: 60
Token / 分钟: 200,000
支出: 首次购买额度之前:最多 5 个密钥
预付额度
请求 / 分钟: 3,000
Token / 分钟: 5,000,000
支出: 由人类用户购买的额度,每次充值 $10 至 $2,000,每 24 小时上限 $2,000
规模化
请求 / 分钟: 定制
Token / 分钟: 定制
支出: 联系我们

错误

API 错误的格式为 {"error":{"message","type","code"}}。CLI 错误会额外包含 hint,并以非零状态码退出。

400
代码: invalid_request
处理方式: Fix the field named in message. Don't retry unchanged.
400
代码: invalid_body
处理方式: Fix the field named in message. Don't retry unchanged.
400
代码: invalid_json
处理方式: Send valid JSON with `content-type: application/json`.
401
代码: invalid_api_key
处理方式: Key missing, mistyped or revoked. Load ST_API_KEY from .env; don't create a new account.
401
代码: missing_api_key
处理方式: Send `Authorization: Bearer $ST_API_KEY`.
401
代码: key_expired
处理方式: The key's expires_at has passed. Use another key, or create a new one with a key that has the keys scope.
400
代码: invalid_expiry
处理方式: expires_in or expires_at must be in the future and at most 365 days ahead. Send one, not both.
400
代码: expiry_exceeds_parent
处理方式: A key can't outlive the key that creates it. Ask for at most max_expires_at from the body.
403
代码: scope_not_allowed
处理方式: Ask only for scopes your own key has (allowed_scopes in the body).
400
代码: budget_exceeds_parent
处理方式: A sub-agent key's daily budget must fit in what its parent has left today (max_daily_budget_usd in the body).
400
代码: limit_exceeds_parent
处理方式: A sub-agent key's rate limits and budget can't exceed its parent's (or, when it changes itself, its own).
400
代码: key_depth_exceeded
处理方式: Sub-agent keys nest at most 16 levels. Create the key from a key higher up.
404
代码: key_not_found
处理方式: No such key on this account, or (for a sub-agent key) it's outside the keys you created.
409
代码: key_not_active
处理方式: Only an active key can be rotated. Create a new key instead.
402
代码: budget_exceeded
处理方式: This key's daily budget is spent. Resets 00:00 UTC. Tell your human; don't retry now.
402
代码: insufficient_credits
处理方式: The credit balance can't cover the request (the body has balance_usd and required_usd). Run `billing topup --amount-usd 20` and send your human the approval_url.
402
代码: daily_cap_exceeded
处理方式: An operator-set daily cap on this account is reached. Resets 00:00 UTC. Tell your human.
402
代码: credits_required_for_batches
处理方式: Batches are paid from prepaid credits. Run `billing topup --amount-usd 20`, then retry once your human approves.
409
代码: too_many_pending_topups
处理方式: The account already has 2 unpaid approval links. Ask your human to pay one (`billing status` lists them), or wait for them to expire.
409
代码: daily_topup_limit
处理方式: Top-ups are limited to $2,000 per account per rolling 24 hours, open links and auto-reloads included. Retry with at most available_usd from the body, or wait.
403
代码: approval_required
处理方式: Turning auto-reload on or raising it needs your human. Run `billing auto-reload setup --below <usd> --amount <usd>` (a link your human approves; nothing is bought) and give them the approval_url. Disabling or lowering needs no approval.
402
代码: free_tier_key_limit
处理方式: Accounts that haven't bought credits have 5 active keys. Revoke one (`keys revoke <id> --confirm <id>`) or buy credits.
402
代码: free_tier_limit
处理方式: Accounts that haven't bought credits can't raise budgets or rate limits. Buy credits first (`billing topup --amount-usd 20`).
409
代码: model_not_live
处理方式: That model isn't served in your region yet. Pick one from `models --live`.
400
代码: invalid_video_url
处理方式: video_url must be a public https URL or a data:video/mp4 (webm, mov) URL within the size limit.
403
代码: insufficient_scope
处理方式: This key lacks the scope. Use the default key from init.
403
代码: account_suspended
处理方式: Stop. Tell your human to email hello@scaledthought.com.
404
代码: model_not_found
处理方式: Not live here. Pick an id from `models --live` or `GET $ST_BASE_URL/models`.
404
代码: not_found
处理方式: Wrong path. ST_BASE_URL already ends in /v1; append /chat/completions.
421
代码: wrong_region
处理方式: The key belongs to the other region. Use the `base_url` in the error body; remove any hard-coded host.
429
代码: rate_limit_exceeded
处理方式: Wait `Retry-After` seconds, then retry.
429
代码: capacity_exhausted
处理方式: Canada: every replica of the model is busy and Canadian requests never overflow to another country. Wait `Retry-After` seconds and retry with backoff, or use another model.
400
代码: invalid_webhook_url
处理方式: Webhook URLs must be public https endpoints on port 443 (no other port, no private, loopback or internal hosts). Fix the URL.
409
代码: too_many_webhooks
处理方式: An account has at most 5 webhook endpoints. Remove one (`webhooks delete <id> --confirm <id>`) first.
404
代码: webhook_not_found
处理方式: No such webhook on this account. List them with `webhooks list`.
503
代码: webhooks_unavailable
处理方式: Webhooks aren't enabled in this region yet. Poll `GET /v1/account` for `notices` instead.
502
代码: upstream_error
处理方式: Transient. Retry with backoff, or use another model from `models --live`.
503
代码: region_not_open
处理方式: The Canada region isn't open yet. Check with your human that US hosting is acceptable, then use `init --region us` and the US host.
503
代码: service_unavailable
处理方式: Transient. Retry in a few seconds.
exit 1
代码: no_key
处理方式: No ST_API_KEY in the environment or ./.env. For an existing account run `login`; for a new one, `init --region us`.
exit 1
代码: key_exists
处理方式: login: this folder already has a key. Use it, or pass --force to replace it.
428
代码: authorization_pending
处理方式: login --wait: your human hasn't typed the code yet. Run it again (codes last 10 minutes).
410
代码: expired_token
处理方式: The connect code expired. Run `login` again for a new one.
409
代码: already_claimed
处理方式: A connect code works once. Run `login` again (or ask for a new connect line).
403
代码: access_denied
处理方式: Your human denied the connection. Ask them before trying again.
exit 1
代码: region_mismatch
处理方式: A key from the other region already exists here. Use it, or ask your human before creating a second account elsewhere.
exit 1
代码: wrong_region_endpoint
处理方式: ST_BASE_URL / ST_API_URL points at the other region. Unset it. Nothing was sent.
exit 1
代码: network_error
处理方式: Couldn't reach the API. Check the network, then retry.
exit 1
代码: bad_region
处理方式: Use `--region us`. Canada (`ca`) is coming soon.
exit 2
代码: usage_error
处理方式: Unknown command, flag or missing argument. Run the command with --help.

Agent view · paste this into your agent

打开你的智能体并填好提示词,由你按 Enter。

这些是指向你已安装应用的深层链接。Claude 和 Claude Code 是 Anthropic 的商标;Codex 是 OpenAI 的商标。ScaledThought 与二者均无关联,也未获得二者认可。

Agents can read the whole site as markdown at scaledthought.com/llms.txt.