UNPKG

morpheus-node

Version:

Official Node.js SDK for the Morpheus API Gateway - Connect to the Morpheus-Lumerin AI Marketplace

225 lines 5.11 kB
/** * Core types for Morpheus Node SDK */ export interface RegisterRequest { email: string; password: string; username?: string; } export interface LoginRequest { email: string; password: string; } export interface AuthResponse { access_token: string; refresh_token: string; token_type: string; expires_in: number; } export interface RefreshTokenRequest { refresh_token: string; } export interface ApiKey { id: string; key: string; name?: string; created_at: string; last_used?: string; } export interface CreateApiKeyRequest { name?: string; } export interface PrivateKeyRequest { private_key: string; } export interface PrivateKeyStatus { has_private_key: boolean; address?: string; } export interface Delegation { id: string; delegatee_address: string; created_at: string; expires_at?: string; is_active: boolean; } export interface CreateDelegationRequest { delegatee_address: string; expires_at?: string; } export interface ChatMessage { role: 'system' | 'user' | 'assistant' | 'function'; content: string; name?: string; function_call?: { name: string; arguments: string; }; } export interface ChatCompletionRequest { model: string; messages: ChatMessage[]; temperature?: number; top_p?: number; n?: number; stream?: boolean; stop?: string | string[]; max_tokens?: number; presence_penalty?: number; frequency_penalty?: number; logit_bias?: Record<string, number>; user?: string; functions?: FunctionDefinition[]; function_call?: 'none' | 'auto' | { name: string; }; } export interface FunctionDefinition { name: string; description?: string; parameters?: Record<string, any>; } export interface ChatCompletionResponse { id: string; object: 'chat.completion'; created: number; model: string; choices: ChatChoice[]; usage: Usage; } export interface ChatChoice { index: number; message: ChatMessage; finish_reason: 'stop' | 'length' | 'function_call' | 'content_filter' | null; delta?: Partial<ChatMessage>; } export interface Usage { prompt_tokens: number; completion_tokens: number; total_tokens: number; } export interface ChatCompletionChunk { id: string; object: 'chat.completion.chunk'; created: number; model: string; choices: ChatChoice[]; } export interface Model { id: string; object: 'model'; created: number; owned_by: string; permission?: ModelPermission[]; root?: string; parent?: string; } export interface ModelPermission { id: string; object: 'model_permission'; created: number; allow_create_engine: boolean; allow_sampling: boolean; allow_logprobs: boolean; allow_search_indices: boolean; allow_view: boolean; allow_fine_tuning: boolean; organization: string; group: string | null; is_blocking: boolean; } export interface ModelListResponse { object: 'list'; data: Model[]; } export interface AllModelsResponse { models: ExtendedModel[]; } export interface ExtendedModel extends Model { provider?: string; max_context?: number; capabilities?: string[]; } export interface RatedBid { provider: string; model: string; bid_id: string; price_per_token: number; rating: number; latency?: number; throughput?: number; } export interface ApproveSpendingRequest { amount: string; token?: string; } export interface BidSessionRequest { bid_id: string; duration?: number; } export interface ModelSessionRequest { model: string; duration?: number; } export interface SessionResponse { session_id: string; status: 'active' | 'pending' | 'closed'; created_at: string; expires_at?: string; } export interface CloseSessionRequest { session_id: string; } export interface PingSessionRequest { session_id: string; } export interface AutomationSettings { enabled: boolean; max_spend_per_session?: string; max_spend_per_day?: string; allowed_models?: string[]; auto_approve_threshold?: string; } export interface MorpheusErrorResponse { error: { message: string; type: string; param?: string; code?: string; }; } export interface MorpheusConfig { apiKey?: string; accessToken?: string; baseURL?: string; timeout?: number; maxRetries?: number; retryDelay?: number; headers?: Record<string, string>; } export interface RequestOptions { timeout?: number; signal?: AbortSignal; headers?: Record<string, string>; } export type StreamEvent = { type: 'message'; data: ChatCompletionChunk; } | { type: 'error'; error: Error; } | { type: 'done'; } | { type: 'abort'; }; export interface HealthCheckResponse { status: 'healthy' | 'unhealthy'; version?: string; uptime?: number; services?: Record<string, { status: 'up' | 'down'; latency?: number; }>; } //# sourceMappingURL=types.d.ts.map