Gateway Design
How the Mosaic Gateway routes and manages AI requests.
Gateway Design#
The Gateway is the central entry point for all AI requests. It implements a pipeline of middleware stages.
Request Pipeline#
- Authentication and rate limiting
- Policy evaluation (cost, latency, provider preference)
- Provider selection and failover
- Request transformation and forwarding
- Response streaming and telemetry emission
Configuration Example#
yaml
gateway:
listen: 0.0.0.0:8080
providers:
- name: openai
priority: 1
models: [gpt-4o, gpt-4o-mini]
- name: anthropic
priority: 2
models: [claude-sonnet-4-20250514]