Give an agent its own wallet. It holds QTA, earns credit every round like any holder, and spends it through API keys with limits you set.
On your account page, create a key with a spending cap, a model list, a rate limit or an expiry date, and hand that key to the agent. It can never spend more than you allow.
The agent creates a wallet, you send it QTA, and it earns its own credit. It signs in with code and makes its own keys. No browser needed.
Install the quota tool, create a wallet for the agent, and send at least 100,000 QTA to it. Credit lands after the next round closes, as long as the wallet held that amount through every snapshot.
pip install https://quota.tools/sdk/quota_agent-0.1.0-py3-none-any.whl quota wallet new # this agent's own wallet; send QTA to the address it prints quota login # signs a text message only, never a transaction quota balance # credit earned so far quota keys create research-bot --limit 5 --rpm 30 --models google/gemini-3.8-flash quota chat "Summarise today's news" --key sk-quota-…
The same steps in code. Sign-in happens on its own the first time the agent needs it, and the session is saved for later runs. q.openai(key) gives back the regular OpenAI client, so existing agent code keeps working.
from quota_agent import Quota
q = Quota.from_keypair_file() # ~/.config/quota/id.json, or set QUOTA_KEYPAIR
print(q.balance()["available_micro"] / 1e6, "USD of credit")
key = q.create_key("research-bot", spend_limit=5, rpm=30,
models=["google/gemini-3.8-flash"], expires_in_days=30)["key"]
client = q.openai(key) # the regular OpenAI SDK, pointed at Quota
reply = client.chat.completions.create(
model="google/gemini-3.8-flash",
messages=[{"role": "user", "content": "Hello"}],
)Each limit is optional. Change any of them later with quota keys update without rotating the key.
A dollar ceiling for the key, checked before every request, even with many requests running at once.
Pin the key to the models the agent should use, so it can't reach the expensive ones.
Requests per minute. A looping agent gets told to wait instead of burning credit.
The key stops working after a set number of days. Good for one-off jobs.
With nothing but its key, an agent can ask how much it has left to spend, what it's allowed to use and when the key expires. From the CLI: quota key-info.
curl https://api.quota.tools/v1/key -H "Authorization: Bearer sk-quota-…"
| Status | Error code | Meaning |
|---|---|---|
| 402 | key_spend_limit | The key hit its spending cap. Raise it or use another key. |
| 402 | insufficient_quota | The wallet is out of credit until the next round pays out. |
| 403 | model_not_allowed | The key isn't allowed to use that model. |
| 429 | rate_limit_exceeded | Too many requests this minute. Wait for the Retry-After seconds. |
| 401 | key_expired | The key passed its expiry date. Create a new one. |
The SDK only signs a Quota sign-in message for its own wallet, for quota.tools. It refuses anything else, including transactions, so a sign-in can never move funds.
In ~/.config/quota/id.json, readable only by the user running the agent. Back it up: it's the only copy of the key, and the credit belongs to that wallet.
Yes. Create a key on your account page with a spending cap and hand it over. The agent spends from your balance, never more than the cap.
Anything that accepts an OpenAI-compatible base URL and key works. Use https://api.quota.tools/v1 as the base URL and a Quota key.