Quickstart
From a project to your first AI call paid by a token's fees, in four steps.
Make a project
Sign in at relayfor.si with your email or a Solana wallet, and make a project. Name the payout wallet your part of each token's creator fees goes to.
Every project starts with the Standard fee strategy: of your part of each creator fee, 60% becomes the token's AI credit, 20% goes to its creator and 20% to your payout wallet.
Make a secret key
Open Keys in the project and make a secret key. It starts with rf_sk_ and is shown once. Keep it on your server, never in a browser or an app:
export RELAYFOR_SECRET_KEY="rf_sk_..."No server? Launch from the dashboard's Launch page with a wallet in your browser, and skip to step 4.
Launch a token
Your server prepares the launch for your user's wallet, which signs it last and pays for it: about 0.05 SOL, our 0.02 SOL fee included.
// npm i relayfor.si
import { RelayForSI } from "relayfor.si";
const relayForSI = new RelayForSI(); // reads RELAYFOR_SECRET_KEY
const launch = await relayForSI.launches.prepare({
creator: "<the user's wallet address>",
name: "Acme",
symbol: "ACME",
image: await relayForSI.files.dataUri(imageFile),
});The answer carries the launch's id, its mint, its route and a transaction. Have the wallet sign it in the browser, then submit the signed copy (relayForSI.launches.submit(), or POST /launches/{id}/submit). Its state turns confirmed within seconds. See Launch a token.
Make a router key and call a model
Every token has its own credit account. Make a router key on it for your agent, here with a $5 daily limit:
const { key } = await relayForSI.keys.create({
account: "<the token mint>",
name: "agent-1",
limit: { usd: "5", reset: "daily" },
});The answer carries the key (rf_ai_...) this once. On the dashboard it's Credit, then the token's account, then New router key. Point any OpenAI or Anthropic SDK at the RFS Router with it:
import OpenAI from "openai";
const ai = new OpenAI({
baseURL: "https://relayfor.si/api/v1",
apiKey: process.env.RELAYFOR_ROUTER_KEY,
});
const reply = await ai.chat.completions.create({
model: "anthropic/claude-sonnet-5.5",
messages: [{ role: "user", content: "Plan today's three posts for $ACME." }],
max_tokens: 512,
});
console.log(reply.choices[0].message.content);No credit yet?
A new token's account fills with its first payout, once trading has paid 0.01 SOL of
creator fees. To start sooner, buy credit in USDC, from $20.
Until then a call answers 402 insufficient_balance.