ModelRunnerBackendConfig
Defined in: packages/ai.matey.types/src/model-runner.ts:257
Configuration for model runner backends.
Extends BackendAdapterConfig with model runner-specific options.
Extends
Section titled “Extends”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.
Inherited from
Section titled “Inherited from”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.
Inherited from
Section titled “Inherited from”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});Inherited from
Section titled “Inherited from”BackendAdapterConfig.browserMode
cacheModels?
Section titled “cacheModels?”
readonlyoptionalcacheModels:boolean
Defined in: packages/ai.matey.types/src/adapters.ts:223
Enable model list caching.
Default
Section titled “Default”trueInherited from
Section titled “Inherited from”BackendAdapterConfig.cacheModels
communication
Section titled “communication”communication:
CommunicationConfig
Defined in: packages/ai.matey.types/src/model-runner.ts:271
Communication configuration.
custom?
Section titled “custom?”
readonlyoptionalcustom:Record<string,unknown>
Defined in: packages/ai.matey.types/src/adapters.ts:164
Provider-specific configuration options.
Inherited from
Section titled “Inherited from”debug?
Section titled “debug?”
readonlyoptionaldebug:boolean
Defined in: packages/ai.matey.types/src/adapters.ts:154
Enable debug logging.
Default
Section titled “Default”falseInherited from
Section titled “Inherited from”defaultModel?
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 AnthropicInherited from
Section titled “Inherited from”BackendAdapterConfig.defaultModel
headers?
Section titled “headers?”
readonlyoptionalheaders:Record<string,string>
Defined in: packages/ai.matey.types/src/adapters.ts:159
Custom HTTP headers to include in requests.
Inherited from
Section titled “Inherited from”lifecycle?
Section titled “lifecycle?”
optionallifecycle:LifecycleConfig
Defined in: packages/ai.matey.types/src/model-runner.ts:281
Lifecycle management configuration.
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”0Inherited from
Section titled “Inherited from”BackendAdapterConfig.maxRetries
model:
string|ModelReference
Defined in: packages/ai.matey.types/src/model-runner.ts:261
Model configuration.
models?
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
Inherited from
Section titled “Inherited from”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'Inherited from
Section titled “Inherited from”BackendAdapterConfig.modelsCacheScope
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)Inherited from
Section titled “Inherited from”BackendAdapterConfig.modelsCacheTTL
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.
Inherited from
Section titled “Inherited from”BackendAdapterConfig.modelsEndpoint
optionalport:number
Defined in: packages/ai.matey.types/src/model-runner.ts:287
Port number for HTTP communication. If not specified, an available port will be auto-discovered.
process
Section titled “process”process:
ProcessConfig
Defined in: packages/ai.matey.types/src/model-runner.ts:266
Process execution configuration.
promptTemplate?
Section titled “promptTemplate?”
optionalpromptTemplate:string|PromptTemplate
Defined in: packages/ai.matey.types/src/model-runner.ts:293
Prompt template name or custom template.
Example
Section titled “Example”'llama2', 'chatml', 'alpaca'runtime?
Section titled “runtime?”
optionalruntime:RuntimeConfig
Defined in: packages/ai.matey.types/src/model-runner.ts:276
Runtime configuration for model execution.
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' }Inherited from
Section titled “Inherited from”BackendAdapterConfig.streaming
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