import type { Credentials } from "./auth.js"; export interface VideoGenRequest { model: string; prompt: string; metadata?: { duration?: number; ratio?: string; resolution?: string; }; } export interface VideoGenResponse { id: string; task_id: string; object?: string; model: string; status: string; progress?: number; created_at: number; result_url?: string; } export interface VideoTaskDetail { code: string; message: string; data: { task_id: string; status: string; progress: string; result_url: string; quota: number; fail_reason: string; finish_time: number; }; } export interface ImageGenRequest { model: string; prompt: string; n?: number; size?: string; } export interface ImageGenResponse { id?: string; task_id?: string; data?: Array<{ url: string; }>; status?: string; model?: string; created_at?: number; } export interface BillingInfo { object: string; has_payment_method: boolean; soft_limit_usd: number; hard_limit_usd: number; system_hard_limit_usd: number; access_until: number; } export declare class ApiError extends Error { statusCode: number; responseBody: string; constructor(statusCode: number, message: string, body?: string); } export declare function createVideo(creds: Credentials, req: VideoGenRequest): Promise; export declare function getVideoTask(creds: Credentials, taskId: string): Promise; export declare function createImage(creds: Credentials, req: ImageGenRequest, async?: boolean): Promise; export declare function getBalance(creds: Credentials): Promise; export interface TaskListItem { task_id: string; status: string; progress?: string; action?: string; model?: string; result_url?: string; quota?: number; fail_reason?: string; created_at?: number; } export interface TaskListResponse { success: boolean; data: { items: TaskListItem[]; total: number; }; } export declare function listTasks(creds: Credentials, page: number, pageSize: number): Promise; export declare function downloadFile(url: string, outputPath: string): Promise; export interface ChatMessage { role: "system" | "user" | "assistant"; content: string; } export interface ChatRequest { model: string; messages: ChatMessage[]; max_tokens?: number; temperature?: number; stream?: boolean; } export interface ChatResponse { choices: Array<{ message: { role: string; content: string; }; finish_reason: string; }>; usage: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; } export declare function chat(creds: Credentials, req: ChatRequest): Promise; export declare function chatStream(creds: Credentials, req: ChatRequest, onChunk: (text: string) => void): Promise; export interface ModelInfo { name: string; type: "chat" | "video" | "image"; price_credits?: number; output_credits?: number; pricing_note?: string; } export declare const KNOWN_MODELS: ModelInfo[]; export declare function listKnownModels(filterType?: string): ModelInfo[]; export interface UserInfo { id: number; username: string; email?: string; quota: number; used_quota: number; group: string; status: number; } export interface TopupRecord { id: number; amount: number; quota: number; status: string; created_at: number; payment_method?: string; } export declare function getSelf(creds: Credentials): Promise<{ data: UserInfo; }>; export declare function getTopupInfo(creds: Credentials): Promise; export declare function getTopupHistory(creds: Credentials, page?: number, pageSize?: number): Promise; export interface ByokConfig { api_key: string; base_url: string; } export declare function byokChat(byok: ByokConfig, req: ChatRequest): Promise; export declare function byokChatStream(byok: ByokConfig, req: ChatRequest, onChunk: (text: string) => void): Promise; export declare function byokCreateImage(byok: ByokConfig, req: ImageGenRequest): Promise;