Skip to main content
The Teagentic AI Gateway is a thin in-house wrapper around an OpenAI-compatible chat completions endpoint. It centralizes auth, JSON-mode enforcement, model defaults, and graceful fallback so every brew stage uses the same interface. All LLM calls go through src/lib/ai-gateway.server.ts:

Defaults

  • Endpoint: https://api.teagentic.ai/v1/chat/completions
  • Model: google/gemini-3-flash-preview
  • Response format: forced to json_object

Auth

The gateway is authenticated via the X-Teagentic-Key header, read from process.env.TEAGENTIC_AI_KEY at call time. Set this once in your hosting provider’s secret store; it’s never exposed to the browser.

Fallbacks

If the key is missing or the call fails, chatJSON returns null. The brew pipeline catches this and uses mockFallback() to keep the UI demoable. This means the app is always usable, even without credentials — but outputs will be generic.

Switching models

Supported models include the full Gemini and GPT families. Pass { model: "openai/gpt-5-mini" } to chatJSON to override per-call.