For AI agents
An LLM API your agent sets up itself.
ScaledThought is an OpenAI-compatible API for open-weight models that an AI agent signs up for on its own: npx -y scaledthought@0.3 init --region us creates the account and writes an API key to ./.env, and the agent's human approves prepaid credits through a payment link.
Deep links into apps you have installed. Claude and Claude Code are trademarks of Anthropic; Codex is a trademark of OpenAI. ScaledThought is not affiliated with or endorsed by either.
01
How an agent signs up
Tell your agent Set me up on ScaledThought: scaledthought.com/go/org-agents. The link serves /llms.txt, a setup protocol written for agents: every command is non-interactive, prints one JSON object and exits 0, or prints {"error":{"code","message","hint"}} with a code the protocol explains. Agents that can run shell commands, such as Claude Code and Codex, can follow it.
The short version, as the protocol gives it:
initwritesST_API_KEYandST_BASE_URLto./.env(mode 0600) and adds.envto.gitignore. It never prints the key.- Re-running it is safe: with a key already in
.envit creates nothing and returns the existing account. - Creating an account accepts nothing on the human's behalf. They accept the Terms themselves, on the payment page.
- If the human already has an account, the agent runs
npx -y scaledthought@0.3 login --region usinstead: the human types a short code on their dashboard, andlogin --waitwrites a new key. - Only the US region is open. Canada is coming soon.
npx -y scaledthought@0.3 models --live --region us # what's live; no account needed
npx -y scaledthought@0.3 init --region us # the account; its key goes to ./.env
npx -y scaledthought@0.3 billing topup --amount-usd 20 # a payment link for the human; charges nothing
npx -y scaledthought@0.3 billing wait # returns once the human has paid
npx -y scaledthought@0.3 chat -m deepseek-v4-1-flash "Reply with OK" # verify02
Keys and sub-agent keys
Every key can carry scopes, a hard daily budget in USD, rate limits and an expiry of up to 365 days. A sub-agent key (--child) stays within its parent's scopes, budget, rate limits and expiry, and revoking a key revokes every key below it. Keys are stored only as hashes and shown once.
keys put mints a sub-agent key and puts it straight into a platform's secret store (GitHub, Vercel, Fly and others) through that platform's own CLI, with the key on stdin: never printed, never in shell history. The key records where it lives, so a human knows what revoking it breaks.
npx -y scaledthought@0.3 keys create --name researcher --child --budget-usd 2 # a sub-agent key, printed once
npx -y scaledthought@0.3 keys create --name nightly --expires-in 30d --scopes inference,read
npx -y scaledthought@0.3 keys put github --repo acme/app --budget-usd 2 # stored as a GitHub Actions secret
npx -y scaledthought@0.3 keys rotate <id> --grace 24h # the old key keeps working for the grace period
npx -y scaledthought@0.3 keys revoke-self # a key that may have leaked revokes itself03
The human approves every payment
Usage is prepaid and there is no subscription. A new account has no credits, so every completion returns 402 insufficient_credits until its human pays. The agent runs npx -y scaledthought@0.3 billing topup --amount-usd 20, which returns an approval_url and opens the funding page in the human's browser. Creating the link charges nothing: only the human can pay, by card on Stripe's checkout, and billing wait returns as soon as they have.
Top-ups are $10 to $2,000 per top-up, at most $2,000 per 24 hours and 2 open approval links at a time. The human can also turn on auto-reload on the funding page. An agent can turn auto-reload off or lower it, but turning it on or raising it always goes back to the human (403 approval_required). Prepaid credits and budgets
04
Notices and webhooks
API responses carry x-st-notice: low_balance once the credit balance is under $5. The agent tells its human what it means and what to approve, instead of running until requests fail. GET /v1/account, the MCP tool account_status and the CLI's doctor show the same notices.
Instead of polling, an agent can register a webhook for balance.low, key.expiring and budget.exhausted. Deliveries are signed (x-st-signature, HMAC-SHA256) and carry ids, amounts and timestamps only, never prompts.
npx -y scaledthought@0.3 webhooks add https://hooks.example.com/st --events balance.low,budget.exhausted05
CLI, API or MCP
The same account works three ways. The CLI (npx -y scaledthought@0.3) prints JSON whenever its output isn't a terminal. The HTTP API creates an account with POST /v1/accounts (no auth; the key is returned once) and manages keys, budgets, usage and billing. The MCP server at https://api.us.scaledthought.com/mcp gives an MCP client account tools such as account_status, keys_manage, budget_manage, usage_query and billing_topup; it can't create accounts, so sign up first.
Inference is the OpenAI-compatible API: chat completions, the Responses API and batches, with any OpenAI SDK. Point it at ST_BASE_URL and ST_API_KEY from ./.env.
import os
from openai import OpenAI
client = OpenAI(base_url=os.environ["ST_BASE_URL"], api_key=os.environ["ST_API_KEY"])
resp = client.chat.completions.create(
model="deepseek-v4-1-flash", # or a model id from `npx -y scaledthought@0.3 models --live`
messages=[{"role": "user", "content": "Hello"}],
)06
What stays with the human
- Paying. Only the human pays, on Stripe's page, and accepts the Terms there.
- Turning auto-reload on or raising it.
- The dashboard (billing, keys, teammates, connecting agents), which the agent opens for them with
npx -y scaledthought@0.3 dashboard. A person can also sign up there themselves, by email link: app.us.scaledthought.com/sign-up (US accounts only for now).
Questions
- Can an AI agent create its own API key?
- Yes.
npx -y scaledthought@0.3 init --region uscreates the account and writes the key to./.envwithout printing it;POST /v1/accountsdoes the same over HTTP and returns the key once. - Does the agent need a credit card?
- No. The agent creates a payment link with
billing topupand its human pays on it. Until then requests return402 insufficient_credits. - How do I limit what a sub-agent can spend?
- Give it its own key:
keys create --name <name> --child --budget-usd 2. A sub-agent key's daily budget, scopes, rate limits and expiry stay within its parent's. When the budget is spent, its requests return402 budget_exceededuntil 00:00 UTC. - What happens when the credits run out?
- Below $5, responses carry
x-st-notice: low_balanceso the agent can ask for a top-up early. At zero, requests return402 insufficient_creditswithbalance_usdandrequired_usd, unless the human turned on auto-reload. - Which agents does it work with?
- Any agent that can run shell commands or call an HTTP API. There are step-by-step guides for Claude Code, Codex, Cursor, Aider, Cline, Continue, Zed and LiteLLM.
Read next