OFFRE LIMITÉE : Obtenez 50 % de réduction la première année ! Code LAUNCH50 En profiter →

1-833-GOSITEME Appelez-nous 24 h/24, 7 j/7 - Sans frais
1-833-GOSITEME
Sans frais 24/7
Domaines Cart Actualités Contact Help Center Affiliate Program — Earn 20%
English Connexion Commencer

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 v4.0 — Brotherhood, 60 Agents, 50 Languages

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

SSP Gospel Music API — Create & Automix

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

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