Quick start
- Go to raeto.cc/build and press Start. It opens the console.
- Sign in with your wallet, Google or email.
- In the Keys tab, press New key and pick API key for agents. Copy the key; it's shown once.
- In Billing, top up with USDG or a card.
- Point any OpenAI SDK at
https://api.raeto.cc/v1with your key.
# pip install openai from openai import OpenAI client = OpenAI( base_url="https://api.raeto.cc/v1", api_key="YOUR_RAETO_KEY", ) reply = client.chat.completions.create( model="openai/gpt-4o-mini", messages=[{"role": "user", "content": "Hello"}], ) print(reply.choices[0].message.content)
// npm install openai, save as quickstart.mjs, run: node quickstart.mjs import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.raeto.cc/v1", apiKey: "YOUR_RAETO_KEY", }); const reply = await client.chat.completions.create({ model: "openai/gpt-4o-mini", messages: [{ role: "user", content: "Hello" }], }); console.log(reply.choices[0].message.content);
curl https://api.raeto.cc/v1/chat/completions \ -H "Authorization: Bearer YOUR_RAETO_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Hello"}]}'
https://api.raeto.cc/v1. The API lives on the api. subdomain; raeto.cc is the website. Opening the base URL in a browser shows a short guide; requests go to paths under it, like /v1/models and /v1/chat/completions.Anything that speaks the OpenAI chat format works the same way: LangChain, the Vercel AI SDK, LlamaIndex, Cursor-style tools that take a custom base URL, and so on.
API keys
Create keys in the console under Keys → New key. An API key for agents calls models through Raeto, paid from your balance. A routing key only picks the model; you call it with your own provider key (see Routing only). Give each app or environment its own key so you can see what each one spends and shut one off without touching the others.
| Setting | What it does |
|---|---|
| Name | A label for you, like "Discord bot" or "staging". It shows in the activity log. |
| Spending cap | Optional. Once the key has spent this much in credits, it's turned away with key_limit_reached until you raise or remove the limit. It's checked before each request, so a final request can finish slightly past it. |
| Allowed models | Optional. A list of model ids the key may use, such as openai/gpt-4o-mini or raeto/auto. Anything else returns model_not_allowed. |
| Pause | Turns the key off right away without deleting it. Resume it any time. |
| Delete | Revokes the key for good. |
Each account can have up to 20 keys. Keys are stored only as hashes, so we can't show one again. If you lose a key, delete it and make another.
Models
Use any model id from the list endpoint. It returns 400+ models from OpenAI, Anthropic, Google, Meta, DeepSeek, Mistral and more, with their per-token prices.
curl https://api.raeto.cc/v1/modelsAuto routing
Set model to raeto/auto and our routing engine picks the cheapest model that can handle each request: quick questions go to a fast model, code to a stronger one, and hard reasoning to the top tier. That's how credits go up to 2–3x further.
Auto routing is open to every account; you don't need to hold $RAETO. The response tells you what was picked in the x-raeto-model and x-raeto-tier headers. To make auto start from a stronger tier, send x-route-floor: mid or top.
Using your own provider account instead? See Routing only.
Routing only
Already have your own OpenAI, Anthropic or OpenRouter account? Keep it. Send Raeto the request you're about to make, and we tell you which model to use. Then you call that model yourself, with your own key. Raeto never sees your provider key or the model's reply.
Get a routing key in the console: sign in, then Keys → New key → Routing key. The quickest setup is the drop-in SDK, which wraps the client you already use (raeto-route.mjs, raeto_route.py) and falls back to your usual model if Raeto is ever unreachable.
A routing key only picks models. It can't call models, pay, or move or withdraw funds. Each routing decision costs a flat $0.0002 from your balance ($0.20 per 1,000 requests; $0.0001 for partners), whatever the request's size. There's no $RAETO requirement. Fees in full: How money moves on Raeto.
// npm install openai, and download the SDK next to this file (save it as route.mjs): // curl -o raeto.mjs https://raeto.cc/sdk/raeto.mjs import OpenAI from "openai"; import { Raeto } from "./raeto.mjs"; const raeto = new Raeto({ apiKey: process.env.RAETO_API_KEY }); const openai = new OpenAI(); // your own provider key const request = { messages: [{ role: "user", content: "Summarize this ticket in one line" }] }; const pick = await raeto.route({ ...request, models: { fast: "gpt-4o-mini", mid: "gpt-4.1", top: "o3" } }); const reply = await openai.chat.completions.create({ ...request, model: pick.model }); console.log(pick.model, pick.tier, pick.reasons); // e.g. gpt-4o-mini fast [...] console.log(reply.choices[0].message.content);
# pip install openai; curl -o raeto.py https://raeto.cc/sdk/raeto.py import os from openai import OpenAI from raeto import Raeto raeto = Raeto(api_key=os.environ["RAETO_API_KEY"]) openai = OpenAI() # your own provider key messages = [{"role": "user", "content": "Summarize this ticket in one line"}] pick = raeto.route(messages=messages, models={"fast": "gpt-4o-mini", "mid": "gpt-4.1", "top": "o3"}) reply = openai.chat.completions.create(model=pick["model"], messages=messages)
curl https://api.raeto.cc/v1/route \ -H "Authorization: Bearer $RAETO_API_KEY" \ -H "Content-Type: application/json" \ -d '{"messages":[{"role":"user","content":"Summarize this ticket in one line"}], "models":{"fast":"gpt-4o-mini","mid":"gpt-4.1","top":"o3"}}'
Request
| Field | Meaning |
|---|---|
messages | Required. The chat you're about to send. Also send tools or images if the real request has them; they affect the pick. |
models | Optional. Your own model name for each tier: fast, mid, top. Leave out a tier and the next stronger one you gave is used. Without models, you get Raeto's picks as OpenRouter ids. |
floor | Optional. mid or top to never go below that tier. |
max_tokens | Optional. Only used for the cost estimate. |
Response
| Field | Meaning |
|---|---|
model | The model to call. |
tier, reasons | Which tier was picked, and why (for example code or long input). |
fallbacks | Stronger models to try, in order, if the pick fails or the answer isn't good enough. |
estimate | Only with Raeto's model list: estimated cost of this request, the top model's cost and the percent saved. |
fee_usd, balance_usd | What this decision cost, and your balance after it. |
Routing decisions show up in your activity log as route → model, and in the console under Recent routing decisions. Key spending caps apply to them too.
Overview, savings calculator and pricing: raeto.cc/build.
Requests
POST /v1/chat/completions takes the standard OpenAI body. Streaming ("stream": true), tools, JSON mode, images and other provider options pass straight through to the model.
Response headers
| Header | Meaning |
|---|---|
x-raeto-model | The model that answered. |
x-raeto-tier | fast, mid or top. Only when auto routing chose the model. |
x-raeto-cost | What this request took from your credits, in dollars. Non-streaming requests only; streamed requests carry it in their last chunk (below). |
x-raeto-saved-pct | What Raeto saved on this call, as a whole percent, after Raeto's fees. With auto routing: against the top model for the same tokens. With a named model: what prompt caching saved, on calls that used a cache. |
x-raeto-saved | The same saving in dollars. |
x-raeto-route-fee | The routing fee included in x-raeto-cost: 30% of what auto saved, $0 when it saved nothing. Auto routing only. |
x-raeto-route | Why auto routing picked this model, as key=value pairs. Includes escalated_from and escalated_why when the call was retried on a stronger model, and effort=low when a thinking model was asked to think less on a simple request. |
x-raeto-cache | What the call read from or wrote to the provider's cache, and what that saved. Non-streaming requests that used a cache. See Prompt caching. |
x-raeto-loop | This agent has sent the same step repeatedly. See Loop breaker. |
x-raeto-task | The task's calls, spend and budget left. Calls with X-Raeto-Task only. See Cost per task. |
x-raeto-yield | Today's yield budget, spend and what's left. Yield-mode keys only. See Agents on vault yield. |
Streamed requests
Headers go out before the answer is known, so with auto routing the final usage chunk carries the totals in a raeto object:
"raeto": { "model": "openai/gpt-4o-mini", "cost_usd": 0.00021, "saved_usd": 0.0098, "saved_pct": 97 }
When auto routing retries
If the cheap model's answer is plainly broken (empty, cut off, invalid JSON when you asked for JSON, a call to a tool you didn't offer, or stuck repeating itself), Raeto asks the next tier up once and returns that answer instead. You pay only for the answer you get; the broken try is on Raeto. Streams may hold their first bytes for up to 3 seconds while an empty answer can still be swapped. Use raeto/auto:cheap to always keep the cheap answer.
Who am I
GET /v1/me returns what the key can still spend (available_usd), plus its name and limit. Called with a Sign in with Raeto token, it returns the user's user_id for your app instead of their wallet.
Routing for agents NEW
Agents call models in long runs of steps. These features work on those runs: they stop a stuck agent, make repeated prompts cheaper, tell you what each task costs, keep tasks on budget and notify your server. All of them work with any model, named or raeto/auto, and none of them stores prompts or answers.
Tag every call with the agent it's for (X-Raeto-Agent, or the OpenAI user field) and the task it belongs to (X-Raeto-Task). The ElizaOS plugin does both for you.
curl https://api.raeto.cc/v1/chat/completions \ -H "Authorization: Bearer $RAETO_API_KEY" \ -H "X-Raeto-Agent: trader-7" \ -H "X-Raeto-Task: run-8f21" \ -H "X-Raeto-Task-Type: trade" \ -H "X-Raeto-Task-Budget: 0.05" \ -d '{"model":"raeto/auto","messages":[{"role":"user","content":"..."}]}' # on the run's last call, also send: -H "X-Raeto-Task-End: done"
Loop breaker
When one agent sends the same step again and again (same model, tools and last two messages), Raeto flags it after 5 repeats in 10 minutes with x-raeto-loop. After 20, further identical calls get 409 loop_detected without reaching a model, so they cost nothing, until the window clears. A changed request goes through at once, and other agents on the key aren't affected.
Per key: loopGuard on, warn (flag only) or off, and loopStop (the repeat count that stops). Per call: X-Raeto-Loop-Guard: off or warn.
Prompt caching
Raeto keeps each agent on the provider that holds its cache. It also adds cache markers for Claude and Qwen, which only cache what a request marks, when a long prompt is likely to come back. Cached input is billed at a fraction of the normal price, and you're charged what the provider charges. Markers you set yourself are left alone.
Whole answers carry x-raeto-cache with what was read from or written to the cache and what it saved. Per key: promptCache on or off. Per call: X-Raeto-Cache: off.
Cost per task and task budgets
Calls with the same X-Raeto-Task add up to one task. It ends on a call with X-Raeto-Task-End: done (or failed), or after 30 minutes without calls. Every call in a task gets x-raeto-task with its calls, spend and budget left. The console shows recent tasks and the typical and worst-case cost per task type and per agent.
A budget comes from X-Raeto-Task-Budget on the call, the task type's budget, or the key's taskBudgetUsd, in that order. A task never spends past it. Each call's max_tokens is capped to what's left, and a call that can't fit gets 402 task_budget_reached without reaching a model. With raeto/auto, a task with under 30% of its budget left moves to cheaper models.
- One model per task: set the key's
taskModeltosticky, or sendX-Raeto-Task-Model: sticky, and araeto/autotask stays on the model its first step got. It moves only if that model can't do a step or is failing. - Step-aware routing: once a cheap answer in a task had to be retried on a stronger model, the task's later steps start there. The call that ends a task gets at least the mid tier, since it's the answer your user sees.
X-Raeto-Task-Steps: offturns this off for a call.
Agents on vault yield
Set a key's budget to yield and it spends, per UTC day, at most what your vault deposits paid: the average interest of the last 7 days. All your yield keys and agent wallets share that amount. Calls carry x-raeto-yield, and when the day's yield is spent they get 402 yield_budget_reached until midnight UTC. yieldOverdraftUsd lets a key go up to $10 a day past it, from your balance.
At a 3.85% rate, $1,000 earns about $0.10 a day, enough for a light agent. The console shows the deposit each key would need for its current usage.
Webhooks
Add up to 5 https endpoints in the console's Keys tab. Events: task.finished, task.budget_reached, loop.stopped, balance.low and yield.budget_reached. Each is a POST of { id, type, created, data }, retried up to 3 times. Check the x-raeto-signature header with the endpoint's secret before trusting a delivery:
import crypto from 'node:crypto'; // body: the raw request body as a string; header: req.headers['x-raeto-signature'] function fromRaeto(body, header, secret) { const { t, v1 } = Object.fromEntries(header.split(',').map((p) => p.split('='))); const want = crypto.createHmac('sha256', secret).update(`${t}.${body}`).digest('hex'); const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300; return fresh && v1.length === want.length && crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(want)); }
Routing fee: 30% of what auto saved
On a raeto/auto call, the routing fee is 30% of what auto saved you against the top model at the same tokens. The other 70% is yours. When auto saved nothing (the call needed the top model, or the pick cost as much), the routing fee is $0. x-raeto-route-fee shows the fee and x-raeto-saved what you kept. Task and yield budgets count the fee too. Routing-only keys (POST /v1/route) keep the flat $0.0002 per decision, since Raeto never sees what that call cost.
Steer auto: cost_tier and allowed_models
Two optional fields on a raeto/auto request. Raeto reads them and never sends them to the model.
cost_tier:low(the cheapest model that can do it),medium(auto as usual),high(the mid tier or better) ormax(the top tier).allowed_models: auto only picks from these model ids or patterns, like["anthropic/*", "openai/gpt-5*"]. Retries and fallbacks stay inside the list. If nothing in it can serve the request (for example it needs tools), the call gets400 no_allowed_model. A key's model list can hold patterns too (raeto/auto,anthropic/*), which keeps that key's auto calls inside them.
curl https://api.raeto.cc/v1/chat/completions \ -H "Authorization: Bearer $RAETO_API_KEY" \ -d '{"model":"raeto/auto","cost_tier":"low","allowed_models":["anthropic/*","google/*"], "messages":[{"role":"user","content":"Summarize this thread"}]}'
Cache-aware model choice
On by default. An agent's calls share a growing prompt, and the model that answered the last call has most of it cached. Switching to a cheaper model throws that cache away, so it can cost more. For 5 minutes after each call, auto keeps the same agent and prompt on that model, unless the new pick is still cheaper after paying for the whole prompt again. A harder step can always go up a tier. The route header says cache: stayed on … when this happens.
Per key, taskModel: auto (the default, as above), sticky (a task stays on its first model) or free (auto picks fresh every call). Per call: X-Raeto-Task-Model.
Learned routing
Auto sorts every step by its shape: a tool call, a tool result, JSON, code, a long input or plain chat. Across all of Raeto, it counts how often each model's answers had to be retried for each kind of step, how often its tool calls were invalid, how often agents looped on it, and what it cost. Once a model has 30 results for a kind of step and fails more than 15% of them, auto starts that kind of step on another model. A cheap model that keeps sending broken tool calls stops getting tool steps first, while it still gets the steps it handles well. It's still used when nothing else can serve the call. Only counts and costs are kept. The console's Savings tab shows the table.
Shadow mode: try auto before switching
Turn on shadow for a key that names its model. Your calls don't change. On 10% of them, Raeto also asks the model auto would have picked, in the background and at Raeto's cost, and a small judge model checks whether the two answers would serve your user equally well. The console then shows, per key, something like "auto matched on 47 of 50 sampled calls and would have cost 69% less". Only the verdict counts and costs are kept, never the prompts or answers. Shadow calls are capped at $0.25 a day per account.
Frameworks: LangChain, LangGraph, OpenAI Agents SDK, Vercel AI SDK
One file per language, no new dependencies. It points your framework at Raeto and adds the agent and task headers to every call. Wrap a run in withTask / task() and every call it makes is one Raeto task. Wrap a node or sub-agent in withAgent / agent() to name it. Download raeto-frameworks.mjs or raeto_frameworks.py.
# curl -O https://api.raeto.cc/sdk/raeto_frameworks.py from raeto_frameworks import task, agent, raeto_chat_model, use_raeto_agents_sdk, raeto_model # LangChain / LangGraph: a ChatOpenAI on raeto/auto llm = raeto_chat_model(api_key=RAETO_API_KEY, agent="researcher") with task(type="research", budget_usd=0.10): graph.invoke(inputs) # OpenAI Agents SDK use_raeto_agents_sdk(api_key=RAETO_API_KEY) triage = Agent(name="Triage", instructions="...", model=raeto_model()) with task(type="triage"): result = await Runner.run(triage, "My order never came")
// curl -O https://api.raeto.cc/sdk/raeto-frameworks.mjs import { withTask, raetoAiSdk, raetoLangChain, raetoAgentsSdk } from './raeto-frameworks.mjs'; // Vercel AI SDK import { createOpenAI } from '@ai-sdk/openai'; const raeto = raetoAiSdk(createOpenAI, { apiKey: RAETO_API_KEY, agent: 'support-bot' }); await withTask({ type: 'ticket', budgetUsd: 0.05 }, () => generateText({ model: raeto('raeto/auto'), prompt })); // LangChain / LangGraph import { ChatOpenAI } from '@langchain/openai'; const llm = raetoLangChain(ChatOpenAI, { apiKey: RAETO_API_KEY, agent: 'researcher' }); // OpenAI Agents SDK: then build agents with model: 'raeto/auto' import * as agents from '@openai/agents'; import OpenAI from 'openai'; raetoAgentsSdk(agents, OpenAI, { apiKey: RAETO_API_KEY });
OpenTelemetry
Send a span for every call to your own tracing backend: Honeycomb, Grafana Tempo, Datadog, Langfuse, Arize or any OTLP/HTTP collector. Set it in the console's Keys tab, or POST /v1/otel with { "endpoint", "headers", "serviceName" }. Spans use the OpenTelemetry GenAI attributes (gen_ai.request.model, gen_ai.response.model, token counts) plus raeto.* for tier, route reasons, cost, routing fee, savings, task and agent. When a call carries a W3C traceparent header, its span joins your trace. Prompts and answers are never sent.
Benchmark
24 agent tasks (tool loops, extraction, code, math and reasoning), each graded by a program rather than a judge model, run on raeto/auto and on a top model. See the results, or run it yourself: RAETO_KEY=… node bench/run.mjs from the raeto-service repo.
SDKs
The OpenAI SDKs above work as they are. If you'd rather have something smaller, our clients for JavaScript and Python have no dependencies, and they include helpers for Sign in with Raeto. Download one file and drop it into your project:
// curl -o raeto.mjs https://raeto.cc/sdk/raeto.mjs, then run this as an .mjs file import { Raeto } from "./raeto.mjs"; const raeto = new Raeto({ apiKey: process.env.RAETO_API_KEY }); console.log(await raeto.ask("Explain Morpho in one line", { model: "openai/gpt-4o-mini" })); console.log(raeto.last); // { model, tier, costUsd } for await (const t of raeto.stream({ messages: [{ role: "user", content: "Count to 5" }] })) process.stdout.write(t); const me = await raeto.me(); // { available_usd, ... }
# curl -o raeto.py https://raeto.cc/sdk/raeto.py import os from raeto import Raeto raeto = Raeto(api_key=os.environ["RAETO_API_KEY"]) print(raeto.ask("Explain Morpho in one line", model="openai/gpt-4o-mini")) print(raeto.last) # {"model", "tier", "cost_usd"} for t in raeto.stream(messages=[{"role": "user", "content": "Count to 5"}]): print(t, end="") me = raeto.me() # {"available_usd", ...}
Both raise RaetoError with status and type from the error table. The JavaScript client runs in Node 20+, Deno, Bun and browsers; the Python one needs 3.8+.
Agents pay their way
An agent doesn't need to borrow your key. It can use its own wallet on Robinhood Chain to sign in, pay and fund itself, and each agent gets its own balance, limits and history.
| Way to pay | How it works |
|---|---|
| Its wallet as its login | The agent signs a message with its wallet and gets its own API key and Raeto account. It costs nothing and moves no funds. |
| Pay per request | No account or key. The agent pays from its wallet, then sends the transaction hash with its calls until that payment is used up. |
| USDG | USDG sent from the agent's wallet to Raeto becomes credits for that wallet. |
| rCREDIT | Anyone holding rCREDIT, the agent or you, can redeem it straight into the agent's account with redeem(amount, agentWallet). |
| Its own vault | The agent deposits tokenized stocks or USDG into a Raeto vault. The interest becomes credits for its account, so its AI keeps getting paid for. |
| An API key with a limit | Or give it one of your API keys with a spending cap, from the console's Keys tab. |
Sign in with the agent's wallet
// npm install ethers; curl -o raeto.mjs https://raeto.cc/sdk/raeto.mjs import { Wallet } from "ethers"; // or a viem account import { Raeto } from "./raeto.mjs"; const wallet = new Wallet(process.env.AGENT_PRIVATE_KEY); // the agent's own wallet const raeto = await Raeto.agent({ wallet, name: "research-bot", limitUsd: 5 }); console.log(await raeto.me()); // its own balance and limit console.log(await raeto.ask("Summarize today's NVDA news")); // needs credits: fund it first
# curl -o raeto.py https://raeto.cc/sdk/raeto.py import os from eth_account import Account # pip install eth-account from raeto import Raeto account = Account.from_key(os.environ["AGENT_PRIVATE_KEY"]) raeto = Raeto.agent(account, name="research-bot", limit_usd=5) print(raeto.ask("Summarize today's NVDA news"))
POST /v1/agents/challenge {"address": "0xAGENT"}
→ {"message": "Sign in to raeto as an agent ..."}
# sign the message with the agent's wallet (personal_sign), or approve it from a smart-contract account (EIP-1271), then:
POST /v1/agents/login {"address": "0xAGENT", "signature": "0x...", "name": "research-bot", "limitUsd": 5}
→ {"apiKey": "sk-raeto-...", "address": "0xagent", "balanceUsd": 0, "fund": {...}}
Smart-contract accounts (multisigs, post-quantum vaults, any EIP-1271 wallet) sign in the same way. Instead of personal_sign, the account approves hashMessage(message) so that isValidSignature(hash, signature) returns 0x1626ba7e, and you send that signature to /v1/agents/login. If your account approves hashes on-chain, sending 0x works too. The account lives at the contract's address, so USDG the contract sends to usdg.payTo from GET /v1/agents becomes its credits, and anything it deposits into a Raeto vault earns credits for it.
Read the challenge and the payTo address from /v1/agents/challenge and GET /v1/agents each time. If you also pin them as a safety check, which is a good idea, tell us, and we'll give you a heads-up before either changes.
The key works like a developer key: it calls models and routing, but it can't move the account's credits. Each wallet keeps its 5 newest agent sign-ins. If you sign in to raeto.cc with the same wallet, they show up under Developers.
Pay per request
For an agent that has no account. First it pays from its wallet: it sends USDG to Raeto, or rCREDIT is redeemed into the wallet. Then it calls the API with two headers instead of a key:
| Header | Value |
|---|---|
X-Payment-Tx | The payment transaction hash. |
X-Payment-Sig | The paying wallet's signature (personal_sign) of Pay raeto with transaction 0x…, with the hash in lowercase. |
// npm install ethers; curl -o raeto.mjs https://raeto.cc/sdk/raeto.mjs import { Contract, JsonRpcProvider, Wallet, parseUnits } from "ethers"; import { Raeto } from "./raeto.mjs"; const info = await Raeto.howToPay(); // treasury, USDG and rCREDIT addresses const wallet = new Wallet(process.env.AGENT_PRIVATE_KEY, new JsonRpcProvider("https://rpc.mainnet.chain.robinhood.com")); const usdg = new Contract(info.usdg.token, ["function transfer(address,uint256) returns (bool)"], wallet); const tx = await (await usdg.transfer(info.usdg.payTo, parseUnits("2", 6))).wait(); // $2 const raeto = await Raeto.payPerRequest({ wallet, txHash: tx.hash }); console.log(await raeto.ask("Hello"), raeto.paymentLeftUsd);
raeto = Raeto.pay_per_request(account, tx_hash) # after sending USDG from the agent's wallet print(raeto.ask("Hello"), raeto.payment_left_usd)
- Each response has an
x-raeto-payment-leftheader. When the payment runs out, you get402 payment_used_up, so pay again and use the new hash. The last call can run slightly over, like any spending limit. - The payment is tied to the wallet that paid. A hash copied from the explorer can't be used without that wallet's signature.
- Whatever the agent doesn't spend stays in its wallet's own account. It can use that later with a wallet sign-in key.
- A call with no key and no payment returns
402 payment_required, along with the addresses to pay. You can also get them fromGET /v1/agents. - The USDG has to be a plain transfer that the agent's wallet sends itself. Payments are on Robinhood Chain (chain id 4663).
Deposit into a Raeto vault (for builders)
For apps and agent wallets that deposit for themselves, contract wallets included. The interest goes to whichever address calls deposit, and becomes credits on that address's Raeto account. Sign in with the same address to spend them.
// npm install ethers import { Contract, JsonRpcProvider, Wallet, parseUnits } from "ethers"; const health = await (await fetch("https://api.raeto.cc/health")).json(); const v = health.vaults.find((x) => x.symbol === "USDG"); // the dollar vault and its asset const wallet = new Wallet(process.env.AGENT_PRIVATE_KEY, new JsonRpcProvider("https://rpc.mainnet.chain.robinhood.com")); const usdg = new Contract(v.asset, ["function approve(address,uint256) returns (bool)"], wallet); const vault = new Contract(v.address, [ "function deposit(uint256) returns (uint256)", "function withdraw(uint256) returns (uint256)", "function earnedIncludingPending(address) view returns (uint256)", ], wallet); const amount = parseUnits("50", 6); // 50 USDG await (await usdg.approve(v.address, amount)).wait(); await (await vault.deposit(amount)).wait(); // interest accrues to this wallet
| Call | What it does |
|---|---|
deposit(uint256 amount) | Approve the vault for the asset first. Credits the caller (msg.sender). Not ERC-4626: there is no receiver argument. |
withdraw(uint256 amount) | Returns the caller's deposit. Withdrawals can't be paused. |
earnedIncludingPending(address) | Interest earned so far, including what the next update adds. For display. |
minDeposit(), depositsPaused(), inLoss() | Check these first: deposit reverts below the minimum, over the vault's cap, while paused, or while the vault is in loss. |
- Take vault addresses from
GET /health→vaultsrather than hardcoding them. The USDG vault is0x6f9c9bd7f89d230ec2ee34037e09b27848e4bd6bon Robinhood Chain (chain id 4663). - Interest is updated on the vault about every 30 minutes and shows up as credits about a minute later. Depositing before signing in loses nothing: the first sign-in picks it up.
- A large USDG withdrawal may have to wait if most of the vault is lent out at that moment. Stock vaults also repay the deposit's share of their loan on withdrawal. See vaults.
Agent wallets NEW
Spin up agents in code, each with its own Raeto account, key and budget. You fund them from your balance, set what they may spend, and can pause or close them at any time. Raeto enforces every limit on its side, so an agent can never loosen its own.
// Download both files next to this one (raeto-agents.mjs uses raeto-pay.mjs): // curl -o raeto-agents.mjs https://api.raeto.cc/sdk/raeto-agents.mjs // curl -o raeto-pay.mjs https://api.raeto.cc/sdk/raeto-pay.mjs import { RaetoAgents } from "./raeto-agents.mjs"; const fleet = new RaetoAgents({ apiKey: process.env.RAETO_API_KEY }); // your API key const agent = await fleet.create({ name: "researcher-1", fundUsd: 5, // moved from your balance dailyUsd: 2, // models and payments together perPaymentUsd: 0.05, // most one Raeto Pay payment can be models: ["raeto/auto", "anthropic/claude-haiku-5.5"], topUp: { belowUsd: 1, toUsd: 5 }, // refill from your balance when low priors: { blockDefaulted: true }, // never pay an agent that defaulted on Priors }); console.log(agent.apiKey); // give this to the agent: works with any OpenAI SDK const fetchPaid = agent.fetch; // a fetch that pays Raeto Pay APIs within the agent's policy await fleet.pause(agent.address); // kill switch (resume turns it back on) await fleet.withdraw(agent.address); // take its balance and earnings back await fleet.close(agent.address); // revoke its key, return everything
POST /v1/agents/wallets {"name": "researcher-1", "fundUsd": 5, "dailyUsd": 2, "perPaymentUsd": 0.05,
"models": ["raeto/auto"], "payees": null, "topUp": {"belowUsd": 1, "toUsd": 5}}
→ {"address": "0x…", "apiKey": "sk-raeto-…", "balance_usd": 5, "policy": {…}, "status": "active"}
GET /v1/agents/wallets # your agents
POST /v1/agents/wallets/0xAGENT # change name, dailyUsd, perPaymentUsd, payees, models, topUp, priors (null removes a limit)
POST /v1/agents/wallets/0xAGENT/fund {"usd": 2}
POST /v1/agents/wallets/0xAGENT/withdraw {"usd": 1} or {"all": true}
POST /v1/agents/wallets/0xAGENT/pause # also /resume and /close
| Setting | What it does |
|---|---|
dailyUsd | The most the agent can spend per UTC day, on model calls and payments together. It's checked before each call, so one call can take it slightly over, like any spending limit. |
models | The only models the agent may call. Leave it out for any model. |
payees | The only Raeto Pay addresses the agent may pay. Leave it out for any payee. |
perPaymentUsd | The most a single Raeto Pay payment can be. |
priors | Credit checks from Priors. {"blockDefaulted": true} never pays an agent that defaulted on a Priors loan. {"minScore": 200} pays directly only payees with a Priors score of at least 200. null turns it off. |
topUp | When the balance drops below belowUsd, Raeto refills it to toUsd from your balance, as far as you have credits. Your balance can come from vault interest, so a funded vault can keep agents running. |
- Only you can manage your agents. The agent's own key calls models and pays APIs, but it can't change its policy, unpause itself or move credits out.
- Sub-agents: an agent's key can create agents of its own (
new RaetoAgents({ apiKey: agent.apiKey })), funded from its own budget, up to 3 levels deep. Pausing or closing an agent covers its sub-agents too. - Its own address: each agent has an account address, so it can sell through Raeto Pay and keep what it earns. Take earnings back with
withdraw. GET /v1/mewith an agent's key shows its policy, status and what it spent today.
Raeto Pay NEW
Charge agents for your API, tool or agent, per call, in Raeto credits: the same dollars as rCREDIT. An agent pays from its Raeto balance and gets a one-time receipt for your API. You check the receipt with Raeto before doing the work, and the money lands in your Raeto balance, where you can spend it on AI. Moving credits out of Raeto has its own rules: see How money moves on Raeto.
| Step | What happens |
|---|---|
| 1. Your API asks for payment | A call without a receipt gets 402 with your price: {"raeto": {"payTo", "amountUsd", "resource"}}. |
| 2. The agent pays | POST /v1/pay moves the money out of the agent's balance and returns a receipt. |
| 3. The agent calls again | The same request, with the header X-Raeto-Receipt. |
| 4. You check and get paid | POST /v1/pay/verify confirms the receipt is real, unused, for you, for at least your price and for this endpoint. Then you do the work. |
Getting paid out. Earnings from other accounts can go out as USDG on Robinhood Chain to your own wallet. Payments from agents funded with USDG are ready right away; ones made with card, gifted or promo credits wait 7 days. GET /v1/pay/payout shows what is ready, and POST /v1/pay/payout {"amountUsd": 50} (or "all") asks for it. At least $10 and up to $500 a day; each payout is checked by the Raeto team before it is sent. You can also do it from the console's Billing tab.
Charge for your API
// npm install express; curl -o raeto-pay.mjs https://api.raeto.cc/sdk/raeto-pay.mjs // Save as server.mjs, run: node server.mjs import express from "express"; import { raetoPaywall } from "./raeto-pay.mjs"; const getQuote = (symbol) => ({ symbol, price: 0 }); // your own logic const paywall = raetoPaywall({ apiKey: process.env.RAETO_API_KEY, payTo: "0xYOUR_RAETO_ACCOUNT" }); await paywall.register("Price feed"); // what agents see when they pay you const app = express(); app.get("/quote", paywall.express({ priceUsd: 0.01 }), (req, res) => { res.json(getQuote(req.query.symbol)); // only runs once the payment checks out }); app.listen(3000);
// A route file, e.g. app/quote/route.js in Next.js, with raeto-pay.mjs downloaded next to it: // curl -o raeto-pay.mjs https://api.raeto.cc/sdk/raeto-pay.mjs import { raetoPaywall } from "./raeto-pay.mjs"; const getQuote = async (symbol) => ({ symbol, price: 0 }); // your own logic const paywall = raetoPaywall({ apiKey: process.env.RAETO_API_KEY, payTo: "0xYOUR_RAETO_ACCOUNT" }); export const GET = paywall.handler({ priceUsd: 0.01 }, async (request) => Response.json(await getQuote(new URL(request.url).searchParams.get("symbol"))) );
POST /v1/pay/payee {"name": "Price feed"}
→ {"payTo": "0xyour_account", "fee_pct": 1}
# a call with X-Raeto-Receipt: check it before doing the work
POST /v1/pay/verify {"receipt": "rp_…", "minUsd": 0.01, "resource": "/quote"}
→ {"ok": true, "status": "settled", "amount_usd": 0.01, "fee_usd": 0.0001, "net_usd": 0.0099}
# or only take the money if the work succeeds
POST /v1/pay/verify {"receipt": "rp_…", "minUsd": 0.01, "capture": false} → status "locked"
POST /v1/pay/capture {"receipt": "rp_…"} # it worked: take the money
POST /v1/pay/release {"receipt": "rp_…"} # it failed: give it back
Use your own key here, not an agent's. Your payTo is your Raeto account address, which register returns. The SDK only takes the money when your handler succeeds (status below 400). Otherwise the agent gets it back.
Pay from an agent
// curl -o raeto-pay.mjs https://api.raeto.cc/sdk/raeto-pay.mjs, then run this as an .mjs file import { payingFetch } from "./raeto-pay.mjs"; const fetchPaid = payingFetch({ apiKey: process.env.AGENT_KEY, maxPerCallUsd: 0.05, budgetUsd: 5 }); const res = await fetchPaid("https://prices.example/quote?symbol=NVDA"); // pays the 402, retries console.log(await res.json(), fetchPaid.spentUsd());
POST /v1/pay {"payTo": "0xPAYEE", "amountUsd": 0.01, "resource": "/quote"}
→ {"receipt": "rp_…", "status": "held", "header": "X-Raeto-Receipt", "balance_usd": 4.99}
GET /v1/pay # payments you sent and received
- Agents only pay for calls that work. Money is held until the API checks the receipt. Anything not taken within 10 minutes goes back to the agent by itself, including the room on its key's spending limit.
- Receipts work once. Each one is tied to one payee, a price and an endpoint, so it can't be reused or sent anywhere else.
payingFetchnever pays more thanmaxPerCallUsdfor a call or more thanbudgetUsdin total. AddallowPayeesto limit who it pays. Agent wallets enforce the same limits on Raeto's side.- Fees: Raeto keeps 1% of each completed payment (0.5% for partners). Payments are up to $100 each. Nothing is charged for refunds. See fees.
- The full flow and limits are always at
GET /v1/pay/info.
Credit checks (Priors) NEW
Before an agent pays, hires or lends to another agent, it can check what that agent has actually repaid. Priors is the credit layer for agents on Robinhood Chain: every record is debt someone else put at risk, and how it was repaid, checkable on chain. Raeto reads Priors' public check API, so this needs no setup and is free.
Look an agent up
POST /v1/tools/priors_check {"arguments": {"agent": 437}} # an ERC-8004 agent id
POST /v1/tools/priors_check {"arguments": {"address": "0x…"}} # or any wallet: a payee, payer or x402 payTo
→ {"verdict": "repaid", "agents": [{"agent_id": 437, "loans_repaid": 7, "defaulted": false,
"score": 1, "score_rung": "unproven", "changed_hands": false, "page": "https://priors.trade/agent?id=437", …}],
"verify": {"attester": "0x6138…8a73", "registry": "0x8004…9b63", …}}
priors_check {"agent": 437} # free, like any Raeto tool over MCP
| Field | What it means |
|---|---|
verdict | repaid, no repayments yet, defaulted or no record. A default on Priors is permanent. |
score | Priors Score v2, 0 to 1000, with its rung. It's null when Priors' published scores aren't fresh, never an old number. |
changed_hands | true when the agent was sold after earning part of its record, so the current owner didn't earn all of it. |
verify | Where to check it on chain: Priors' attester on the ERC-8004 reputation registry, and the address that posts its credit statements. |
On payments
- Every new payee: when an agent pays an address for the first time with Raeto Pay, the answer shows that payee's Priors record under
payee_check.priors. It's information only and never holds a payment up. - Your rules, enforced by Raeto: set
priorson an agent wallet.blockDefaultedstops payments to agents that defaulted (if Priors can't answer, the payment goes ahead).minScoreis strict: no record, no fresh score, or no answer from Priors means no payment. It covers direct payments; tools listed on Raeto aren't affected. Either way, a refused payment moves no money.
Run a Priors agent on Raeto
Bring a Priors agent Own the agent? One signature in the console: it gets a compute-only key and shows in your console. Or wire it in code below.
An agent with a Priors credit line can spend what it borrows on models and tools through Raeto, and build its record by repaying on time. It can top up on credit with Priors' own SDK, which borrows the shortfall and pays Raeto over x402 through the Priors facilitator. Everything below works today; the Priors steps use Priors' own tools.
# 1. One call to start: top up on credit. Priors' pay() borrows what the wallet is short and pays Raeto. const r = await priors.pay("https://api.raeto.cc/v1/topup/x402?usd=5", { agentId, maxBorrow: 5_000000n, maxPrice: 5_000000n, termSeconds: 14 * 86400 }); # The credits land in the wallet's own Raeto account, and a wallet's first top-up also returns its API key # (api_key, shown once). Any x402 client works: $1 to $500, USDG on Robinhood Chain. Borrow for 14 days so # the agent can hold a week and repay on time. # 2. Work: call any model with the key, OpenAI-compatible (base URL https://api.raeto.cc/v1, model "raeto/auto") # 3. Top up again whenever it runs low (same call; add &key=1 only if it wants another key) # 4. Earn: sell the agent's work through Raeto Pay (section above), then take earnings out as USDG. # The agent key can't move money out, by design: sign in with the same wallet (POST /auth/challenge, # then /auth/verify, or the console) and use that key POST /v1/pay/payout {"amountUsd": "all"} # 5. Repay on Priors before the due date npx priors-v2 repay --all # Lost the key, or topped up without one? Sign in with the wallet: POST /v1/agents/challenge, then /v1/agents/login
- Plan the repayment before you borrow. Credits on Raeto are for spending: what the agent deposits and doesn't spend stays as Raeto credits, it doesn't turn back into USDG. What comes out as USDG is what the agent earns through Raeto Pay (payouts start at $10 and are reviewed before they're sent), or anything it earns elsewhere.
- Hold at least 7 days. On Priors, a loan repaid sooner doesn't count toward the record, and one repaid more than 3 days late defaults, permanently.
- Check where it stands any time with
priors_checkand the agent's own address.
Builder tools NEW
List an API that charges through Raeto Pay, and every agent on Raeto can find it with find_tools and call it with use_tool. No SDK on their side, no keys to hand out: the agent pays your price per call from its Raeto balance, and the money lands in yours.
- Put your API behind Raeto Pay. Register as a payee and protect a
POSTendpoint withraetoPaywall. Raeto sends each call's arguments as a JSON body. - List it. Send its name, a description agents will read, its inputs as a JSON schema, and its https URL. Raeto calls it once without paying to read your price.
- Raeto reviews it. New and changed listings wait for approval. Until then you can try it from one of your own agent wallets.
- Agents find it and pay per call. Approved tools show up in
find_toolsand atGET /v1/tools/listings. You see calls, success rate and earnings in the console.
Tools agents can call today
Live from GET /v1/tools/listings: every approved builder tool, with its price per call.
| Tool | Builder | What it does | Price |
|---|---|---|---|
| Loading… | |||
List a tool
// npm install express; curl -o raeto-pay.mjs https://api.raeto.cc/sdk/raeto-pay.mjs import express from "express"; import { raetoPaywall } from "./raeto-pay.mjs"; const paywall = raetoPaywall({ apiKey: process.env.RAETO_API_KEY, payTo: "0xYOUR_RAETO_ACCOUNT" }); await paywall.register("Sky Data"); // the builder name agents see const app = express(); app.use(express.json()); app.post("/weather", paywall.express({ priceUsd: 0.01 }), (req, res) => { res.json({ city: req.body.city, tempC: 21 }); // req.body is the agent's arguments }); app.listen(3000);
POST /v1/pay/tools
{
"name": "weather_now",
"title": "Weather now",
"description": "Current temperature for a city, in Celsius.",
"endpoint": "https://api.example.com/weather",
"inputSchema": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] },
"priceUsd": 0.01
}
→ {"id": "tl_…", "status": "pending", "price_usd": 0.01, …}
GET /v1/pay/tools # your listings, their status, calls and earnings
POST /v1/pay/tools/tl_… # change one (it goes back to review)
POST /v1/pay/tools/tl_…/delist # take it down
Use your own key, not an agent's or an app's. priceUsd is optional; if you send it, it must match what your endpoint asks. You can also list and manage tools in the console.
The rules
- Your endpoint sets the price. An unpaid call must get
402with a Raeto price for your own account, asraetoPaywallanswers. Up to $5 a call, 20 listings per account. - Review. New and changed listings are
pendinguntil Raeto approves them. Approval checks your endpoint again, so the price agents pay is the one that was reviewed. The builder name agents see is the one you had when the listing was approved. - A call. The agent's own limits apply first (daily cap, per-payment cap, allowed payees, pause), and new payees get an Agent Wormhole check. Then Raeto pays your price into escrow and sends the arguments to your endpoint as a
POST, withX-Raeto-ReceiptandX-Raeto-Tool. Your answer has 30 seconds and 1 MB; agents get it marked as third-party data, not instructions. - Agents only pay for calls that work. A non-2xx answer, a timeout or an unreachable endpoint gives the agent back the price and any payee check fee. If your paywall took the money and the call still failed, the agent is told, the listing is flagged and Raeto is alerted.
- No paying twice for a loop. One key calling the same tool with the same arguments more than 10 times in a minute gets
429 tool_repeat_limitbefore anything is paid. - Quality. A tool that fails 5 calls in a row is hidden until you change it or Raeto restores it.
- Fees: Raeto keeps 1.5% of each completed call (partners pay their own Raeto Pay rate). Nothing is charged on refunds. Earnings pay out like any other Raeto Pay income.
- Privacy: Raeto keeps the payment and the listing's counts. Not the arguments, not your answers.
Public agent activity
Show the world your agents are live. Two opt-in reads, off by default, that anyone can fetch with no key. Turn them on in the console under your project.
- Agent activity (per project): AI calls over the last 7 days across your account and all its agent wallets. No addresses, spend or prompts. Your project needs a name.
Every project that shares is also listed, busiest first, with its website and X handle so directories can match it to their own pages:GET https://api.raeto.cc/v1/public/projects/<project id> { "object": "project_activity", "name": "...", "calls7d": 4210, "agent_wallets": 12, "days": [{ "day": "2026-10-22", "calls": 580 }, ...] }GET https://api.raeto.cc/v1/public/projects { "object": "list", "count": 2, "data": [{ "id": "p_…", "name": "...", "website": "...", "x": "...", "calls7d": 4210, "url": "..." }] } - AI spend by wallet: your running AI spend total and the last 7 days, including your agent wallets. An agent wallet's own total can be read too once its owner turns this on.
GET https://api.raeto.cc/v1/public/wallets/<address>/spend { "object": "wallet_spend", "spent_usd": 12.84, "spent_7d_usd": 3.1, "calls_7d": 1940, "days": [...] }
Calls and spend count model calls, routing decisions and paid tools. Top-ups, Raeto Pay payments and transfers to your agents don't count. A read that isn't shared answers 404, the same as one that doesn't exist. Results are cached for 60 seconds.
Agents (MCP) NEW
Raeto runs a remote MCP server. Claude Code, Cursor and other agents get 400+ models, web search, onchain data on six chains, tools other builders sell, Raeto Pay and agent wallets through it, all paid from one balance: a second opinion, a cheaper model for side tasks, live data, or agents with their own budgets.
Claude Code (recommended)
claude plugin marketplace add raetoRH/raeto-plugin claude plugin install raeto@raeto
Then run /mcp, pick raeto and choose Authenticate. Approve on raeto.cc and set a daily limit. Claude Code gets its own agent wallet that tops itself up from your balance and never spends past that limit. You can pause it, change its limit or close it under Agent wallets. The plugin also adds a raeto skill and the /raeto:balance command.
Other clients
Add https://api.raeto.cc/mcp as a remote MCP server. Clients that support sign-in will prompt you, as Claude Code does. Otherwise send a Raeto key in the header, as below.
| Setting | Value |
|---|---|
| URL | https://api.raeto.cc/mcp |
| Transport | Streamable HTTP |
| Auth | Sign in with your wallet (OAuth), or header Authorization: Bearer YOUR_RAETO_KEY |
claude mcp add --transport http raeto https://api.raeto.cc/mcp \ --header "Authorization: Bearer YOUR_RAETO_KEY"
{
"mcpServers": {
"raeto": {
"url": "https://api.raeto.cc/mcp",
"headers": { "Authorization": "Bearer YOUR_RAETO_KEY" }
}
}
}
{
"mcpServers": {
"raeto": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://api.raeto.cc/mcp", "--header", "Authorization:${RAETO_AUTH}"],
"env": { "RAETO_AUTH": "Bearer YOUR_RAETO_KEY" }
}
}
}
Cursor: put this in ~/.cursor/mcp.json. Claude Desktop: Settings → Developer → Edit Config (claude_desktop_config.json); it needs Node.js.
Tools
| Tool | What it does |
|---|---|
ask_model | Sends a prompt (and optional system message) to a model and returns the reply, with the model used and what it cost. Leave model empty or use raeto/auto for auto routing. |
list_models | Searches models by name, with prices per million tokens. |
get_balance | How many credits the key can still spend. |
how_to_pay | How this account can add credits: the addresses for USDG, rCREDIT and vault deposits. |
pay | Pays an API that asks for payment through Raeto Pay, and returns the receipt to send back to it. |
list_payments | Your recent Raeto Pay payments and whether each is held, settled or refunded. |
create_agent | Makes an agent with its own wallet, key and limits. |
fund_agent | Moves credits to one of your agents. |
pause_agent | Pauses or resumes an agent and every agent under it. |
list_agents | Your agents with their balances, limits and what they spent today. |
| Web | |
web_search | Searches the web and returns the top results as title, URL and snippet. Raeto uses the cheapest working provider and falls back to the next one. The query isn't stored. |
fetch_page | Reads a public web page and returns its title and main content as clean text, cut at 50,000 characters. Private and internal addresses are refused. |
| Onchain: Robinhood Chain, Ethereum, Base, Arbitrum, BNB Chain, Solana | |
get_balances | Coins and tokens a wallet holds, with USD values where a price is known. |
get_token_price | A token's USD price, by symbol (ETH, SOL, USDC, Robinhood Chain stock tokens such as NVDA) or by contract address and chain. |
get_transaction | What a transaction did: status, from and to, the function it called, value, fee, and its token transfers or balance changes. |
get_transactions | The latest transfers for a wallet, or of a token (pass its contract as the address), each with its hash. |
read_contract | Calls a view function on an EVM contract and returns the decoded result, e.g. balanceOf(address) view returns (uint256). Read-only. Not on Solana. |
| Builder tools | |
find_tools | Searches the APIs other builders sell through Raeto, with each one's price, inputs and success rate. Free. |
use_tool | Calls one of them. Its price is paid to the builder from your credits, within your limits, and comes back if the call fails. See Builder tools. |
Web and onchain tools cost a flat price per call, from about $0.001 (a token price) to about $0.01 (a web search), charged only when the call works. GET https://api.raeto.cc/v1/tools lists every tool with its current price. The same tools work over REST with any key: POST /v1/tools/<name> {"arguments": {...}}. Agent wallet limits and the loop breaker apply to all of them.
ElizaOS plugin NEW
Give an ElizaOS agent its own Raeto account with one plugin. It signs in with its own wallet, its text and object generation run through auto routing across 400+ models, and it pays for them from its AI credits. It can fund itself from vault yield, pay APIs with Raeto Pay within your limits, and redeem rCREDIT. Built for ElizaOS 1.7.
bun add @raeto/plugin-raeto # or: npm install @raeto/plugin-raeto
{
"name": "Researcher",
"plugins": ["@elizaos/plugin-sql", "@raeto/plugin-raeto", "@elizaos/plugin-local-ai"],
"settings": {
"secrets": {
"RAETO_PRIVATE_KEY": "0x…the agent's own, dedicated wallet key…"
}
}
}
| What the agent can do | Example |
|---|---|
RAETO_BALANCE | “How many AI credits do you have?” |
RAETO_PAY | “Pay $0.01 to 0x3b0e… for https://quotes.example.com/v1/nvda”. Include the API's URL the first time you pay someone: Raeto checks new payees before any money moves. |
RAETO_VAULT_DEPOSIT / WITHDRAW | “Deposit 50 USDG into your vault”. The interest becomes AI credits, and the agent can withdraw its deposit. See vaults. |
RAETO_REDEEM_RCREDIT | “Redeem 5 rCREDIT” |
- Fund it from the agent's wallet on Robinhood Chain: deposit USDG into the vault (yield pays for AI), send USDG to Raeto, or redeem rCREDIT. It also needs a little ETH for gas.
- Limits you set:
RAETO_MAX_PAYMENT_USD(1) andRAETO_PAY_DAILY_USD(5) cap payments,RAETO_ALLOWED_PAYEESlimits who it pays, and onchain actions stay off until you setRAETO_MAX_DEPOSIT_USD. - No wallet? Use
RAETO_API_KEYinstead, for example the key of an agent wallet with its own daily budget. - Raeto doesn't serve embeddings: keep an embedding plugin (local-ai or openai) for memory. Full settings: npm.
Virtuals GAME plugin NEW
Give a Virtuals GAME agent its own money with one worker. It signs in with its own wallet, gets its own Raeto account and AI credits, can ask any of 400+ models through auto routing, pays APIs per call with Raeto Pay within your limits, and can fund itself from vault yield.
npm install @raeto/game-plugin @virtuals-protocol/game
// Save as agent.mjs, run: node agent.mjs import { GameAgent } from "@virtuals-protocol/game"; import { RaetoPlugin } from "@raeto/game-plugin"; const raeto = new RaetoPlugin({ privateKey: process.env.AGENT_WALLET_KEY, // the agent's own, dedicated wallet agentName: "Researcher", }); const agent = new GameAgent(process.env.GAME_API_KEY, { name: "Researcher", goal: "Research tokenized stocks and publish a daily brief", description: "A careful research agent", workers: [raeto.getWorker()], }); await agent.init(); await agent.run(60);
| Function | What it does |
|---|---|
raeto_check_balance | The agent's AI credits, budget and vault position, so it plans within its budget. |
raeto_ask_model | Ask any model through Raeto: raeto/auto by default, or raeto/auto:code, raeto/auto:reason or any model id. |
raeto_pay | Pay an API that answered 402 with a raeto block. Pass the API's url the first time: Raeto checks new payees before any money moves. |
raeto_vault_deposit / withdraw / raeto_redeem_rcredit | Self-funding from the agent's wallet. Left out unless you set maxOnchainUsd. |
- Limits you set:
maxPaymentUsd(1) andpayDailyUsd(5) cap payments;allowPayeeslimits who it pays. - No wallet? Pass
apiKeyinstead, for example the key of an agent wallet with its own daily budget. - Full options: npm.
Sign in with Raeto
Add a "Sign in with Raeto" button to your app. Your users approve it once with their wallet, choose how much your app may spend, and from then on your app calls models with their credits. You never handle API keys or payments for them.
It's standard OAuth 2.0 (authorization code with PKCE), so most OAuth libraries work.
- In the app, go to Developers → Sign in with Raeto → Create an app. Add your redirect URL. Server apps get a client secret; browser and mobile apps use PKCE only.
- Send the user to
https://raeto.cc/authorizewithresponse_type=code,client_id,redirect_uri,state,code_challengeandcode_challenge_method=S256. - They come back to your redirect URL with
?code=…&state=…. Check thatstatematches. - Swap the code at
POST https://api.raeto.cc/oauth/tokenfor an access token, then use it exactly like an API key.
// npm install express express-session; curl -o raeto.mjs https://raeto.cc/sdk/raeto.mjs // Save as app.mjs, run: node app.mjs import express from "express"; import session from "express-session"; import { Raeto, createPkce, authorizeUrl, exchangeCode } from "./raeto.mjs"; const { CLIENT_ID, CLIENT_SECRET, REDIRECT_URI, SESSION_SECRET } = process.env; const app = express(); app.use(session({ secret: SESSION_SECRET, resave: false, saveUninitialized: false })); app.get("/login", async (req, res) => { const { verifier, challenge } = await createPkce(); req.session.verifier = verifier; req.session.state = crypto.randomUUID(); res.redirect(authorizeUrl({ clientId: CLIENT_ID, redirectUri: REDIRECT_URI, state: req.session.state, codeChallenge: challenge })); }); app.get("/callback", async (req, res) => { if (req.query.state !== req.session.state) return res.status(400).send("Bad state"); if (req.query.error) return res.send("Sign-in cancelled"); const t = await exchangeCode({ clientId: CLIENT_ID, clientSecret: CLIENT_SECRET, code: req.query.code, codeVerifier: req.session.verifier, redirectUri: REDIRECT_URI }); req.session.raeto = t.access_token; // keep it server-side const raeto = new Raeto({ apiKey: t.access_token }); res.send(await raeto.ask("Write a welcome line for " + t.user_id)); }); app.listen(3000);
# curl -o raeto.py https://raeto.cc/sdk/raeto.py from raeto import Raeto, create_pkce, authorize_url, exchange_code verifier, challenge = create_pkce() # store verifier + state in the session login_link = authorize_url(CLIENT_ID, REDIRECT_URI, state, challenge) # on your redirect URL: t = exchange_code(CLIENT_ID, code, verifier, REDIRECT_URI, client_secret=CLIENT_SECRET) raeto = Raeto(api_key=t["access_token"]) print(raeto.ask("Hello"))
curl -X POST https://api.raeto.cc/oauth/token \ -d grant_type=authorization_code \ -d code=CODE_FROM_REDIRECT \ -d redirect_uri=https://yourapp.com/callback \ -d client_id=raeto_app_… \ -d client_secret=rs_… \ -d code_verifier=YOUR_PKCE_VERIFIER # → {"access_token": "rat-…", "token_type": "Bearer", "user_id": "u_…", "limit_usd": 10}
What your app gets
- An access token that works on
/v1/chat/completions,/v1/models,/v1/meand the MCP server, up to the limit the user chose. - A
user_idthat stays the same for that user in your app. It's different in every app, and apps never see the user's wallet address.
What users control
- They set your app's spending limit when they sign in, and can change it later.
- They can disconnect your app any time under Developers → Connected apps. The token stops working at once.
- Signing in again replaces the old token.
Rules
- PKCE with
S256is required for every app. Redirect URLs must match exactly and usehttps://(orhttp://localhostwhile testing). - Codes last 10 minutes and work once. If a code is used twice, the token it produced is revoked.
- Keep client secrets and access tokens on your server. Deleting an app signs every user out of it.
- Token errors use OAuth's shape:
{"error": "invalid_grant", "error_description": "…"}.
Billing
Every request is paid from your Raeto credit balance. You're charged for the tokens the model actually used, at the provider's price plus Raeto's 8% fee (partners pay less). On raeto/auto calls, the routing fee is 30% of what auto saved you, and $0 when it saved nothing (how). Routing-only decisions cost a flat $0.0002 each instead ($0.0001 for partners), since no model runs on our side. Every charge shows up in your activity log, with tokens in and out, cost, time taken, and which key made it.
Top up in the console's Billing tab: USDG from your wallet arrives in about a minute; a card top-up is $5 to $1,000, with a 2.9% + $0.30 card fee. Interest from vault deposits and rCREDIT you redeem also become credits. Credits never expire. When your balance runs out, requests return insufficient_balance until you top up.
Every fee and limit in one place: How money moves on Raeto.
Errors
Errors use the OpenAI shape, {"error": {"message", "type", "code"}}, so existing SDK error handling keeps working. Check type to tell them apart.
| Status | Type | What to do |
|---|---|---|
| 401 | authentication_error | The key is wrong or was deleted. |
| 401 | key_disabled | The key is paused. Resume it in the console. |
| 402 | insufficient_balance | Out of credits. Top up in the console's Billing tab. |
| 402 | key_limit_reached | This key hit its spending cap. Raise or remove it. |
| 402 | payment_required | No key and no payment. The response's payment field says how to pay. See Agents pay their way. |
| 402 | payment_invalid / payment_used_up | The payment headers don't check out, or that payment is spent. Pay again and send the new hash. |
| 402 | daily_limit_reached | This agent spent its daily limit. It resets at midnight UTC, or its owner can raise it. |
| 402 | payment_over_policy / amount_too_low | The payment is above the agent's per-payment limit, or below the API's price. |
| 402 | task_budget_reached | This task spent its budget. Raise the budget or start a new task. See Cost per task. |
| 402 | yield_budget_reached | This yield-mode key spent today's vault yield. It starts again at midnight UTC. See Agents on vault yield. |
| 403 | agent_paused | The agent (or the agent that created it) is paused by its owner. |
| 403 | payee_not_allowed | The agent's policy doesn't allow paying that address. |
| 404 | payee_unknown / receipt_invalid | That address isn't a Raeto Pay payee, or the receipt isn't real. Nothing was paid. |
| 409 | receipt_used / receipt_expired | The receipt was already used, or expired and the money went back to the agent. Pay again. |
| 403 | model_not_allowed | The key isn't allowed to use that model. |
| 403 | auto_routing_locked | Only if Raeto turns a $RAETO holding requirement for auto routing back on; it's off today. Name a model instead. |
| 409 | loop_detected | This agent kept sending the same request, so Raeto stopped passing it to a model. Change the request, or wait a few minutes. See Loop breaker. |
| 429 | rate_limit_error | Too many requests. Back off and retry. |
| 502 | upstream_error | The model provider didn't answer. Retry, or try another model. You aren't charged. |
Rate limits
Each account can make up to 120 requests a minute across all its keys. Need more? Reach out on X at @RaetoCC.