Integrate Alfred into your application in minutes. Official, type-safe client libraries for Node.js, Python, and PHP.
import { AlfredClient } from '@alfredai/sdk';
const alfred = new AlfredClient({ apiKey: 'ak_live_xxx_yyy' });
// Execute a tool
const result = await alfred.tools.execute('dns_lookup', {
args: { domain: 'example.com', type: 'A' }
});
console.log(result.data.result);
// Chat with Alfred
const reply = await alfred.chat.ask('Summarize this document...');
console.log(reply);
// Stream a response
for await (const chunk of alfred.chat.stream({ message: 'Write a story' })) {
if (chunk.type === 'text') process.stdout.write(chunk.content);
}
from alfred_sdk import AlfredClient
client = AlfredClient(api_key="ak_live_xxx_yyy")
# Execute a tool
result = client.tools.execute("dns_lookup", args={"domain": "example.com", "type": "A"})
print(result["data"]["result"])
# Chat with Alfred
reply = client.chat.ask("Summarize this document...")
print(reply)
# Stream a response
for chunk in client.chat.stream("Write a story"):
if chunk.get("type") == "text":
print(chunk["content"], end="", flush=True)
use AlfredAI\Alfred;
$alfred = new Alfred(['api_key' => 'ak_live_xxx_yyy']);
// Execute a tool
$result = $alfred->tools->execute('dns_lookup', ['domain' => 'example.com', 'type' => 'A']);
print_r($result['data']['result']);
// Chat with Alfred
$reply = $alfred->chat->ask('Summarize this document...');
echo $reply;
// Stream a response
foreach ($alfred->chat->stream('Write a story') as $chunk) {
if (($chunk['type'] ?? '') === 'text') {
echo $chunk['content'];
}
}
Full TypeScript definitions, Python type hints, and PHP 8.1+ strict types. Catch errors at compile time, not runtime.
Automatic retries with exponential backoff on transient errors and rate limits. No manual retry logic needed.
Native streaming for chat responses. Async iterators in Node.js, generators in Python, yield in PHP.
Built-in HMAC-SHA256 signature verification for incoming webhooks. Constant-time comparison to prevent timing attacks.
Typed exception classes for every error scenario — AuthError, RateLimitError, NotFoundError, ValidationError, and more.
Automatic tracking of rate limit headers. Access remaining quota after every request. Auto-wait on 429 responses.
Build 3D WebXR games with Three.js, multiplayer via WebSocket, AI agents, voice chat, and Solana payments — all integrated.
Accept SOL, GSM Token, and USDC payments. Jupiter DEX integration, Phantom wallet connect, and on-chain transaction tracking.
const agent = await alfred.agents.create({
agent_name: 'Customer Support Bot',
agent_role: 'specialist',
task: 'Handle billing and account questions',
skills: ['product_lookup', 'ticket_create', 'refund_process'],
voice_enabled: true,
voice_engine: 'cartesia',
});
// Deploy the agent
await alfred.agents.deploy(agent.data.id, {
task: 'Monitor incoming support tickets',
auto_start: true,
});
console.log(`Agent ${agent.data.agent_name} deployed!`);
from alfred_sdk import AlfredClient
client = AlfredClient(api_key="ak_live_xxx_yyy")
for chunk in client.chat.stream(
"Analyze the security posture of my infrastructure",
tools=["security_scan", "vulnerability_check", "ssl_verify"],
):
if chunk.get("type") == "text":
print(chunk["content"], end="", flush=True)
elif chunk.get("type") == "tool_start":
print(f"\n🔧 Running {chunk['tool']}...", flush=True)
elif chunk.get("type") == "tool_end":
print(f" ✅ Done", flush=True)
use AlfredAI\Alfred;
use AlfredAI\Exceptions\RateLimitException;
$alfred = new Alfred(['api_key' => 'ak_live_xxx_yyy']);
try {
$result = $alfred->tools->execute('seo_audit', [
'url' => 'https://example.com',
'depth' => 3,
'check_mobile' => true,
]);
echo "Score: " . $result['data']['result']['score'] . "/100\n";
echo "Issues: " . count($result['data']['result']['issues']) . "\n";
} catch (RateLimitException $e) {
echo "Rate limited — retry in {$e->retryAfter}s\n";
}
// Create a voice room with an AI agent
const room = await alfred.voice.createRoom({
name: 'Sales Call',
max_participants: 3,
voice_engine: 'cartesia',
agent_id: 42,
});
console.log(`Room created: ${room.data.name}`);
console.log(`Join at: /voice/rooms/${room.data.id}`);
// Fetch tracks from SoundStudioPro Music API
const tracks = await fetch('/api/ssp-music.php?action=tracks&genre=house');
const data = await tracks.json();
console.log(`${data.tracks.length} tracks found`);
// Get all 16 world venues
const venues = await fetch('/api/ssp-music.php?action=venues');
const venueData = await venues.json();
venueData.venues.forEach(v => {
console.log(`${v.name} — capacity: ${v.capacity}`);
});
// List upcoming DJ events
const events = await fetch('/api/ssp-events.php?action=events&filter=featured');
const { events: list } = await events.json();
// Purchase VIP tickets with SOL
const purchase = await fetch('/api/ssp-events.php?action=purchase', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
event_id: 'evt-001',
tier: 'vip',
quantity: 2,
payment_method: 'sol',
wallet: 'YourSolanaWalletAddress...'
})
});
const ticket = await purchase.json();
console.log(`Ticket: ${ticket.purchase.ticket_id}`);
console.log(`Total: ${ticket.purchase.total} SOL`);
// Brotherhood of Jesus Christ — 60 agents speaking 50 languages
const agents = await fetch('/api/brotherhood.php?action=agents');
const { agents: brotherhood } = await agents.json();
console.log(`${brotherhood.length} Brotherhood agents ready`);
brotherhood.filter(a => a.role === 'apostle').forEach(a =>
console.log(`${a.name} — ${a.languages.join(', ')}`));
// 50 languages — "Every man heard them speak in his own language"
const langs = await fetch('/api/brotherhood.php?action=languages');
const { languages } = await langs.json();
languages.forEach(l => console.log(`${l.native}: ${l.greeting}`));
// 13 interconnected games — all connected to the Gospel
const games = await fetch('/api/brotherhood.php?action=connections');
const { connections } = await games.json();
connections.forEach(g => console.log(`${g.game}: ${g.gospel_hook}`));
// Game Engine SDK — text, voice, API, transactions
const sdk = await fetch('/api/brotherhood.php?action=sdk');
const { sdk: config } = await sdk.json();
console.log(`${config.name} v${config.version}`);
// The Royal Line of Perez — 41 generations
const lineage = await fetch('/api/sanctuary.php?action=lineage');
const { lineage: generations, insight } = await lineage.json();
console.log(insight.title); // "The Secret of the Game of Life"
// 12 Classrooms, Donations, Daily verse — all still available
const classes = await fetch('/api/sanctuary.php?action=classrooms');
const { classrooms } = await classes.json();
classrooms.forEach(c => console.log(`${c.title} — ${c.teacher.name}`));
// Browse 30 gospel tracks across 12 genres
const tracks = await fetch('/api/ssp-gospel.php?action=tracks');
const { tracks: gospelTracks } = await tracks.json();
// Get Psalms of David with instruments & keys
const psalms = await fetch('/api/ssp-gospel.php?action=psalms');
const { psalms: davidPsalms } = await psalms.json();
console.log(`${davidPsalms[0].title} — ${davidPsalms[0].key} at ${davidPsalms[0].bpm} BPM`);
// Create a gospel track with SSP token
const track = await fetch('/api/ssp-gospel.php?action=create', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
title: 'Amazing Grace Remix', genre: 'contemporary-worship',
key: 'G major', instruments: ['harp-of-david', 'choir-angelic']
})
});
const { track: newTrack } = await track.json();
console.log(`Created: ${newTrack.title} (SSP ID: ${newTrack.ssp_id})`);
import express from 'express';
import { AlfredClient } from '@alfredai/sdk';
const alfred = new AlfredClient({ apiKey: 'ak_live_xxx_yyy' });
const app = express();
app.post('/webhooks/alfred', express.text({ type: '*/*' }), (req, res) => {
try {
const event = alfred.webhooks.verifyAndParse(
req.body,
req.headers['x-webhook-signature'] as string,
process.env.WEBHOOK_SECRET!,
);
console.log(`Received ${event.event}:`, event.data);
res.sendStatus(200);
} catch {
res.sendStatus(401);
}
});
Full TypeScript support with interfaces for every API type. Works with Node.js 18+ and modern browsers via bundlers.
Pythonic interface with type hints, generators for streaming, and support for both sync and async (httpx) workflows.
PSR-4 autoloading, PHP 8.1+ strict types, and native cURL HTTP client. Perfect for Laravel, Symfony, or vanilla PHP.
Get your API key from the Developer Portal and start integrating Alfred AI into your application today.
Someone from somewhere
just launched website.com
Just now