43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
/**
|
|
* HTTP/2 Proxy for LLM Streaming
|
|
*
|
|
* Features:
|
|
* - Multiplexing: Multiple streams over single connection
|
|
* - Header compression: HPACK reduces overhead by 30-80%
|
|
* - Server push: Proactive data delivery
|
|
* - Stream prioritization: Critical responses first
|
|
* - Binary protocol: More efficient than HTTP/1.1
|
|
*
|
|
* Performance: 30-50% faster streaming latency
|
|
*/
|
|
export interface HTTP2ProxyConfig {
|
|
cert?: string;
|
|
key?: string;
|
|
port: number;
|
|
geminiApiKey?: string;
|
|
anthropicApiKey?: string;
|
|
geminiBaseUrl?: string;
|
|
allowHTTP1?: boolean;
|
|
apiKeys?: string[];
|
|
rateLimit?: {
|
|
points: number;
|
|
duration: number;
|
|
blockDuration: number;
|
|
};
|
|
}
|
|
export declare class HTTP2Proxy {
|
|
private server;
|
|
private config;
|
|
private rateLimiter?;
|
|
private authManager;
|
|
constructor(config: HTTP2ProxyConfig);
|
|
private setupRoutes;
|
|
private handleHealthCheck;
|
|
private handleMessagesRequest;
|
|
private convertAnthropicToGemini;
|
|
private convertGeminiStreamToAnthropic;
|
|
private convertGeminiToAnthropic;
|
|
start(): Promise<void>;
|
|
stop(): Promise<void>;
|
|
}
|
|
//# sourceMappingURL=http2-proxy.d.ts.map
|