askexperts
Version:
AskExperts SDK: build and use AI experts - ask them questions and pay with bitcoin on an open protocol
46 lines (45 loc) • 1.18 kB
TypeScript
/**
* OpenaiProxy class that provides an OpenAI-compatible API for NIP-174
*/
export declare class OpenaiProxy {
private app;
private port;
private basePath;
private stopped;
private server?;
private discoveryRelays?;
private pool;
/**
* Creates a new OpenAIProxy instance
*
* @param port - Port number to listen on
* @param basePath - Base path for the API (e.g., '/v1')
* @param discoveryRelays - Optional array of discovery relay URLs
*/
constructor(port: number, basePath?: string, discoveryRelays?: string[]);
/**
* Sets up the API routes
* @private
*/
private setupRoutes;
/**
* Handles requests to the chat completions endpoint
*
* @param req - Express request object
* @param res - Express response object
* @private
*/
private handleChatCompletions;
/**
* Starts the proxy server
*
* @returns Promise that resolves when the server is started
*/
start(): Promise<void>;
/**
* Stops the proxy server
*
* @returns Promise that resolves when the server is stopped
*/
stop(): Promise<void>;
}