Pular para o conteúdo

Documentação

Comece com um prompt.

A ScaledThought é feita primeiro para agentes: seu agente se cadastra e faz o trabalho, e você tem um painel para cobrança, chaves e colegas de equipe quando quiser. Tudo aqui foi escrito para você e para o agente. A API é OpenAI-compatible: a maior parte do código com o SDK da OpenAI funciona trocando a URL base e a chave.

Início rápido

1

O mais fácil: peça ao seu agente

Cole isto no Claude Code, no Codex, no Cursor ou em qualquer agente que execute comandos. Ele lê o /llms.txt e executa os passos de configuração.

Abrir este prompt noClaude CodeClaude DesktopCodex

Links diretos para apps que você tem instalados. Claude e Claude Code são marcas da Anthropic; Codex é marca da OpenAI. A ScaledThought não é afiliada a nenhuma delas nem endossada por elas.

Não somos afiliados a Anthropic, OpenAI, Cursor nem a nenhum publicador de modelos, nem endossados por eles. Claude, Claude Code, Codex, Cursor, OpenAI e os nomes dos modelos são marcas de seus respectivos donos.

2

Ou execute um comando

Cria uma conta na região dos EUA, grava ST_API_KEY e ST_BASE_URL no .env e lista os modelos no ar lá. Pode ser executado de novo com segurança: se já houver uma chave, ele apenas informa a conta. A região do Canadá chega em breve; até ela abrir, a API dela não responde e --region ca falha com network_error. Adicione --email com o endereço que deve ser dono da conta: enviamos a ele um link de confirmação e, depois do clique, esse endereço entra no painel. Enviamos para ele e-mails da conta e e-mails do produto que você pode cancelar a qualquer momento.

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

Compre créditos

Cada chamada é paga com créditos pré-pagos, de $10 a $2,000 por recarga, no máximo $2,000 a cada 24 horas e 2 links de aprovação abertos ao mesmo tempo. O agente pede uma recarga e envia a approval_url que recebe à pessoa responsável, que paga com cartão. Até os créditos entrarem, as chamadas retornam 402 insufficient_credits. Mais em Créditos e aprovação.

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

Faça sua primeira chamada

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"}]
  }'

Autenticação

Envie sua chave como bearer token. As chaves valem para uma região e podem ter o próprio orçamento. A URL base é o host da sua região, salvo no .env como ST_BASE_URL: https://api.us.scaledthought.com/v1 (o do Canadá, https://api.ca.scaledthought.com/v1, chega em breve).

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

Chat completions

POST /v1/chat/completions aceita o formato de requisição da OpenAI. Use um id de modelo de npx -y scaledthought@0.6 models --live ou de /pricing.

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"}]
  }'

Streaming

Defina stream: true para receber server-sent events no formato delta da OpenAI.

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="")

Chamada de ferramentas

Passe tools no formato da OpenAI. Os modelos que suportam chamada de ferramentas retornam tool_calls padrão. O suporte e a qualidade variam de modelo para modelo, então confira o card do modelo antes de depender disso.

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)

Saída estruturada

Use response_format com um JSON schema. Nos modelos que suportam isso, a saída é restrita ao schema durante a decodificação. Valide o resultado antes de depender dele.

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 e Codex

POST $ST_BASE_URL/responses fala a OpenAI Responses API, então clientes que usam apenas esse protocolo, como o Codex, podem usar a ScaledThought como provedor de modelos. Ele aceita input (uma string, ou mensagens e itens function_call e function_call_output), instructions, ferramentas de função e personalizadas (formato livre), tool_choice, max_output_tokens, text.format para saída em JSON e stream: true (eventos da Responses API, terminando com response.completed ou response.incomplete com o seu usage, ou response.failed com um error).

Ele não guarda estado. Não armazenamos nenhuma resposta, então envie a conversa inteira em input a cada turno (o Codex faz isso) e não use previous_response_id, que retorna 400 invalid_request; store é sempre false. Ferramentas hospedadas, como busca em arquivos, retornam 400; uma ferramenta de busca na web é ignorada. Requisições sem max_output_tokens recebem como limite o que sobra do contexto do modelo depois do seu prompt, no máximo 32.768 tokens.

A cobrança é a mesma de chat completions: por token, a partir do uso informado pelo servidor do modelo, paga com seus créditos.

# ~/.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

O Codex lê ST_API_KEY do ambiente, então carregue o ./.env no shell antes. wire_api = "responses" é obrigatório: a ScaledThought serve o Codex pela Responses API.

