route-claudecode
Version:
Advanced routing and transformation system for Claude Code outputs to multiple AI providers
69 lines • 1.64 kB
TypeScript
/**
* 纯API调用客户端封装
* 提供最小化的OpenAI API调用封装,无业务逻辑
*
* 遵循零硬编码、零Fallback、零沉默失败原则
*/
export interface OpenAIClientConfig {
baseURL: string;
apiKey?: string;
timeout?: number;
maxRetries?: number;
defaultHeaders?: Record<string, string>;
allowDummyKey?: boolean;
}
export interface OpenAIRequestParams {
model: string;
messages: any[];
max_tokens?: number;
temperature?: number;
stream?: boolean;
tools?: any[];
tool_choice?: any;
}
/**
* 纯粹的OpenAI API客户端
* 只负责API调用,不包含任何业务逻辑或格式转换
*/
export declare class PureOpenAIAPIClient {
private client;
private config;
constructor(config: OpenAIClientConfig);
/**
* 🎯 发送非流式请求
*/
sendChatCompletion(params: OpenAIRequestParams): Promise<any>;
/**
* 🎯 发送流式请求
*/
sendStreamChatCompletion(params: OpenAIRequestParams): Promise<AsyncIterable<any>>;
/**
* 🎯 健康检查
*/
healthCheck(): Promise<boolean>;
/**
* 验证配置
*/
private validateConfig;
/**
* 验证请求参数
*/
private validateRequestParams;
/**
* 处理API错误
*/
private handleApiError;
/**
* 获取客户端配置(只读)
*/
getConfig(): Readonly<OpenAIClientConfig>;
/**
* 获取基础URL
*/
getBaseURL(): string;
/**
* 检查是否有有效的API Key
*/
hasValidApiKey(): boolean;
}
//# sourceMappingURL=openai-api-client.d.ts.map