Skip to content

RouterConfig

Defined in: packages/ai.matey.types/src/router.ts:94

Router configuration options.

readonly optional capabilityBasedRouting: boolean

Defined in: packages/ai.matey.types/src/router.ts:155

Enable capability-based routing. When enabled, the router will select backends based on their model capabilities matching the request requirements.

false

readonly optional capabilityCacheDuration: number

Defined in: packages/ai.matey.types/src/router.ts:178

Cache duration for model capability data in milliseconds.

3600000 (1 hour)

readonly optional circuitBreakerThreshold: number

Defined in: packages/ai.matey.types/src/router.ts:129

Number of consecutive failures before circuit breaker opens.

5

readonly optional circuitBreakerTimeout: number

Defined in: packages/ai.matey.types/src/router.ts:135

Time to wait before attempting to close circuit breaker (milliseconds).

60000

readonly optional customFallback: CustomFallbackFunction

Defined in: packages/ai.matey.types/src/router.ts:188

Custom fallback function.


readonly optional customRouter: CustomRoutingFunction

Defined in: packages/ai.matey.types/src/router.ts:183

Custom routing function.


readonly optional defaultBackend: string

Defined in: packages/ai.matey.types/src/router.ts:110

Default backend to use if routing doesn’t select one.


readonly optional enableCircuitBreaker: boolean

Defined in: packages/ai.matey.types/src/router.ts:123

Enable circuit breaker pattern.

false

readonly optional fallbackStrategy: FallbackStrategy

Defined in: packages/ai.matey.types/src/router.ts:105

Fallback strategy when primary backend fails.

'sequential'

readonly optional healthCheckInterval: number

Defined in: packages/ai.matey.types/src/router.ts:117

Interval for health checking backends (milliseconds). Set to 0 to disable health checks.

0

readonly optional modelTranslation: ModelTranslationConfig

Defined in: packages/ai.matey.types/src/router.ts:195

Model translation configuration for fallback scenarios. Controls how model names are translated when falling back to different backends.

{ strategy: 'hybrid', warnOnDefault: true, strictMode: false }

readonly optional optimization: "cost" | "speed" | "quality" | "balanced"

Defined in: packages/ai.matey.types/src/router.ts:162

Optimization strategy for capability-based routing. Determines how to weigh cost, speed, and quality when selecting models.

'balanced'

readonly optional optimizationWeights: object

Defined in: packages/ai.matey.types/src/router.ts:168

Custom optimization weights for capability-based routing. Must sum to 1.0. Overrides optimization preset.

cost: number

quality: number

speed: number


readonly optional routingStrategy: RoutingStrategy

Defined in: packages/ai.matey.types/src/router.ts:99

Primary routing strategy.

'explicit'

readonly optional trackCost: boolean

Defined in: packages/ai.matey.types/src/router.ts:147

Track cost per backend (requires backends to implement estimateCost).

false

readonly optional trackLatency: boolean

Defined in: packages/ai.matey.types/src/router.ts:141

Track latency statistics per backend.

true