/** * Z.AI API client for vision, search, and reader */ import { type ZaiConfig } from "./config.js"; export interface ImageContent { type: "image_url"; image_url: { url: string; }; } export interface VideoContent { type: "video_url"; video_url: { url: string; }; } export interface TextContent { type: "text"; text: string; } export type MessageContent = ImageContent | VideoContent | TextContent; export interface Message { role: "system" | "user" | "assistant"; content: string | MessageContent[]; } export interface VisionRequest { model: string; messages: Message[]; thinking?: { type: string; }; /** #136: glm-5.3-flash documented recipe — reasoning_effort: "max". */ reasoning_effort?: string; stream: boolean; temperature: number; top_p: number; max_tokens: number; } export interface VisionResponse { id: string; created: number; model: string; choices: Array<{ index: number; message: { role: string; content: string; reasoning_content?: string; }; finish_reason: string; }>; usage: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; } export interface SearchRequest { search_engine: "search-prime"; search_query: string; count?: number; search_domain_filter?: string; search_recency_filter?: "oneDay" | "oneWeek" | "oneMonth" | "oneYear" | "noLimit"; } export interface SearchResult { title: string; content: string; link: string; media: string; icon: string; refer: string; publish_date?: string; } export interface SearchResponse { id: string; created: number; search_result: SearchResult[]; } export interface ReaderRequest { url: string; timeout?: number; no_cache?: boolean; return_format?: "markdown" | "text"; retain_images?: boolean; no_gfm?: boolean; with_images_summary?: boolean; with_links_summary?: boolean; } export interface ReaderResponse { id: string; created: number; reader_result: { content: string; description: string; title: string; url: string; metadata?: Record; }; } export declare class ZaiApiClient { private config; constructor(config?: ZaiConfig, env?: NodeJS.ProcessEnv); private request; /** * Vision completions API for image/video analysis */ visionComplete(messages: Message[]): Promise; /** * Web search API */ webSearch(params: { query: string; count?: number; domainFilter?: string; recencyFilter?: "oneDay" | "oneWeek" | "oneMonth" | "oneYear" | "noLimit"; }): Promise; /** * Web reader API */ webRead(params: { url: string; format?: "markdown" | "text"; retainImages?: boolean; withLinksSummary?: boolean; timeout?: number; }): Promise; } export declare function createImageContent(url: string): ImageContent; export declare function createVideoContent(url: string): VideoContent; export declare function createTextContent(text: string): TextContent; export declare function createMultimodalMessage(contents: MessageContent[], role?: "user" | "system"): Message; //# sourceMappingURL=api-client.d.ts.map