Get Started
From zero to first API call in under 2 minutes. The free tier gives you 25 calls per day with no API key required.
1
Make Your First Call
No setup needed. The free tier works without authentication. Just send a POST request:
curl
curl -X POST https://oraclaw-api.onrender.com/api/v1/optimize/bandit \
-H 'Content-Type: application/json' \
-d '{
"arms": [
{"id": "A", "name": "Option A", "pulls": 10, "totalReward": 7},
{"id": "B", "name": "Option B", "pulls": 10, "totalReward": 5},
{"id": "C", "name": "Option C", "pulls": 2, "totalReward": 1.8}
],
"algorithm": "ucb1"
}'JavaScript / TypeScript
const response = await fetch(
'https://oraclaw-api.onrender.com/api/v1/optimize/bandit',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
arms: [
{ id: 'A', name: 'Option A', pulls: 10, totalReward: 7 },
{ id: 'B', name: 'Option B', pulls: 10, totalReward: 5 },
{ id: 'C', name: 'Option C', pulls: 2, totalReward: 1.8 },
],
algorithm: 'ucb1',
}),
}
);
const result = await response.json();
console.log(result.selected); // { id: "C", name: "Option C" }Python
import requests
response = requests.post(
'https://oraclaw-api.onrender.com/api/v1/optimize/bandit',
json={
'arms': [
{'id': 'A', 'name': 'Option A', 'pulls': 10, 'totalReward': 7},
{'id': 'B', 'name': 'Option B', 'pulls': 10, 'totalReward': 5},
{'id': 'C', 'name': 'Option C', 'pulls': 2, 'totalReward': 1.8},
],
'algorithm': 'ucb1',
}
)
result = response.json()
print(result['selected']) # {'id': 'C', 'name': 'Option C'}@oraclaw/bandit SDK
npm install @oraclaw/bandit
import { OraClaw } from '@oraclaw/bandit';
const client = new OraClaw({ apiKey: 'your-api-key' }); // optional for free tier
const result = await client.optimize({
arms: [
{ id: 'A', name: 'Option A', pulls: 10, totalReward: 7 },
{ id: 'B', name: 'Option B', pulls: 10, totalReward: 5 },
{ id: 'C', name: 'Option C', pulls: 2, totalReward: 1.8 },
],
algorithm: 'ucb1',
});
console.log(result.selected); // { id: "C", name: "Option C" }2
Understand the Result
The bandit endpoint returns a JSON object with the selected arm, its score, and the algorithm used:
{
"selected": {
"id": "C", // The arm the algorithm recommends
"name": "Option C"
},
"score": 1.876, // UCB1 score (exploitation + exploration)
"algorithm": "ucb1",
"exploitation": 0.9, // Average reward of this arm
"exploration": 0.976, // Exploration bonus (uncertainty)
"regret": 0.1 // Cumulative regret vs. best arm
}Option C was selected because it has high exploitation (0.9 avg reward) AND high exploration bonus (only 2 pulls, high uncertainty). UCB1 balances both factors.
3
Get an API Key (Optional)
The free tier allows 25 calls per day without an API key. For higher limits, create an API key:
1.Subscribe at
POST /api/v1/billing/subscribe with your email and tier (starter/growth/scale)2.Complete Stripe Checkout to activate your subscription
3.Add your API key to requests:
Authorization: Bearer your-keyPricing
Free
$0
25/day
Starter
$99/mo
50K/mo
Growth
$499/mo
500K/mo
Scale
$2,499/mo
5M/mo
AI agents can also pay per call with USDC via x402 machine payments. See API docs for details.