model_catalog_url informa ao Codex as janelas de contexto dos modelos no ar na sua região, para que ele compacte sessões longas a tempo, e dá a ele a ferramenta de edição apply_patch. Ele é gerado a partir dos modelos no ar a cada requisição; o Codex envia sua chave junto, então mantenha-o no mesmo host que base_url (o da sua região).

Anthropic Messages API e 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.

Modelos e benchmarks

GET /v1/models lista os ids dos modelos no ar na sua região, no formato da OpenAI. Essa lista é a referência do que você pode chamar. GET /v1/models/{id} retorna o preço, o tamanho de contexto, a data de lançamento, as pontuações de benchmark e o status de um modelo, para que um agente possa escolher sem que um humano leia uma página web. Para buscar e filtrar, use npx -y scaledthought@0.6 models --live ou a ferramenta MCP models_search. Para pessoas, /pricing lista todos os modelos no ar nos EUA com seus preços, a partir da mesma API.

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

Regiões e retenção

Cada chave fica vinculada à sua região. A região dos EUA está aberta agora; o Canadá (ca) chega em breve; a API dele não responde até ele abrir. As requisições são atendidas e registradas em logs, e os registros de conta e de uso são armazenados, apenas naquele país. Os pagamentos com cartão de todas as regiões são processados pela Stripe nos EUA. Prompts e completions não são armazenados depois que a resposta é retornada e nunca são usados para treinamento. Os arquivos (/v1/files) são apagados após 30 dias, ou antes com DELETE /v1/files/{id}. Toda resposta traz x-st-region e x-st-data-retention: none. Veja segurança (ou /security.json) e a Política de Privacidade (em inglês).

Chaves e orçamentos

Os agentes podem criar chaves com escopo e limites rígidos de gasto diário. Quando um orçamento é atingido, as chamadas retornam 402 em vez de gastar mais. Uma chave revogada para de funcionar em cerca de 30 segundos.

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

Escopos são inference, read, keys, billing. Uma chave só pode dar a uma nova chave os escopos que ela mesma tem (caso contrário, 403 scope_not_allowed). Expiração: envie expires_in (como "30d") ou expires_at, até 365 dias; depois disso a chave recebe 401 key_expired. Uma chave nunca dura mais que a chave que a criou.

Chaves de subagente: com child: true, a nova chave registra a chave que fez a chamada como sua mãe. O orçamento diário dela cabe no que resta hoje à chave mãe, seus limites de taxa e sua expiração não passam dos da mãe, e ela só pode gerenciar as próprias subchaves. Revogar uma chave revoga todas as chaves abaixo dela.

Rotação: POST /v1/keys/{id}/rotate cria uma substituta com o mesmo nome, escopos, orçamento e limites, retornada uma única vez. A chave antiga continua funcionando durante grace (padrão 24h, de "0" a "7d"). Autorrevogação: DELETE /v1/keys/self revoga a chave que fez a chamada e suas chaves de subagente, sem exigir escopo, para que um agente que suspeite de um vazamento possa agir na hora.

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

Mais sobre como as chaves e os dados são protegidos: segurança.

Créditos e aprovação

O uso é pago com créditos pré-pagos, de $10 a $2,000 por recarga, no máximo $2,000 a cada 24 horas e 2 links de aprovação abertos ao mesmo tempo. O agente pede uma recarga ($20 por padrão) e recebe uma approval_url: uma página de pagamento em que a pessoa responsável confirma ou altera o valor, pode ativar a recarga automática e paga com cartão. Os créditos entram assim que o pagamento é confirmado, e enviamos um recibo por e-mail. Nada é cobrado sem essa aprovação. Os créditos não expiram. Quando acabam, as requisições retornam 402 insufficient_credits com o saldo e o valor necessário.

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

A recarga automática é opcional e recomendada: quando o saldo cai abaixo de um limite (padrão $5), o cartão salvo adiciona um valor definido (padrão $20), para que o agente nunca fique parado. A pessoa responsável a ativa na página de pagamento de qualquer recarga, ou sem comprar nada, por um link de configuração da recarga automática (billing auto-reload setup), onde salva um cartão. As cargas são limitadas a $2.000 a cada 24 horas. Ativá-la ou aumentar qualquer limite exige uma nova aprovação; desativá-la ou reduzi-la, não. Se uma recarga for recusada, a recarga automática se desativa sozinha e o próximo 402 diz ao agente para obter um novo link. billing status mostra o saldo e as recargas pendentes; billing transactions lista cada compra, recarga e cobrança.

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

