UNPKG

route-claudecode

Version:

Advanced routing and transformation system for Claude Code outputs to multiple AI providers

62 lines 1.64 kB
/** * 简化的OpenAI-Compatible Client * 移除多余的日志和复杂的判断逻辑 */ import { AxiosInstance } from 'axios'; import { BaseRequest, BaseResponse, Provider, ProviderConfig } from '@/types'; export declare class OpenAICompatibleClient implements Provider { config: ProviderConfig; readonly name: string; readonly type = "openai"; protected httpClient: AxiosInstance; private endpoint; private apiKey; private readonly maxRetries; private readonly retryDelay; constructor(config: ProviderConfig, providerId: string); /** * Check if provider is healthy */ isHealthy(): Promise<boolean>; /** * Execute request with retry logic */ private executeWithRetry; /** * Wait for retry delay */ private waitForRetry; /** * Check if error is retryable */ private isRetryableError; /** * Send request to OpenAI-compatible API */ sendRequest(request: BaseRequest): Promise<BaseResponse>; /** * Send streaming request */ sendStreamRequest(request: BaseRequest): AsyncIterable<any>; /** * Convert BaseRequest to OpenAI format */ private convertToOpenAI; /** * Convert messages to OpenAI format */ private convertMessages; /** * Convert content to OpenAI format */ private convertContent; /** * Convert OpenAI response to BaseResponse */ private convertFromOpenAI; /** * Convert OpenAI streaming chunk to Anthropic format */ private convertStreamChunkToAnthropic; } //# sourceMappingURL=client.d.ts.map