/** Per-call context: the key for this request only, the caller's signal and the timeout. */ export interface CallContext { apiKey: string; signal?: AbortSignal; timeoutMs: number; } /** Ids are prefixed and stable (`ava_…`, `seed-…`, `ast_…`); reject anything that could alter the path. */ export declare function assertId(value: string, label: string): string; /** Only http(s) URLs may be registered as remote assets. */ export declare function assertHttpUrl(value: string, label: string): string; /** Credits are billed in micros; 1 credit = 1 second on air. */ export declare function microsToCredits(micros: unknown): number | null; export interface Balance { balanceCredits: number | null; reservedCredits: number | null; availableCredits: number | null; lifetimeGrantedCredits: number | null; lifetimeUsedCredits: number | null; approxMinutesAvailable: number | null; updatedAt: string | null; } export declare function getBalance(ctx: CallContext): Promise; export interface Capacity { maxSessions: number | null; activeSessions: number | null; reservedSessions: number | null; availableSessions: number | null; queueSize: number | null; admissionOpen: boolean | null; recommendedRetryMs: number | null; load: number | null; } export declare function getCapacity(ctx: CallContext): Promise; export interface UsageQuery { from?: string; to?: string; limit?: number; cursor?: string; endUserId?: string; } export interface UsageSession { sessionId: string | null; avatarId: string | null; avatarName: string | null; status: string | null; startedAt: string | null; endedAt: string | null; /** Seconds the call was live and billable (the spec's `activeSeconds`). */ activeSeconds: number | null; billedCredits: number | null; /** `client_metadata.user_id` the call was minted with, when tagged. */ endUserId: string | null; metadata: Record; } export interface UsagePage { sessions: UsageSession[]; nextCursor: string | null; from: string | null; to: string | null; } export declare function listUsage(ctx: CallContext, query: UsageQuery): Promise; export interface Avatar { id: string | null; displayName: string | null; status: string | null; idleVideoStatus: string | null; sourceKind: string | null; sourceAssetId: string | null; modelId: string | null; defaultVoiceId: string | null; llm: { provider: string | null; model: string | null; } | null; error: string | null; createdAt: string | null; updatedAt: string | null; } export declare function toAvatar(value: unknown): Avatar; export declare function listAvatars(ctx: CallContext): Promise; export declare function getAvatar(ctx: CallContext, avatarId: string): Promise; export interface CreateAvatarInput { displayName: string; sourceAssetId: string; motionPrompt?: string; defaultVoiceId?: string; voiceDescription?: string; llm?: { provider?: string; model?: string; }; settings?: Record; metadata?: Record; } export declare function createAvatar(ctx: CallContext, input: CreateAvatarInput): Promise; export interface UpdateAvatarInput { displayName?: string; defaultVoiceId?: string; llmProvider?: string; llmModel?: string; settings?: Record; metadata?: Record; persona?: Record; artDirection?: string; stylePreset?: string; anchorTimeMs?: number; /** Portrait swap lane: exclusive of every other field except anchorTimeMs. */ sourceAssetId?: string; } export declare function updateAvatar(ctx: CallContext, avatarId: string, input: UpdateAvatarInput): Promise; export declare function deleteAvatar(ctx: CallContext, avatarId: string): Promise; export interface Clip { clipId: string | null; role: string | null; status: string | null; url: string | null; whenHint: string | null; /** `generated` or `uploaded` on the wire. */ source: string | null; motionPrompt: string | null; uploadAssetId: string | null; durationSeconds: number | null; /** `{ code, message }` when the clip failed. */ error: { code: string | null; message: string | null; } | null; poseCheck: unknown; } export interface ClipLibrary { avatarId: string | null; revision: number | null; anchorVersion: number | null; clipLibraryEligible: boolean | null; clips: Clip[]; plan?: Record; } export declare function listClips(ctx: CallContext, avatarId: string): Promise; export interface ClipDeclaration { clipId: string; role: string; whenHint?: string; source: { motionPrompt: string; } | { assetId: string; }; durationSeconds?: number; reroll?: boolean; } export declare function setClipLibrary(ctx: CallContext, avatarId: string, clips: ClipDeclaration[], expectedRevision: number | undefined, idempotencyKey: string): Promise; export interface LoopResult { avatarId: string | null; loopStatus: string | null; motionPrompt: string | null; servingUrl: string | null; } export declare function setLoop(ctx: CallContext, avatarId: string, motionPrompt: string, idempotencyKey: string): Promise; export interface Asset { id: string | null; kind: string | null; status: string | null; contentType: string | null; sizeBytes: number | null; publicUrl: string | null; createdAt: string | null; } export declare function toAsset(value: unknown): Asset; export declare function listAssets(ctx: CallContext): Promise; export interface RemoteAssetInput { kind: 'image' | 'video' | 'audio'; remoteUrl: string; originalFilename?: string; metadata?: Record; } export declare function createRemoteAsset(ctx: CallContext, input: RemoteAssetInput): Promise; export interface MintInput { avatarId: string; mode?: 'avatar' | 'voice'; instructions?: string; initialContext?: Array<{ role: 'system' | 'user' | 'assistant'; content: string; }>; maxSessionSeconds: number; /** Plain voice override → wire field `voice_id` (string). */ voiceId?: string; /** Full voice object → wire field `voice` ({ provider, voice_id, … }). */ voice?: Record; clientMetadata?: Record; transcriptWebhook?: { url: string; secret: string; }; } export interface SessionGrant { status: 'ready'; sessionId: string | null; roomName: string | null; livekitUrl: string | null; participantIdentity: string | null; participantToken: string | null; reservationExpiresAt: string | null; joinTimeoutSeconds: number | null; idleTimeoutSeconds: number | null; maxSessionSeconds: number | null; } export interface QueuedGrant { status: 'queued'; queueTicketId: string | null; queuePosition: number | null; queueSize: number; recommendedRetryMs: number; } /** Mint a session. A capacity-full 429 is returned as a queued result, not thrown. */ export declare function mintSession(ctx: CallContext, input: MintInput): Promise; export declare const RELEASE_REASONS: readonly ["page_hide", "disconnected", "superseded", "unmount", "manual", "idle_timeout"]; export type ReleaseReason = (typeof RELEASE_REASONS)[number]; export declare function releaseSession(ctx: CallContext, ids: { sessionId?: string; queueTicketId?: string; }, reason: ReleaseReason): Promise;