BackendAdapterConfig
Defined in: packages/ai.matey.types/src/adapters.ts:125
Configuration options for backend adapters.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”apiKey
Section titled “apiKey”
readonlyapiKey:string
Defined in: packages/ai.matey.types/src/adapters.ts:130
API key for authentication. Should be injected from environment or secure config.
baseURL?
Section titled “baseURL?”
readonlyoptionalbaseURL:string
Defined in: packages/ai.matey.types/src/adapters.ts:136
Base URL for API endpoint. Useful for proxies or alternative endpoints.
browserMode?
Section titled “browserMode?”
readonlyoptionalbrowserMode:boolean
Defined in: packages/ai.matey.types/src/adapters.ts:189
Enable browser-compatible mode.
⚠️ SECURITY WARNING: Enabling browser mode may expose API keys in client-side code. This option should ONLY be used for development and testing. Production applications should always use proxy servers to protect API keys.
Each provider implements browser compatibility differently:
- Anthropic: Adds
anthropic-dangerous-direct-browser-access: trueheader - Gemini: Already browser-compatible (API key in URL), this flag has no effect
- OpenAI: Already browser-compatible, this flag has no effect
- Other providers: May have provider-specific implementations
Default
Section titled “Default”falseExample
Section titled “Example”// Development only - DO NOT use in production!const backend = new AnthropicBackendAdapter({ apiKey: process.env.ANTHROPIC_API_KEY, browserMode: true // ⚠️ Exposes API key in browser});cacheModels?
Section titled “cacheModels?”
readonlyoptionalcacheModels:boolean
Defined in: packages/ai.matey.types/src/adapters.ts:223
Enable model list caching.
Default
Section titled “Default”truecustom?
Section titled “custom?”
readonlyoptionalcustom:Record<string,unknown>
Defined in: packages/ai.matey.types/src/adapters.ts:164
Provider-specific configuration options.
debug?
Section titled “debug?”
readonlyoptionaldebug:boolean
Defined in: packages/ai.matey.types/src/adapters.ts:154
Enable debug logging.
Default
Section titled “Default”falsedefaultModel?
Section titled “defaultModel?”
readonlyoptionaldefaultModel:string
Defined in: packages/ai.matey.types/src/adapters.ts:199
Default model to use when no model is specified in the request. This provides a fallback model for requests that don’t specify one.
Example
Section titled “Example”'gpt-4o' for OpenAI, 'claude-3-5-sonnet-20241022' for Anthropicheaders?
Section titled “headers?”
readonlyoptionalheaders:Record<string,string>
Defined in: packages/ai.matey.types/src/adapters.ts:159
Custom HTTP headers to include in requests.
maxRetries?
Section titled “maxRetries?”
readonlyoptionalmaxRetries:number
Defined in: packages/ai.matey.types/src/adapters.ts:148
Maximum number of retries for transient failures.
Default
Section titled “Default”0models?
Section titled “models?”
readonlyoptionalmodels: readonly (string|AIModel)[]
Defined in: packages/ai.matey.types/src/adapters.ts:211
Static model list (used when provider doesn’t have listing endpoint or to override remote list).
Can be either:
- Array of model IDs (strings) - will be normalized to AIModel objects
- Array of full AIModel objects with capabilities
modelsCacheScope?
Section titled “modelsCacheScope?”
readonlyoptionalmodelsCacheScope:"global"|"instance"
Defined in: packages/ai.matey.types/src/adapters.ts:237
Cache scope strategy.
- ‘global’: Share cache across all adapter instances (default)
- ‘instance’: Each adapter instance has its own cache
Default
Section titled “Default”'global'modelsCacheTTL?
Section titled “modelsCacheTTL?”
readonlyoptionalmodelsCacheTTL:number
Defined in: packages/ai.matey.types/src/adapters.ts:229
Cache TTL in milliseconds.
Default
Section titled “Default”3600000 (1 hour)modelsEndpoint?
Section titled “modelsEndpoint?”
readonlyoptionalmodelsEndpoint:string
Defined in: packages/ai.matey.types/src/adapters.ts:217
URL endpoint for fetching models (overrides default). Used for custom model endpoints or proxies.
streaming?
Section titled “streaming?”
readonlyoptionalstreaming:StreamingConfig
Defined in: packages/ai.matey.types/src/adapters.ts:251
Streaming configuration for this backend.
Controls how streaming responses are delivered:
- mode: ‘delta’ (incremental only) or ‘accumulated’ (full text each chunk)
- includeBoth: Whether to provide both delta and accumulated in chunks
- bufferStrategy: How to buffer for accumulated mode
Default
Section titled “Default”{ mode: 'delta', includeBoth: false, bufferStrategy: 'memory' }timeout?
Section titled “timeout?”
readonlyoptionaltimeout:number
Defined in: packages/ai.matey.types/src/adapters.ts:142
Request timeout in milliseconds.
Default
Section titled “Default”30000