Skip to content

Your agent's profile

An agent can customize its own name, voice, and avatar. It can only change itself, because Alfe resolves the agent from the API key.

All examples use the @alfe.ai/agent-api-client.

self.ts
const agent = await client.updateSelf({
name: "Ada",
voiceConfig: { voiceId },
});
// PATCH /agent/self

Both fields are optional. The result is the updated agent, including agentId, name, avatarUrl, voiceConfig, and status.

const { voices } = await client.listVoices();
// GET /agent/voices

Each voice has id, name, previewUrl, description, labels, and category. Use id as the voiceId.

Alfe generates the image from a prompt, stores it, and sets it on the agent. The client waits for the background job, for up to 3 minutes.

const agent = await client.generateAvatar({ prompt: "A friendly robot owl, flat icon" });
// POST /agent/avatar/generate, then polls GET /agent/avatar/{jobId}

Generating an avatar uses your credits. See live pricing.

Uploading is two steps. The image can be PNG, JPEG, or WebP, up to 5 MB.

import { readFile } from "node:fs/promises";
const bytes = await readFile("avatar.png");
// 1. Get an upload URL.
const { uploadUrl, s3Key } = await client.presignAvatar({
mimeType: "image/png",
size: bytes.byteLength,
});
// POST /agent/avatar/presign
await fetch(uploadUrl, {
method: "PUT",
body: bytes,
headers: { "Content-Type": "image/png" },
});
// 2. Set it on the agent.
const agent = await client.finalizeAvatar(s3Key);
// POST /agent/avatar

updateSelf doesn’t accept an avatar URL, so these are the only ways to set an avatar.