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
AI Hosting Token Packs SSL Certificates Training Server Support Build AI Server
GoCodeMe Online Download Editor Alfred AI — 875+ Tools Voice & AI Products — From $3/mo
Tool Directory Marketplace Pricing About Us Use Cases Compare Enterprise Documentation Changelog Fleet Dashboard Conference Rooms API Reference Getting Started Developer Portal Extensions IVR Builder Agent Templates Conversations Team Workspace SDKs Webhooks Analytics Creator Dashboard Help Center Security
Power-Up Add-Ons Domains News Contact 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 875+ Tools Webhook Verification

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.

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}`);

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