UNPKG

@mastra/core

Version:
46 lines • 2 kB
import { MastraModelGateway } from './base.js'; import type { ProviderConfig, GatewayLanguageModel } from './base.js'; export interface MastraGatewayConfig { apiKey?: string; baseUrl?: string; customFetch?: typeof globalThis.fetch; } /** * Whether the Gateway serves Observational Memory for a given API key. * * Gateway keys come in two shapes with different memory behaviour: * - project keys (`msk_…`) are served with server-side Observational Memory; * - organization keys (`msk-gateway-…`, `mskv2_…`) are served by a gateway without * the memory API, so memory has to stay local. * * Anything unrecognised (including a missing key) reports `false`: memory is never * assumed to be handled remotely unless the key says so. */ export declare function gatewayServesObservationalMemory(apiKey: string | undefined): boolean; export declare class MastraGateway extends MastraModelGateway { private config?; readonly id = "mastra"; readonly name = "Gateway"; constructor(config?: MastraGatewayConfig | undefined); private getBaseUrl; shouldEnable(): boolean; /** * Gateway v2 deployments are signaled by MASTRA_GATEWAY_VERSION=v2 (set by the platform) * or by a v2 (organization) API key prefix, which predates the env var signal. * Keep in sync with isGatewayV2 in @mastra/server's gateway-memory-client. * Public so the server can ask a registered gateway instance for its * effective v2 state (the instance may carry a v2 key via config.apiKey * that env-only checks cannot see). */ isV2(): boolean; fetchProviders(): Promise<Record<string, ProviderConfig>>; buildUrl(_modelId: string): Promise<string>; getApiKey(): Promise<string>; resolveLanguageModel({ modelId, providerId, apiKey, headers, }: { modelId: string; providerId: string; apiKey: string; headers?: Record<string, string>; }): GatewayLanguageModel; } //# sourceMappingURL=mastra.d.ts.map