The gateway uses Hono to register protocol-accurate routes. The routes call into a shared pipeline that handles auth, validation, routing, execution, and formatting.
Routes
apps/api/src/routes is the entry point for API endpoints:
root.ts and v1/index.ts register route groups.
v1/data/* wires OpenAI- and Anthropic-compatible data surfaces (chat, responses, messages, files, media).
v1/control/health.ts, v1/control/models.ts, and v1/control/analytics.ts cover control/utility endpoints.
Pipeline stages
apps/api/src/pipeline contains the core pipeline:
before/ handles auth, JSON parsing, validation, and context fetches.
execute/ selects providers and performs upstream calls.
after/ normalizes responses, handles streaming, and records billing data.
index.ts ties stages together for the IR-first execution path.
Last modified on February 11, 2026