Avisos e webhooks

As respostas podem trazer x-st-notice com códigos separados por vírgula: low_balance (uma conta com saldo abaixo de $5). Um agente que vê um desses códigos deve dizer à pessoa responsável o que aprovar. GET /v1/account, o account_status do MCP, status e doctor mostram os mesmos códigos com o texto a repassar, exceto low_balance quando não resta nenhum crédito (aí GET /v1/account e account_status trazem o passo de recarga em topup).

Os webhooks enviam os mesmos sinais por push: balance.low, key.expiring e budget.exhausted. Os endpoints precisam ser URLs https públicas na porta 443. Cada POST traz x-st-signature: t=…,v1=…, um HMAC-SHA256 de <t>.<raw body> com a chave de assinatura do endpoint, exibida uma única vez quando você o adiciona. As entregas vão para a sua URL onde quer que ela esteja hospedada, mesmo fora da região da sua conta, e trazem apenas id, type, created_at, region, account_id e data: ids, valores inteiros em micro-dólares, contagens de dias e timestamps, nunca prompts, nomes ou e-mails. data por evento: balance.low {balance_micros, threshold_micros}, key.expiring {key_id, expires_at}, budget.exhausted {scope, key_id, budget_micros, spent_today_micros, resets_at}. Entregas que falham são reenviadas com backoff por cerca de dois dias.

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

Cabeçalhos de requisição opcionais: x-st-app dá nome ao seu app nos registros de uso (não é publicado), e x-st-session mantém uma conversa na mesma réplica para que o prefixo em cache seja reaproveitado (só em memória, nunca armazenado). No Canadá, as requisições nunca transbordam para outro país: quando todas as réplicas de um modelo estão ocupadas, a requisição espera um pouco e depois recebe 429 capacity_exhausted com Retry-After.

Inferência em lote

Envie um arquivo JSONL de requisições e receba os resultados, cobrados pelo preço normal por token do modelo. Os lotes rodam numa janela de conclusão de 24 horas e normalmente terminam dentro dela, mas a conclusão no prazo não é garantida. Os endpoints de Files e Batches seguem os da OpenAI, então client.batches.create funciona. Cada linha é validada logo de início, então um arquivo inválido falha em segundos.

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

Servidor MCP

MCP remoto no host da API da sua região: https://api.us.scaledthought.com/mcp (o do Canadá, https://api.ca.scaledthought.com/mcp, chega em breve; Streamable HTTP, especificação 2026-07-28). Autentique-se com sua chave de API como bearer token. O MCP não cria contas: cadastre-se antes com npx -y scaledthought@0.6 init ou POST /v1/accounts, e então npx -y scaledthought@0.6 mcp mostra o comando e a configuração exatos para a sua região. O agente recebe estas ferramentas:

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

Execute como npx -y scaledthought@0.6 <command>. A saída é JSON sempre que o stdout não é um terminal (ou com --json), e os erros são uma linha JSON no stderr com code, message e hint. Nada pede interação. As chaves vêm de ST_API_KEY ou de ./.env, nunca de flags.

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.

Referência da 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.

Limites de taxa

Os limites são por chave. Acima do limite, as chamadas retornam 429 rate_limit_exceeded com um cabeçalho Retry-After em segundos. Até a primeira compra de créditos da conta, as chaves podem reduzir seus limites, mas não aumentá-los.

Conta nova
Requisições / min: 60
Tokens / min: 200,000
Gasto: Até a primeira compra de créditos: até 5 chaves
Créditos pré-pagos
Requisições / min: 3,000
Tokens / min: 5,000,000
Gasto: Créditos que a pessoa responsável compra, de $10 a $2,000 por recarga, $2,000 a cada 24 h
Escala
Requisições / min: Personalizado
Tokens / min: Personalizado
Gasto: Fale com a gente

Erros

Os erros da API são {"error":{"message","type","code"}}. Os erros da CLI acrescentam um hint e saem com código diferente de zero.

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

Agent view · paste this into your agent

Abre o seu agente com o prompt já digitado. Você pressiona Enter.

Links diretos para apps que você tem instalados. Claude e Claude Code são marcas da Anthropic; Codex é marca da OpenAI. A ScaledThought não é afiliada a nenhuma delas nem endossada por elas.

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