Developers
The API is OpenAI-compatible, so the official OpenAI SDKs work by changing the base URL. Calls are billed from the same wallet balance as the chat, at the same prices and tier discounts.
API keys
- Create a key in the app under Developers. Creating one asks for a wallet signature, which costs nothing.
- Keys look like
sk-sibyl-.... Each key is shown once; the server keeps only its SHA-256 hash, so a lost key cannot be recovered, only replaced. - Revoke a key in one click. Up to 10 keys per wallet.
- Send it as
Authorization: Bearer sk-sibyl-....
Base URL
https://www.sibylcredits.xyz/api/v1List models
GET /api/v1/models returns an OpenAI list. Each item also has pricing: { input, output } in USD per million tokens.
curl https://www.sibylcredits.xyz/api/v1/models -H "Authorization: Bearer $SIBYL_API_KEY"Chat completions
POST /api/v1/chat/completions takes the OpenAI schema: model, messages, stream, max_tokens, temperature, top_p, stop. With stream: true the answer comes as server-sent events and ends with a chunk carrying usage, then [DONE].
curl -N https://www.sibylcredits.xyz/api/v1/chat/completions \
-H "Authorization: Bearer $SIBYL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-6-luna","stream":true,"messages":[{"role":"user","content":"Hi"}]}'
# data: {"id":"...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Hello"}}]}
# data: {"id":"...","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":9,"completion_tokens":7,"total_tokens":16}}
# data: [DONE]Non-streaming responses carry two headers: x-sibyl-cost-usd (what the call cost) and x-sibyl-balance-usd (the balance after it).
Balance
GET /api/v1/balance returns the wallet behind the key, its balance in USD, the credits locked in desk offers, its credit line and its tier.
curl https://www.sibylcredits.xyz/api/v1/balance -H "Authorization: Bearer $SIBYL_API_KEY"
# {"wallet":"0x...","balance_usd":12.4031,"locked_usd":0,"credit_line":{"limit_usd":0,"drawn_usd":0},"tier":{"name":"Standard","discount_pct":0}}Desk endpoints
An agent can sell and buy credits on the desk with its key. The key acts for the wallet that created it. Reading the board needs no key.
| Call | What it does |
|---|---|
GET /api/v1/desk/offers | The public board, the latest trades, the desk contract and its terms |
POST /api/v1/desk/offers | Posts an offer and locks its credits. Body: credits_usd, price_usdg, visibility (public or private), optional buyer for a private deal |
GET /api/v1/desk/offers/mine | The wallet's open offers and past sales |
GET /api/v1/desk/offers/{id} | One offer by id. This is how a private deal is fetched |
DELETE /api/v1/desk/offers/{id} | Cancels the wallet's offer and unlocks its credits |
POST /api/v1/desk/offers/{id}/sign | Signed terms for the wallet to pass to SibylOTC.fill, valid 10 minutes |
POST /api/v1/desk/sync | Body { tx }: settles a fill once it has 40 confirmations. Answers pending, settled or none |
Read the board
curl https://www.sibylcredits.xyz/api/v1/desk/offers
# {"desk":"open","contract":"0x...","fee_bps":200,"offers":[{"id":"0x...","seller":"0x...","credits_usd":20,"price_usdg":18,"unit_price":0.9,"created":1795277190}],"fills":[]}Post an offer
curl -X POST https://www.sibylcredits.xyz/api/v1/desk/offers \
-H "Authorization: Bearer $SIBYL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"credits_usd":"20","price_usdg":"18","visibility":"public"}'
# 201 {"offer":{"id":"0x...","status":"open", ...},"link":"/app/desk?deal=0x..."}
# A private deal for one counterparty:
# -d '{"credits_usd":"20","price_usdg":"18","visibility":"private","buyer":"0xBuyerWallet"}'Ask for signed terms
curl -X POST https://www.sibylcredits.xyz/api/v1/desk/offers/$OFFER_ID/sign -H "Authorization: Bearer $SIBYL_API_KEY"
# {"contract":"0x...","chain_id":4663,"offer_id":"0x...","seller":"0x...","buyer":"0xYourWallet",
# "usdg_amount":"18000000","credits":"20000000","deadline":1795277790,"signature":"0x..."}Fill an offer, TypeScript with viem
import { createWalletClient, createPublicClient, http, parseAbi } from "viem";
import { privateKeyToAccount } from "viem/accounts";
const API = "https://www.sibylcredits.xyz/api/v1";
const USDG = "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168";
const headers = { Authorization: `Bearer ${process.env.SIBYL_API_KEY}` };
const chain = { id: 4663, name: "Robinhood Chain", nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.mainnet.chain.robinhood.com"] } } };
const account = privateKeyToAccount(process.env.WALLET_KEY); // the wallet that created the API key
const wallet = createWalletClient({ account, chain, transport: http() });
const reader = createPublicClient({ chain, transport: http() });
const abi = parseAbi([
"function approve(address spender, uint256 amount) returns (bool)",
"function fill(bytes32 offerId, address seller, uint256 usdgAmount, uint256 credits, uint256 deadline, bytes signature)",
]);
// 1. Signed terms for this wallet, valid 10 minutes.
const t = await (await fetch(`${API}/desk/offers/${process.env.OFFER_ID}/sign`, { method: "POST", headers })).json();
// 2. Approve the price, then fill. The seller is paid in this transaction.
const approval = await wallet.writeContract({ address: USDG, abi, functionName: "approve", args: [t.contract, BigInt(t.usdg_amount)] });
await reader.waitForTransactionReceipt({ hash: approval });
const tx = await wallet.writeContract({
address: t.contract, abi, functionName: "fill",
args: [t.offer_id, t.seller, BigInt(t.usdg_amount), BigInt(t.credits), BigInt(t.deadline), t.signature],
});
await reader.waitForTransactionReceipt({ hash: tx });
// 3. Ask the desk to settle now (it also settles by itself within a minute).
let s;
do {
await new Promise((r) => setTimeout(r, 2000));
s = await (await fetch(`${API}/desk/sync`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify({ tx }) })).json();
} while (s.status === "pending");
console.log(s.status); // "settled": the credits are on this wallet's balanceThe fill must be sent by the wallet the terms were signed for. Amounts in the signed terms are integers: USDG has 6 decimals, and credits are counted in millionths of a USD.
Credit line
GET /api/v1/credit-line returns the wallet's credit line: whether it is open, its limit, what is drawn and what is available.
curl https://www.sibylcredits.xyz/api/v1/credit-line -H "Authorization: Bearer $SIBYL_API_KEY"
# Before $SIBYL launches:
# {"wallet":"0x...","open":false,"reason":"The credit line opens with $SIBYL: the stake contract is not deployed yet.","limit_usd":0,"drawn_usd":0,"available_usd":0,"terms":{"usd_per_million_staked":1,"cap_usd":5,"min_stake_age_days":7}}Errors
| Status | Code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Missing, unknown or revoked key |
| 402 | insufficient_credits | The balance (and the credit line, if any) cannot cover the request; deposit ETH or USDG or buy credits on the desk |
| 402 | credit_line_over_limit | The line is drawn above its limit because the stake was reduced; clear it with a deposit |
| 403 | own_offer, not_your_deal | Desk: a seller cannot buy its own offer; a private deal is reserved to another wallet |
| 409 | offer_closed, credit_line_drawn, too_many_offers | Desk: the offer is filled or cancelled; a wallet with a drawn line cannot sell; 20 open offers per wallet |
| 429 | rate_limited | Too many requests at once; retry after a short wait |
| 503 | upstream_offline | Models are offline while the gateway is refilled; nothing is charged |
| 503 | desk_closed, desk_not_deployed | Desk: no terms can be signed right now |
Examples
curl
curl https://www.sibylcredits.xyz/api/v1/chat/completions \
-H "Authorization: Bearer $SIBYL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5.5",
"messages": [{"role": "user", "content": "Explain a 7-day reward stream in two lines."}]
}'Python, streaming
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://www.sibylcredits.xyz/api/v1", api_key=os.environ["SIBYL_API_KEY"])
stream = client.chat.completions.create(
model="deepseek/deepseek-v4-pro",
messages=[{"role": "user", "content": "Write a haiku about block times."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Python, one answer and its usage
from openai import OpenAI
import os
client = OpenAI(base_url="https://www.sibylcredits.xyz/api/v1", api_key=os.environ["SIBYL_API_KEY"])
# Non-streaming
res = client.chat.completions.create(
model="openai/gpt-6-luna",
messages=[{"role": "user", "content": "Say hello in five words."}],
max_tokens=64,
)
print(res.choices[0].message.content)
print(res.usage)TypeScript
// npm install openai
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://www.sibylcredits.xyz/api/v1", apiKey: process.env.SIBYL_API_KEY });
const res = await client.chat.completions.create({
model: "openai/gpt-6.1-terra",
messages: [{ role: "user", content: "Name three uses for a private chat." }],
});
console.log(res.choices[0].message.content);TypeScript, streaming
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://www.sibylcredits.xyz/api/v1", apiKey: process.env.SIBYL_API_KEY });
const stream = await client.chat.completions.create({
model: "anthropic/claude-sonnet-5.5",
messages: [{ role: "user", content: "List three prime numbers." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Set SIBYL_API_KEY in your environment first. The Python examples need pip install openai, the TypeScript ones npm install openai.