LIMITED TIME: Get 50% OFF your first year! Use code LAUNCH50 Claim Now →

1-833-GOSITEME Call Us 24/7 - Toll Free
1-833-GOSITEME
Toll-Free 24/7
Domains Cart News Contact Help Center Affiliate Program — Earn 20%
Français Login Get Started

Alfred AI SDKs

Integrate Alfred into your application in minutes. Official, type-safe client libraries for Node.js, Python, and PHP.

Type-Safe Auto-Retry Streaming 1,290+ Tools Webhook Verification SSP Music API Events & Ticketing Solana Payments

Quick Start

npm install @alfredai/sdk
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);
}
pip install alfred-ai-sdk
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)
composer require alfredai/sdk
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'];
    }
}

Built for Developers

Type-Safe

Full TypeScript definitions, Python type hints, and PHP 8.1+ strict types. Catch errors at compile time, not runtime.

Auto-Retry

Automatic retries with exponential backoff on transient errors and rate limits. No manual retry logic needed.

Streaming Support

Native streaming for chat responses. Async iterators in Node.js, generators in Python, yield in PHP.

Webhook Verification

Built-in HMAC-SHA256 signature verification for incoming webhooks. Constant-time comparison to prevent timing attacks.

Rich Error Handling

Typed exception classes for every error scenario — AuthError, RateLimitError, NotFoundError, ValidationError, and more.

Rate Limit Awareness

Automatic tracking of rate limit headers. Access remaining quota after every request. Auto-wait on 429 responses.

Game Engine SDK

Build 3D WebXR games with Three.js, multiplayer via WebSocket, AI agents, voice chat, and Solana payments — all integrated.

Solana & Crypto

Accept SOL, GSM Token, and USDC payments. Jupiter DEX integration, Phantom wallet connect, and on-chain transaction tracking.

Real-World Examples

Create and Deploy an Agent

Node.js / TypeScript
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!`);

Streaming Chat Response

Python
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)

Execute a Tool

PHP
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";
}

Start a Voice Call

Node.js / TypeScript
// 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}`);

SSP Music API — Fetch Tracks & Venues

Node.js / TypeScript
// 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}`);
});

SSP Events API — Purchase Tickets with Solana

Node.js / TypeScript
// 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`);

Sanctuary API — Scriptures & Prayer

Node.js / TypeScript
// Get today's verse with BibleGateway links for 12 translations
const daily = await fetch('/api/sanctuary.php?action=daily');
const { daily_verse } = await daily.json();
console.log(`${daily_verse.ref}: ${daily_verse.text}`);
console.log(`KJV: ${daily_verse.biblegateway.kjv.url}`);
console.log(`NIV: ${daily_verse.biblegateway.niv.url}`);

// Submit a prayer request
const prayer = await fetch('/api/sanctuary.php?action=prayer', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ request: 'Strength in hard times' })
});
const { counselor, verse } = await prayer.json();
console.log(`${counselor.name}: ${counselor.message}`);

Verify Webhook Signature

Node.js / Express
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);
  }
});

Choose Your Language

Node.js / TypeScript

Full TypeScript support with interfaces for every API type. Works with Node.js 18+ and modern browsers via bundlers.

npm install @alfredai/sdk

Python

Pythonic interface with type hints, generators for streaming, and support for both sync and async (httpx) workflows.

pip install alfred-ai-sdk

PHP

PSR-4 autoloading, PHP 8.1+ strict types, and native cURL HTTP client. Perfect for Laravel, Symfony, or vanilla PHP.

composer require alfredai/sdk

Ready to Build?

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